Click here to monitor SSC
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


Worst Practices - Objects Not Owned by DBO


Worst Practices - Objects Not Owned by DBO

Author
Message
Andy Warren
Andy Warren
SSCertifiable
SSCertifiable (7.2K reputation)SSCertifiable (7.2K reputation)SSCertifiable (7.2K reputation)SSCertifiable (7.2K reputation)SSCertifiable (7.2K reputation)SSCertifiable (7.2K reputation)SSCertifiable (7.2K reputation)SSCertifiable (7.2K reputation)

Group: Moderators
Points: 7235 Visits: 2679
Comments posted to this topic are about the content posted at http://www.sqlservercentral.com/columnists/awarren/worstpracticesobjectsnotownedbydbo.asp>http://www.sqlservercentral.com/columnists/awarren/worstpracticesobjectsnotownedbydbo.asp

Andy
SQLAndy - My Blog!
Connect with me on LinkedIn
Follow me on Twitter
mcurnutt
mcurnutt
Valued Member
Valued Member (74 reputation)Valued Member (74 reputation)Valued Member (74 reputation)Valued Member (74 reputation)Valued Member (74 reputation)Valued Member (74 reputation)Valued Member (74 reputation)Valued Member (74 reputation)

Group: General Forum Members
Points: 74 Visits: 1
I agree with you 100%. I am currently working on a project where they have made all objects owned by user "rms" and they have turned on Case Sensitivity, don't ask me why. It is like pulling your hair out. I think until people actually experience the agony they will not completely realize how unpleasant they can make life. I have learned the hard way more than once, and although previously I knew that making objects be owned by anyone other than dbo was bad, I had not yet lived with the consequences. Also, in this case, you can kiss all of your dynamic SQL (inside stored procedures) goodbye. From one who has been there, don't do it! And while you're at it, unless you absolutely have to, do not turn on Case Sensitivity. With both, you will end up debugging things that used to work, and debugging things that you know should work.

Mindy Curnutt



ckempste
ckempste
SSC Eights!
SSC Eights! (885 reputation)SSC Eights! (885 reputation)SSC Eights! (885 reputation)SSC Eights! (885 reputation)SSC Eights! (885 reputation)SSC Eights! (885 reputation)SSC Eights! (885 reputation)SSC Eights! (885 reputation)

Group: General Forum Members
Points: 885 Visits: 1
Hi there

Yes, I agree and learnt the hard way. This is a real gotcha when your an oracle DBA moving into the SQLServer realm. Basically I now take the approach of all DBO owned objects then either application or other roles to security records accordingly, this is a much similar and better managed approach (and for all the reasons discussed in your article).

Cheers

Chris


Chris Kempster
www.chriskempster.com
Author of "SQL Server Backup, Recovery & Troubleshooting"
Author of "SQL Server 2k for the Oracle DBA"
David.Poole
David.Poole
Hall of Fame
Hall of Fame (3.7K reputation)Hall of Fame (3.7K reputation)Hall of Fame (3.7K reputation)Hall of Fame (3.7K reputation)Hall of Fame (3.7K reputation)Hall of Fame (3.7K reputation)Hall of Fame (3.7K reputation)Hall of Fame (3.7K reputation)

Group: General Forum Members
Points: 3692 Visits: 3118
Yes definitely

When I did the SQL 6.5 courses I was lucky enough to be taught by a trainer with commercial dba and they stressed the importance of this.

One thing I am not clear on. In SQL 6.5 you had to use sp_addalias to make logins impersonate dbo. SQL 7 seems to discourage this, and yet simply adding a login to the db_owner group seems to create these ownership issues.

How are you supposed to do it SQL 8 if you don't use sp_addalias?

LinkedIn Profile

Newbie on www.simple-talk.com
perjohan
perjohan
Forum Newbie
Forum Newbie (8 reputation)Forum Newbie (8 reputation)Forum Newbie (8 reputation)Forum Newbie (8 reputation)Forum Newbie (8 reputation)Forum Newbie (8 reputation)Forum Newbie (8 reputation)Forum Newbie (8 reputation)

Group: General Forum Members
Points: 8 Visits: 1
I agree fully. Btw.: Have you ever tried to change owner on a userdefined data type? If it is a nightmare to change owners on ordinary objects, it has been impossible for me to figure out how to handle udt's.

Per-Johan



