Changes the owner of a user database.
sp_changedbowner loginame[, true]
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 the SAP ASE 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.
See also create database in Reference Manual: Commands.
The permission checks for sp_changedbowner differ based on your granular permissions settings.
Setting | Description |
---|---|
Enabled | With granular permissions enabled, you must be a user with own any database privilege. |
Disabled | With granular permissions disabled, you must be a user with sa_role. |
Values in event and extrainfo columns from the sysaudits table are:
Information | Values |
---|---|
Event | 38 |
Audit option | exec_procedure |
Command or access audited | Execution of a procedure |
Information in extrainfo |
|