Determine Database Owner

Determining the database owner is important if you want to take advantage of cross-database-ownership-chaining. If databases have different owners, then you have issues with accessing objects between databases.

To find the database owners:

[cc lang=”sql”]
SELECT SUSER_SNAME(owner_sid)
FROM sys.databases
[/cc]

To change the owner of a database:

[cc lang=”sql”]
USE database
EXEC sp_changedbowner ‘sa’
[/cc]

The standard owner for databases is usually sa.

2 comments
Bhanu Prakash 29 Apr 2016 at 7:38 am

trying to find the owner of the database, when i select the sys.databases table the owner id is encrypted. in these types of scenarios how i can view who owns that databases

Lucas 29 Aug 2015 at 7:21 am

Hi Mark,The reason it spdees up is due to the fact that there is a table for users menu that lists the actions when a user logs into a company and by dropping the stored procedures and re-creating using the SQL Maintenance options re-creates the data in the table. This process was given to me by Microsoft Dynamics Tech Support Engineer.

Featured Articles

 Site Author

  • Thanks for visiting!
css.php