Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion Groups
DB Engine
SQL ServerMSDESQL Server CE
Services
Analysis (Data Mining)Analysis (OLAP)DTSIntegration ServicesNotification ServicesReporting Services
Programming
CLRConnectivitySQLXML
Other Technologies
ClusteringEnglish QueryFull-Text SearchReplicationService Broker
General
Data WarehousingPerformanceSecuritySetupSQL Server ToolsOther SQL Server Topics
DirectoryUser Groups
Related Topics
MS AccessOther DB ProductsMS Server Products.NET DevelopmentVB DevelopmentJava DevelopmentMore Topics ...

SQL Server Forum / DB Engine / SQL Server / March 2008

Tip: Looking for answers? Try searching our database.

Default database mapping is "Master" - why?

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Spin - 19 Mar 2008 04:06 GMT
Gurus,

Running SQL Server 2005 SP2.  I noticed when I explore my users SQL database
mappings, a lot of times their default database is "Master" instead of the
various application databases which exist on the server.  Which is correct,
pointing at master or to their specific application database?

Signature

Spin

Linchi Shea - 19 Mar 2008 04:46 GMT
Both are correct. It's a matter of how you'd like to set the default database
of a login, and you can use sp_defaultdb to change it. The most likely reason
why they have different default databases is that the logins were not created
consistently. Some were created with an explicit default database, while the
other were created without an explicit default, in which case master would be
chosen as the default database for the login.

Linchi

> Gurus,
>
> Running SQL Server 2005 SP2.  I noticed when I explore my users SQL database
> mappings, a lot of times their default database is "Master" instead of the
> various application databases which exist on the server.  Which is correct,
> pointing at master or to their specific application database?
Spin - 19 Mar 2008 05:50 GMT
> Both are correct. It's a matter of how you'd like to set the default
> database
[quoted text clipped - 7 lines]
> be
> chosen as the default database for the login.

But if users cannot login into "Master" than it would make sense for
performance reasons (faster login) to properly set the databse during
account setup correct?

Spin
Uri Dimant - 19 Mar 2008 08:40 GMT
Spin
I do not know your business requirements as well as  how your application
does the work.
What if you set default database  and that database git corrupted. Login
could bot connect to the server to see/repair the database?

>> Both are correct. It's a matter of how you'd like to set the default
>> database
[quoted text clipped - 13 lines]
>
> Spin
Tibor Karaszi - 19 Mar 2008 08:48 GMT
> But if users cannot login into "Master"

You don't "login" to a database. You login to the instance and then "use" a database. Also, every
login can use master since there is a guest user in the master database.

> than it would make sense for performance reasons (faster login) to properly set the databse during
> account setup correct?

Default database do no affect login time.

In most cases the default database is irrelevant since your application will connect to the desired
database thanks to the db name specified in the connection string.

Signature

Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://sqlblog.com/blogs/tibor_karaszi

>> Both are correct. It's a matter of how you'd like to set the default database
>> of a login, and you can use sp_defaultdb to change it. The most likely reason
[quoted text clipped - 7 lines]
>
> Spin
Uri Dimant - 19 Mar 2008 09:02 GMT
Tibor
If  you try connect with a login who has corrupted/notexistence database (
was set as a deafult) then you cannot connect to the server, I think that is
what  the OP meant .

>> But if users cannot login into "Master"
>
[quoted text clipped - 28 lines]
>>
>> Spin
Tibor Karaszi - 19 Mar 2008 10:34 GMT
Hi Uri,

> If  you try connect with a login who has corrupted/notexistence database ( was set as a deafult)
> then you cannot connect to the server

Correct, for some applications. Where other will fall back to some other database.

> , I think that is what  the OP meant .

I don't think so. I do not see any reference to a non-existing default database in below OP's post,
to which my reply was for:

>>> But if users cannot login into "Master" than it would make sense for performance reasons (faster
>>> login) to properly set the databse during account setup correct?

Signature

Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://sqlblog.com/blogs/tibor_karaszi

> Tibor
> If  you try connect with a login who has corrupted/notexistence database ( was set as a deafult)
[quoted text clipped - 24 lines]
>>>
>>> Spin
Uri Dimant - 19 Mar 2008 11:06 GMT
Hi Tibor
> Correct, for some applications.

Such as QA :-))))

> I don't think so. I do not see any reference to a non-existing default
> database in below OP's post, to which my reply was for:

I re-read his post. You got it right.

> Hi Uri,
>
[quoted text clipped - 50 lines]
>>>>
>>>> Spin
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2009 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.