Thursday, November 8, 2012

SQL Server Cannot open user default database Login Failed

As a Lync support person you might need to handle some SQL issues. Most of the cases you want to move database here and there because of the disk space issue or for proper allocation of disk. Here i faced a challenge while doing LCSLOG database movement from one disk to another Disk.

I have detached the database and copy the database in another disk after that i was not able to login to SQL management studio. I was getting "Cannot open user default database.Login Failed error".

I thought my SQL got corrupted ,After lot of search i got the solution like below.

Open SQL Managemnet Studio
Select options tab

Now change the connect to database to master or any available database on your setup

 
Now click on connect and it will successfully log you in. Once you login in the system run following statement for your username and it should fix your problem. Make sure to replace [test] with your username and master with yourdatabase name.

ALTER LOGIN [username] WITH DEFAULT_DATABASE = master
GO

 

 

No comments:

Post a Comment