Execute As

We all want to have our databases not owned by an individual. Especially the model database. We can run alter authorization on database::<<db name>> to sa after the fact, but why make a problem? An easy way to avoid this situation without having to log in as sa is to run “execute as login=’sa’” prior to running the restore command. This is doubly useful when restoring databases with norecovery for mirroring when you can’t run the alter database later.

This entry was posted in Configuration, DBA, SQL. Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *