Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase 12»»

What is your default database set to? Expand / Collapse
Author
Message
Posted Wednesday, November 13, 2013 9:18 PM
SSCommitted

SSCommittedSSCommittedSSCommittedSSCommittedSSCommittedSSCommittedSSCommittedSSCommitted

Group: General Forum Members
Last Login: Tuesday, April 01, 2014 9:12 AM
Points: 1,730, Visits: 404
Comments posted to this topic are about the item What is your default database set to?
Post #1514138
Posted Thursday, November 14, 2013 2:17 AM
SSCrazy

SSCrazySSCrazySSCrazySSCrazySSCrazySSCrazySSCrazySSCrazy

Group: General Forum Members
Last Login: Monday, April 14, 2014 3:21 AM
Points: 2,797, Visits: 3,079
It is definitely good to know the implications of choosing a default database.

A few years back I worked with the Remedy help desk system. I do not know if it has been changed for this issue, but back then the default database for the Remedy login had to be the Remedy database. The account also needed to be the db owner account as shown in database properties, or be set to use a default schema of dbo. This is because Remedy would create tables as required, and often used the syntax "CREATE TABLE xxx". The read statements typically took the form "SELECT FROM dbo.xxx" or "SELECT FROM remedydb.dbo.xxx", so you needed to make sure the defaults that applied to the table creates would work with the explicit names used for the select statements.

You are unlikely to have a one-size-fits-all solution to allocating the default database for a user, but you definitely need to know any special needs the user account has, and the implications around the database you choose.


Original author: SQL Server FineBuild 1-click install and best practice configuration of SQL Server 2014, 2012, 2008 R2, 2008 and 2005. 25 March 2014: now over 28,000 downloads.
Disclaimer: All information provided is a personal opinion that may not match reality.
Concept: "Pizza Apartheid" - the discrimination that separates those who earn enough in one day to buy a pizza if they want one, from those who can not.
Post #1514176
Posted Thursday, November 14, 2013 3:03 AM
SSC Rookie

SSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC Rookie

Group: General Forum Members
Last Login: Yesterday @ 9:16 AM
Points: 29, Visits: 98
Happened to me just the other day! Took me a while to figure it out
Post #1514197
Posted Thursday, November 14, 2013 4:25 AM
SSC-Enthusiastic

SSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-Enthusiastic

Group: General Forum Members
Last Login: Sunday, March 09, 2014 8:27 AM
Points: 166, Visits: 570
I learnt it the hard way... while i cleaned up few databases (after migration), users complaint of not being able to connect... though error message was quite obvious and hence i changed the default db of logins to fix the issue

Cheers,
Ankur
Post #1514213
Posted Thursday, November 14, 2013 7:23 AM
SSC Veteran

SSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC Veteran

Group: General Forum Members
Last Login: Monday, January 27, 2014 1:13 PM
Points: 229, Visits: 37
We use a lot of applications with dedicated user and roles.
In that particular case, since the account should only have access to that specific DB, we do default to the specific DB as default.
For other "management" accounts, we default to master. We identified this issue a long time ago - the hard way like many - and without really thinking about it, we adopted this method. If your DB is down, the application that requires it will be down, which is really easy to spot :)

Thanks for the good explanation.
Olivier
Post #1514273
Posted Thursday, November 14, 2013 7:54 AM


Ten Centuries

Ten CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen Centuries

Group: General Forum Members
Last Login: Monday, April 07, 2014 8:53 AM
Points: 1,182, Visits: 1,949
I assign all of my SQL Server logins to the tempdb as the default database. NEVER master. This way no harm can be done by an application that just connects to the server without specifying a database name as part of the connection string. Ideally, I'd like to see an option of "none".


(PHB) I think we should build an SQL database. (Dilbert) What color do you want that database? (PHB) I think mauve has the most RAM.
Post #1514294
Posted Thursday, November 14, 2013 8:35 AM
SSC Eights!

SSC Eights!SSC Eights!SSC Eights!SSC Eights!SSC Eights!SSC Eights!SSC Eights!SSC Eights!

Group: General Forum Members
Last Login: Wednesday, April 16, 2014 8:46 AM
Points: 845, Visits: 2,331
Mauve (11/14/2013)
I assign all of my SQL Server logins to the tempdb as the default database. NEVER master. This way no harm can be done by an application that just connects to the server without specifying a database name as part of the connection string. Ideally, I'd like to see an option of "none".


All users except sysadmins get tempdb as a default - anything they add there gets cleaned up next patch/reboot cycle, regardless.

Sysadmins get master, in case tempdb isn't available for some reason (tempdb volume failure, and so on).
Post #1514317
Posted Thursday, November 14, 2013 9:19 AM


Mr or Mrs. 500

Mr or Mrs. 500Mr or Mrs. 500Mr or Mrs. 500Mr or Mrs. 500Mr or Mrs. 500Mr or Mrs. 500Mr or Mrs. 500Mr or Mrs. 500

Group: General Forum Members
Last Login: Thursday, April 03, 2014 11:02 AM
Points: 506, Visits: 837
Mauve (11/14/2013)
I assign all of my SQL Server logins to the tempdb as the default database. NEVER master. This way no harm can be done by an application that just connects to the server without specifying a database name as part of the connection string. Ideally, I'd like to see an option of "none".


I second this, I really wish that we could set this as a default so when someone creates a new user it would be already entered.



Over 11yrs in IT and 9yrs happily stuck with SQL.

http://aseniuk.wordpress.com
- SQL 2008/R2/2012
- Oracle 8/9/10
- MySQL 4/5
Post #1514349
Posted Thursday, November 14, 2013 10:08 AM
SSCertifiable

SSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiable

Group: Moderators
Last Login: Friday, April 18, 2014 9:01 AM
Points: 6,705, Visits: 1,680
I like the idea of defaulting to tempdb. I've always used master, agree with not using any real db as a default.

Andy
SQLAndy - My Blog!
Connect with me on LinkedIn
Follow me on Twitter
Post #1514375
Posted Thursday, November 14, 2013 12:54 PM
Valued Member

Valued MemberValued MemberValued MemberValued MemberValued MemberValued MemberValued MemberValued Member

Group: General Forum Members
Last Login: Wednesday, March 19, 2014 5:07 PM
Points: 64, Visits: 87
Did you try with sqlcmd?
Post #1514455
« Prev Topic | Next Topic »

Add to briefcase 12»»

Permissions Expand / Collapse