Tuesday, June 11, 2013

Cannot Open User Default Database (error 4064) - SQL database lock out recovery

In my haste to recreate a database, I neglected to set my account back to the default master.
Now each time I attempt to login, SQL Server issues error 4064 as it attempts to connect to a
catalog which is not longer there!

Fortunately, Laurentiu Cristofor at http://social.msdn.microsoft.com/forums/en-US/sqlsecurity/thread/b32c862a-799c-43c4-a731-c4811078c8bd/

Had the solution:

C:\> sqlcmd -E -d master
1> ALTER LOGIN [BUILTIN\Administrators] WITH DEFAULT_DATABASE=master
2> GO

No comments:

Post a Comment