Ureader.com  
Microsoft software help and Community
   home   |   control panel login   |   archive   |  
 
SQL
ce
clients
clustering
connect
datamining
datawarehouse
dts
fulltext
jdbcdriver
msde
mseq
newusers
notificationsvcs
odbc
olap
programming
replication
reportingsvcs
security
securitytools
server
setup
sqlxml.viewmapper
tools
xml
  
 
date: Sun, 20 Jul 2008 17:59:47 -0300,    group: microsoft.public.sqlserver.security        back       


Master database must never be the default database for any login   
By default, MASTER is the default database for any login created, unless we 
change it.
Is it possible I configure SQL Server to set a default database other than 
MASTER to any logins created automatically?
For example, I would like to have all my logins pointing to MODEL database 
by default, unless we change it.

Thanks,

Felipe
date: Sun, 20 Jul 2008 17:59:47 -0300   author:   Carlos Felipe Fran?a da Fonseca

Re: Master database must never be the default database for any login   
Carlos Felipe França da Fonseca (carlosfelipefranca@gmail.com) writes:
> By default, MASTER is the default database for any login created, unless
> we change it. 
> Is it possible I configure SQL Server to set a default database other than 
> MASTER to any logins created automatically?

You can change for existing logins, see my other post. You could handle
new logins with a server-wide DDL trigger if you are on SQL 2005.

> For example, I would like to have all my logins pointing to MODEL database 
> by default, unless we change it.
 
I understand the sentiment, and I agree that tempdb is a much better choice
as a default database. Model, on the other hand is not. Generally, you 
cannot create new databases, if there are active users in model. And the
problem with master as default database for a login with sysadmin privs, 
is that he can create objects in master by mistake. Well, you don't want
objects created in model by mistake either.


-- 
Erland Sommarskog, SQL Server MVP, esquel@sommarskog.se

Books Online for SQL Server 2005 at
http://www.microsoft.com/technet/prodtechnol/sql/2005/downloads/books.mspx
Books Online for SQL Server 2000 at
http://www.microsoft.com/sql/prodinfo/previousversions/books.mspx
date: Sun, 20 Jul 2008 15:00:27 -0700   author:   Erland Sommarskog

Re: Master database must never be the default database for any login   
Thanks for your answer, Erland.

I mentioned MODEL only as an example.
So, let's say that I want TEMPDB as my default database for all logins 
created in SQL Server 2000.
Is it possible?

Thanks again,

Felipe

"Erland Sommarskog"  wrote in message 
news:Xns9AE2144842FYazorman@127.0.0.1...
> Carlos Felipe França da Fonseca (carlosfelipefranca@gmail.com) writes:
>> By default, MASTER is the default database for any login created, unless
>> we change it.
>> Is it possible I configure SQL Server to set a default database other 
>> than
>> MASTER to any logins created automatically?
>
> You can change for existing logins, see my other post. You could handle
> new logins with a server-wide DDL trigger if you are on SQL 2005.
>
>> For example, I would like to have all my logins pointing to MODEL 
>> database
>> by default, unless we change it.
>
> I understand the sentiment, and I agree that tempdb is a much better 
> choice
> as a default database. Model, on the other hand is not. Generally, you
> cannot create new databases, if there are active users in model. And the
> problem with master as default database for a login with sysadmin privs,
> is that he can create objects in master by mistake. Well, you don't want
> objects created in model by mistake either.
>
>
> -- 
> Erland Sommarskog, SQL Server MVP, esquel@sommarskog.se
>
> Books Online for SQL Server 2005 at
> http://www.microsoft.com/technet/prodtechnol/sql/2005/downloads/books.mspx
> Books Online for SQL Server 2000 at
> http://www.microsoft.com/sql/prodinfo/previousversions/books.mspx
date: Sun, 20 Jul 2008 19:46:00 -0300   author:   Carlos Felipe Fran?a da Fonseca

Re: Master database must never be the default database for any login   
Carlos Felipe França da Fonseca (carlosfelipefranca@gmail.com) writes:
> I mentioned MODEL only as an example.
> So, let's say that I want TEMPDB as my default database for all logins 
> created in SQL Server 2000.
> Is it possible?
 
To deal with current logins, this is the query I posted for SQL 2000:

   SELECT 'EXEC sp_defaultdb ' + quotename(name) + ', 'thedbofyourchocie'
   FROM   syslogins

Copy and paste result into a query window.

For new logins, you will have to be observant and fix it yourself. 


-- 
Erland Sommarskog, SQL Server MVP, esquel@sommarskog.se

Books Online for SQL Server 2005 at
http://www.microsoft.com/technet/prodtechnol/sql/2005/downloads/books.mspx
Books Online for SQL Server 2000 at
http://www.microsoft.com/sql/prodinfo/previousversions/books.mspx
date: Mon, 21 Jul 2008 01:44:56 -0700   author:   Erland Sommarskog

Google
 
Web ureader.com


    COPYRIGHT 2007, YARDI TECHNOLOGY LIMITED, ALL RIGHT RESERVE  |   contact us