Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 

ALTER AUTHORIZATION sql to change owner of a database

ALTER AUTHORIZATION changes the ownership of  entities .  Server level entity ownership can be changed to server- level principals. Database level ownership can be changed to database level principals.

ALTER AUTHORIZATION can change database ownership.  This replaces sp_changedbowner.  Alter any security management scripts using sp_changedbowner  - such as Attach database without log file and rename database

According to SQL Server BOL

“This feature will be removed in a future version of Microsoft SQL Server. Avoid using this feature in new development work, and plan to modify applications that currently use this feature. Use ALTER AUTHORIZATION instead”

An example of ALTER AUTHORIZATION : a database  without an owner , may require an owner to be assigned. The login used to create the database or be assigned the database ownership  has been dropped. The database does not have an owner.

Using ALTER AUTHORIZATION assigns an owner.

 Example:

 ALTER AUTHORIZATION ON DATABASE::MyDatabase TO MyLoginUser;

 

There are special conditions around the usage of ALTER AUTHORIZATION . Read SQL Server BOL for details.

 

Author: Jack Vamvas (http://www.sqlserver-dba.com)

Comments

Posted by Anonymous on 27 September 2011

Pingback from  Dew Drop – September 27, 2011 | Alvin Ashcraft's Morning Dew

Posted by Anonymous on 27 September 2011

Pingback from  Dew Drop – September 27, 2011 | Alvin Ashcraft's Morning Dew

Leave a Comment

Please register or log in to leave a comment.