danw
danw
SSC-Enthusiastic
SSC-Enthusiastic (126 reputation)SSC-Enthusiastic (126 reputation)SSC-Enthusiastic (126 reputation)SSC-Enthusiastic (126 reputation)SSC-Enthusiastic (126 reputation)SSC-Enthusiastic (126 reputation)SSC-Enthusiastic (126 reputation)SSC-Enthusiastic (126 reputation)

Group: General Forum Members
Points: 126 Visits: 59
I agree for the most part...object ownership can be a real pain if everyone is allowed to create objects. There are some pretty strange circumstances where object ownership can be very beneficial. One interesting thing about SQL Server is that you can have a view owned by userA with the exact same name as a table owned by DBO. It's a very usefull way of limiting an applications access to a database without modifing the DATA or the application in any way. For example, an web application was written to allow HR to query employee records from a database before you were the DBA. Now you are faced with the task of removing the EMP_Password column from the web application, but the backend HR system still needs this data. You could just create a view of the dbo.Employee table With Encryption and name it dbo.Employee_View. Then create a View of the dbo.Employee_View view called WebAppUser.Employee and that's it you're done. Object ownership can be tricky, but object ownership can help you trick things too!



Andy Warren
Andy Warren
SSCertifiable
SSCertifiable (7.2K reputation)SSCertifiable (7.2K reputation)SSCertifiable (7.2K reputation)SSCertifiable (7.2K reputation)SSCertifiable (7.2K reputation)SSCertifiable (7.2K reputation)SSCertifiable (7.2K reputation)SSCertifiable (7.2K reputation)

Group: Moderators
Points: 7235 Visits: 2679
Dan, there are certainly some interesting things you can do with object ownership. Now whether you should...thats the question! If you're using it intentionally to solve a business need, good for you - though maybe sometime we can debate whether there is a better, more elegant method that would just use dbo:-)

Mindy - saw your post earlier, just didnt have time to respond - case sensitivity....definitely will make the worst practices list sooner or later! I'm ok with limited use of this on a few columns, but not database wide. What a time sink.

Thanks to all who have posted comments so far - I appreciate you taking the time to do so.

Andy

Andy
SQLAndy - My Blog!
Connect with me on LinkedIn
Follow me on Twitter
Merkin
Merkin
Forum Newbie
Forum Newbie (1 reputation)Forum Newbie (1 reputation)Forum Newbie (1 reputation)Forum Newbie (1 reputation)Forum Newbie (1 reputation)Forum Newbie (1 reputation)Forum Newbie (1 reputation)Forum Newbie (1 reputation)

Group: General Forum Members
Points: 1 Visits: 1
quote:

I am currently working on a project where they have made all objects owned by user "rms"



WOW, I thought he only worked with free software. I wonder what the /. crowd will say.

Sorry, I couldn't help myself



dinus
dinus
Grasshopper
Grasshopper (12 reputation)Grasshopper (12 reputation)Grasshopper (12 reputation)Grasshopper (12 reputation)Grasshopper (12 reputation)Grasshopper (12 reputation)Grasshopper (12 reputation)Grasshopper (12 reputation)

Group: General Forum Members
Points: 12 Visits: 1
I totally agree! I have been caught out a couple of times because of ownership - it's a real pain.

Life's much easier if it's dbo all the way...



Mat_20k
Mat_20k
Grasshopper
Grasshopper (12 reputation)Grasshopper (12 reputation)Grasshopper (12 reputation)Grasshopper (12 reputation)Grasshopper (12 reputation)Grasshopper (12 reputation)Grasshopper (12 reputation)Grasshopper (12 reputation)

Group: General Forum Members
Points: 12 Visits: 1
This is somthing i have been trying to stress to the development team i work with for ages. thanks for a well written back-up to my nagging.



Go


Permissions

You can't post new topics.
You can't post topic replies.
You can't post new polls.
You can't post replies to polls.
You can't edit your own topics.
You can't delete your own topics.
You can't edit other topics.
You can't delete other topics.
You can't edit your own posts.
You can't edit other posts.
You can't delete your own posts.
You can't delete other posts.
You can't post events.
You can't edit your own events.
You can't edit other events.
You can't delete your own events.
You can't delete other events.
You can't send private messages.
You can't send emails.
You can read topics.
You can't vote in polls.
You can't upload attachments.
You can download attachments.
You can't post HTML code.
You can't edit HTML code.
You can't post IFCode.
You can't post JavaScript.
You can post emoticons.
You can't post or upload images.

Select a forum

































































































































































SQLServerCentral


Search