Thursday, March 22, 2012

Changing the "dbo" schema owner...breakage?

Let's say...
The Developer makes a database on their laptop. It's backed up and restored
to a production database server.
Upon investigation, the DBA determines the Developer is unrestricted in the
database (YIKES) and investigates properties of the dbo schema. The dbo
schema is owned by the user account of the developer.
There is, of course, a button to change the owner of the dbo schema to
another entity. But the student did a little probing and SUPPOSEDLY found
warnings that state there are some sort of issues with changing the owner of
the dbo schema.
Please "weigh in" here and let me know if there any gotchas with this, and,
if you've actually done this in production with safe results.
Thanks,
George Squillace
East Lansing, MI> Upon investigation, the DBA determines the Developer is unrestricted in
> the
> database (YIKES) and investigates properties of the dbo schema. The dbo
> schema is owned by the user account of the developer.
The dbo schema owner cannot be changed so I can't think of a scenario where
the dbo schema owner could have gotten changed a user other than 'dbo'.
Verify schema owner using the following query:
SELECT
s.name AS SchemaName,
sp.name AS SchemaOwner
FROM sys.schemas s
JOIN sys.database_principals sp ON
sp.principal_id = s.principal_id
WHERE
s.name = 'dbo'
Perhaps the schema is properly owned by the dbo user but the dbo user
mapping is incorrect, which is determined by database ownership. You can
change database ownership with sp_changedbowner.
Hope this helps.
Dan Guzman
SQL Server MVP
"George Squillace" <GeorgeSquillace@.discussions.microsoft.com> wrote in
message news:80430CCF-BBFC-4E9C-81E6-70779CDD00A8@.microsoft.com...
> Let's say...
> The Developer makes a database on their laptop. It's backed up and
> restored
> to a production database server.
> Upon investigation, the DBA determines the Developer is unrestricted in
> the
> database (YIKES) and investigates properties of the dbo schema. The dbo
> schema is owned by the user account of the developer.
> There is, of course, a button to change the owner of the dbo schema to
> another entity. But the student did a little probing and SUPPOSEDLY found
> warnings that state there are some sort of issues with changing the owner
> of
> the dbo schema.
> Please "weigh in" here and let me know if there any gotchas with this,
> and,
> if you've actually done this in production with safe results.
> Thanks,
> George Squillace
> East Lansing, MI

No comments:

Post a Comment