Changes the owner of a user database.
sp_changedbowner loginame[, true]
is the login name of the new owner of the current database.
transfers aliases and their permissions to the new database owner. Values are “true” and “TRUE”.
Makes the user “albert” the owner of the current database:
sp_changedbowner albert
The new owner must not already be known as either a user or alias (that is, the new owner must not already be listed in sysusers or sysalternates). Executing sp_changedbowner with the single parameter loginame changes the database ownership to loginame and drops aliases of users who could act as the old “dbo.”
After executing sp_changedbowner, the new owner is known as the database owner inside the database.
sp_changedbowner cannot transfer ownership of the system databases.
The new owner must already have a login name in Adaptive Server, but must not have a database user name or alias name in the database. To assign database ownership to such a user, drop the user name or alias entry before executing sp_changedbowner.
To grant permissions to the new owner, a system administrator must grant them to the database owner, since the user is no longer known inside the database under any other name.
The permission checks for sp_changedbowner differ based on your granular permissions settings.
Granular permissions enabled |
With granular permissions enabled, you must be a user with own any database privilege. |
Granular permissions disabled |
With granular permissions disabled, you must be a user with sa_role. |
Values in event and extrainfo columns from the sysaudits table are:
Event |
Audit option |
Command or access audited |
Information in extrainfo |
---|---|---|---|
38 |
exec_procedure |
Execution of a procedure |
|
Commands create database
System procedures sp_addlogin, sp_dropalias, sp_dropuser, sp_helpdb