HiveBrain v1.2.0
Get Started
← Back to all entries
patternsqlModerate

Is it ever harmful to set a database owner in SQL Server?

Submitted by: @import:stackexchange-dba··
0
Viewed 0 times
ownerharmfulsqldatabaseservereverset

Problem

There are a bunch of databases on one of our SQL servers that have no owner. Generally speaking, is it harmful to give them one? For example:

USE dbName;
GO

EXEC sp_changedbowner 'sa';
GO


I know sa may not be the best choice, but it is just an example. My primary concern is whether or not creating an owner when there is none may cause issues with software that can currently connect OK.

Solution

You should be using DDL instead of backward compatibility stored procedures:

ALTER AUTHORIZATION ON DATABASE::dbName TO sa;


And the owner of the database (never mind sa) should probably not be the account that your applications use, so this should not really have any effect on your applications. If it does then you should update the connection strings your application uses (which shouldn't be a major change) and make sure the account has sufficient - but not God - privileges.

Code Snippets

ALTER AUTHORIZATION ON DATABASE::dbName TO sa;

Context

StackExchange Database Administrators Q#37058, answer score: 12

Revisions (0)

No revisions yet.