|
|
|
Right there with Babe
      
Group: General Forum Members
Last Login: Friday, May 31, 2013 2:54 PM
Points: 769,
Visits: 216
|
|
|
|
|
|
SSC Rookie
      
Group: General Forum Members
Last Login: Monday, January 28, 2013 11:40 AM
Points: 45,
Visits: 79
|
|
In an article like this the definition of dbo is a good thing to explain. BOL is vague about it: "The dbo is a user...". Does it mean a login or a server role, or anything else?
|
|
|
|
|
Hall of Fame
       
Group: General Forum Members
Last Login: Monday, July 30, 2012 10:42 AM
Points: 3,434,
Visits: 519
|
|
Hello, This is a good research work, thanks. I would also add that when a database is restored / moved from another server the db owner changes in most cases unless it is SA or Domain Login with access to both machines or a standard login explicitly created with the same SID on both machines (the list of exceptions is not possibly complete). We did see ownership issues in this case because DBO user is not mapped to any login which is not expected by most of developers if they move databases themselves in the development environment. Also many beginners do not realize that by default SQL EM (Enterprise Manager) has a local server registered in the security context of Windows authentication. So is the default selection when registering the servers. So in many cases when they create objects it is thire Windows login that is the owner. Yelena.
Regards, Yelena Varshal
|
|
|
|
|
Right there with Babe
      
Group: General Forum Members
Last Login: Friday, May 31, 2013 2:54 PM
Points: 769,
Visits: 216
|
|
DBO is a database user. There are no special rights on the server and it isn't a login. There is also a role called db_owner that DBO is a member of. Members of this role can do anything within a database.
Aunt Kathi Microsoft (Former SQL Server MVP)
|
|
|
|
|
SSC Journeyman
      
Group: General Forum Members
Last Login: Tuesday, October 09, 2012 5:54 PM
Points: 99,
Visits: 22
|
|
Kathi, Thanks for this article. It is clear and concise. Nate
|
|
|
|
|
SSC Journeyman
      
Group: General Forum Members
Last Login: Thursday, September 27, 2007 7:31 AM
Points: 81,
Visits: 2
|
|
Cannot agree more, nice and handy. I just wanted to say that it is neater to use EXEC in front of the stored procedure rather than GO at the end, so that the code may look like this: declare @OldOwner varchar(100) declare @NewOwner varchar(100) set @OldOwner = 'sys' set @NewOwner = 'dbo' select 'EXEC sp_changeobjectowner ''[' + table_schema + '].[' + table_name + ']'', ''' + @NewOwner + '''' from information_schema.tables where Table_schema = @OldOwner
and the output may look like this: EXEC sp_changeobjectowner '[sys].[author]', 'dbo' EXEC sp_changeobjectowner '[sys].[OrderItem]', 'dbo' Just a very minor thing, thank you for the script. I used to do this using a cursor and PRINT command but it is much quicker this way. Thank you, Dmytro
|
|
|
|
|
SSC Journeyman
      
Group: General Forum Members
Last Login: Friday, May 28, 2010 4:06 PM
Points: 96,
Visits: 6
|
|
Object Ownership has been something that has confused me for some time but now it is all clear. Thanks for submitting the article it was very easy to understand especially the chart!!! Paul Cyr
|
|
|
|
|
Right there with Babe
      
Group: General Forum Members
Last Login: Friday, May 31, 2013 2:54 PM
Points: 769,
Visits: 216
|
|
Glad I could help. I am thinking about writing a new article on SQL Server 2005 schemas.
Aunt Kathi Microsoft (Former SQL Server MVP)
|
|
|
|
|
Old Hand
      
Group: General Forum Members
Last Login: Sunday, June 02, 2013 7:10 PM
Points: 362,
Visits: 326
|
|
Kathi, Thanks for the article, and looking forward to the 2005 version. We've just started investigating the implications of the user / schema separation, and oooohhh.. there seem to be a few gotchas. Stephen
|
|
|
|
|
Forum Newbie
      
Group: General Forum Members
Last Login: Tuesday, August 05, 2008 1:46 PM
Points: 1,
Visits: 3
|
|
From the title of this article, I expected a discussion of various ownership strategies included in the article, the pros and cons of having dbo as the owner, as well as when it appropriate to have some other owner.
Bill
|
|
|
|