Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2008 Forums
 SQL Server Administration (2008)
 Problem: new schema by user, logging via AD group

Author  Topic 

larus
Starting Member

17 Posts

Posted - 2010-06-09 : 13:08:29
I have an Active Directory group which has db_ddladmin rights for certain database. I have assigned a user into this group in AD. When this user creates a new table in this database, a new schema is created by SQL Server based on this user (the schema becomes <domain\user>). Also this new table is named based on schema, it becomes domain\user.tablename (<schema>.<table>).

How can I avoid this behavior? I would like to give dbo schema as a default schema for his AD group but it seems impossible (I tried but I got an error message).

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2010-06-09 : 13:26:34
In order for the user to create dbo objects, the user will need to be a member of the db_owner group.

Tara Kizer
Microsoft MVP for Windows Server System - SQL Server
http://weblogs.sqlteam.com/tarad/

Subscribe to my blog
Go to Top of Page

larus
Starting Member

17 Posts

Posted - 2010-06-09 : 13:42:33
Ok, thanks, but why SQL Server creates a new schema based on username (domain\user)? How this is prevented?
Go to Top of Page

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2010-06-09 : 13:43:31
That's just how it works in SQL Server 2005 and 2008. The behavior was different in 2000 and lower.

Tara Kizer
Microsoft MVP for Windows Server System - SQL Server
http://weblogs.sqlteam.com/tarad/

Subscribe to my blog
Go to Top of Page

larus
Starting Member

17 Posts

Posted - 2010-06-09 : 13:51:17
Many thanks. One further question. Would you suggest to give db_owner rights instead of db_ddladmin rights for a group (developers) because of this behavior? My fear is that when e.g. four developers create tables in this database, there will be problem with these "odd" schemas created by default by SQL Server.
Go to Top of Page

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2010-06-09 : 13:56:24
We give our developers db_owner in the development environments only. We trained them to specify "dbo." when creating objects.

When we go to production to create the objects, we do not create their schemas there.

Tara Kizer
Microsoft MVP for Windows Server System - SQL Server
http://weblogs.sqlteam.com/tarad/

Subscribe to my blog
Go to Top of Page

larus
Starting Member

17 Posts

Posted - 2010-06-09 : 14:02:06
Yes, we're testing these groups and rights in the testing instance, and when we are "sure" that our user rights managing method works, we are planning to use this on production instance. Actually I did not understand what do you mean by saying "we do not create their schemas there"?
Go to Top of Page

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2010-06-09 : 15:08:31
I just meant that if their schemas are created in the development environment, we don't migrate those to production.

Tara Kizer
Microsoft MVP for Windows Server System - SQL Server
http://weblogs.sqlteam.com/tarad/

Subscribe to my blog
Go to Top of Page

larus
Starting Member

17 Posts

Posted - 2010-06-10 : 01:38:08
Ok, many thanks!
Go to Top of Page

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2010-06-10 : 12:08:36
You're welcome.

Tara Kizer
Microsoft MVP for Windows Server System - SQL Server
http://weblogs.sqlteam.com/tarad/

Subscribe to my blog
Go to Top of Page
   

- Advertisement -