Solved

default db no more- how to recover

Posted on 2011-03-01
6
886 Views
Last Modified: 2012-05-11
is this query good to find which logins have default database that is no more
select * from master..syslogins where dbname not in (select name from sysdatabases)

how do you recover from situations like these?
0
Comment
Question by:anushahanna
6 Comments
 
LVL 3

Expert Comment

by:mordi
ID: 35010406
Hi,
It is not clear what happened.
If you have any backup of the missing database so after restore all the users get restored also.
0
 
LVL 6

Author Comment

by:anushahanna
ID: 35010434
but that is login info, won't be in database.
0
 
LVL 39

Accepted Solution

by:
BrandonGalderisi earned 167 total points
ID: 35010520
I've written a write up on how to recover from a situation where you can't login due to a missing default database.

http://www.sqlservernation.com/home/fix-for-cannot-open-user-default-database-login-failed.html
0
Control application downtime with dependency maps

Visualize the interdependencies between application components better with Applications Manager's automated application discovery and dependency mapping feature. Resolve performance issues faster by quickly isolating problematic components.

 
LVL 39

Assisted Solution

by:lcohan
lcohan earned 167 total points
ID: 35011546
Yes that should do it as the default db is stored in syslogins.dbname - from http://msdn.microsoft.com/en-us/library/ms178593.aspx

"dbname
 sysname
 Name of the default database of the user when a connection is established."
 
--slightly updated
select name,dbname from master..syslogins where dbname not in (select name from master..sysdatabases)
0
 
LVL 13

Assisted Solution

by:geek_vj
geek_vj earned 166 total points
ID: 35024541
>>is this query good to find which logins have default database that is no more
select * from master..syslogins where dbname not in (select name from sysdatabases)

Yes, the query is fine

>>how do you recover from situations like these?
In that case, you have to login using another user and change the default database of the login which is having issue.
0
 
LVL 6

Author Comment

by:anushahanna
ID: 35041735
thanks for your helpful input.
0

Featured Post

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

When you hear the word proxy, you may become apprehensive. This article will help you to understand Proxy and when it is useful. Let's talk Proxy for SQL Server. (Not in terms of Internet access.) Typically, you'll run into this type of problem w…
I have a large data set and a SSIS package. How can I load this file in multi threading?
Using examples as well as descriptions, and references to Books Online, show the different Recovery Models available in SQL Server and explain, as well as show how full, differential and transaction log backups are performed
This videos aims to give the viewer a basic demonstration of how a user can query current session information by using the SYS_CONTEXT function

930 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now