Home Forums SQL Server 2005 Administering DBO permissions on database replaced during RESTORE RE: DBO permissions on database replaced during RESTORE

  • have your dba create a procedure that features EXECUTE AS OWNER that adds missing permissions.

    have the procedure loop through each database on the dev server, and do a classic if not exists(select * from sys.database_principals)

    create user....also add the users to db_owner or whatever roles are appropriate.

    with the work scripted out once, he can grant developers execute to the procedure, so they can add themselves to newly restored databases. kind of wierd that they can restore a database, but not add themselves as users....

    I've also fiddled with extended events, andlaunching a procedure which does the above when the extended event AUDIT_BACKUP_RESTORE_EVENT is kicked off.

    i can't seem to find my code example yet.

    Lowell


    --help us help you! If you post a question, make sure you include a CREATE TABLE... statement and INSERT INTO... statement into that table to give the volunteers here representative data. with your description of the problem, we can provide a tested, verifiable solution to your question! asking the question the right way gets you a tested answer the fastest way possible!