Default Database for Login IDs Were Changed | SQL Server Performance Forums

SQL Server Performance Forum – Threads Archive

Default Database for Login IDs Were Changed

Hi All!<br /><br />Here’s the problem:<br />Yesterday, our technical/network admin reported that one of the hard disks on our sql server failed. After office hours, the hard disk was changed but in doing so the databases were detached and re-attached successfully.<br /><br />I found out this morning that SQL Server Login IDs were defaulted to a database where that Login ID does not even have access at all. Thus, whenever a user tried to connect through SQL Query Analyzer, below error message appears:<br /><br />"Unable to connect to server [servername]:<br /><br />Server: Msg 4064, Level 16, State 1<br />[Miscrosoft][ODBC SQL Server Driver][SQL Server]Cannot open user default database. Login failed."<br /><br />As a work-around, I manually changed the user’s default database to the one that they can or have access. Any ideas what could possibly went wrong with this? <br /><br />Thanks,<br />[<img src=’/community/emoticons/emotion-1.gif’ alt=’:)‘ />]Jon M
You’d have to make sure that the database id of the detached database was the same when it was reattached… not that likely if you detach all databases and then attach them all at a later time the login table holds the id of the default database, this is not updated during a detach/attach operation So yes manually resetting the default db is the only way (that I can think of) Cheers
Twan
Take help of this KBAhttp://support.microsoft.com/default.aspx?scid=kb;en-us;Q307864 _________
Satya SKJ
Moderator
SQL-Server-Performance.Com

]]>