471,119 Members | 1,326 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,119 software developers and data experts.

MS SQL connection could not be established

John Almeda
System Adm

It seems that I have done something really stupid or something went
boonkers. I was restoring a DB whn I got a message that the log file
could not be restored because it was XXXXXX????. This left my DB greyed
out and with a (loading) sign. I tried to detach and then re-attech the
DB and all hell broke loose. Now I cannot connect to any of my DB's. The
message I get is "a connection could not be established on sqlsrvr .
Cannot open users default db. Login failed."

I cannot see any of db under that regitration and the connection
continues to fail. I am drawing a total blank as to why and how to
correct with the exception of unistalling MSSQL and re-installing the
server and then trying to establish a connection with my db's again.

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Jul 23 '05 #1
1 3812
You can connect and change your default database to master using osql:

osql -S MyServer -E -d master -Q"exec sp_defaultdb 'MyLogin', 'master'"

That should allow you to connect to the server as usual, and then you
can try restoring your database again - if you still have problems at
that point, it would be useful to see the exact error message.


Jul 23 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

2 posts views Thread by Dennis | last post: by
6 posts views Thread by Bjoern Schliessmann | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.