Results 1 to 7 of 7
  1. #1
    Join Date
    Aug 2004
    Posts
    2

    Unanswered: Help!!! Can't Connect - db offline

    OK, so I took one of my db's offline for maintenance, then realized that I wanted to be logged in as another user, so I logged out.

    Now SS won't let me log in, because every time I try to connect I get:

    A connection could not be established...
    Reason: Cannot open user default database. Login failed..

    The db I took offline is the default db for every single privileged account on the server. Why do I feel like I just locked my keys in the car?

    Any help would be greatly appreciated! TIA!

  2. #2
    Join Date
    Aug 2004
    Posts
    2

    Solved

    Never mind, I figured it out. Logged in via ISQL, and issued:

    exec sp_defaultdb '<my sa account>', '<a db known to be online>'

    ISQL let me log in, and simply used 'master' instead of the default db that was offline. What reason in the world could there be for EM behaving differently?

  3. #3
    Join Date
    Jul 2003
    Location
    San Antonio, TX
    Posts
    3,662
    In the future you should set master to be the default database for all users.
    "The data in a record depends on the Key to the record, the Whole Key, and
    nothing but the Key, so help me Codd."

  4. #4
    Join Date
    Apr 2004
    Location
    Kansas City, MO
    Posts
    734
    Why? I only do this for the admin group.
    MeanOldDBA
    derrickleggett@hotmail.com
    When life gives you a lemon, fire the DBA.

  5. #5
    Join Date
    Jul 2003
    Location
    The Dark Planet
    Posts
    1,401
    Quote Originally Posted by rdjabarov
    In the future you should set master to be the default database for all users.
    Why in the world would you want to do that for application users ???
    Get yourself a copy of the The Holy Book

    order has no physical Brett in The meaning of a Kaiser . -database data

  6. #6
    Join Date
    Jan 2003
    Location
    Massachusetts
    Posts
    5,800
    Provided Answers: 11
    Enterprise manager is a good tool to start learning about SQL Server with, but as you get to more and more advanced things, it helps more to use Query Analyzer, or if you are super-hard-core isql or osql. However, in this case, I am not certain how you did get around this. This may take a bit of experimentation for me to figure out. I had thought that any login is sent to the default database, even if just fr a moment, when you have the -d switch set in isql, or a database name set in your connection string. I could very well be wrong.

    But essentially, yes. If you drop the database that all of the admin users have as their default database, then you have effectively "locked the keys in the server".

  7. #7
    Join Date
    Nov 2002
    Location
    Jersey
    Posts
    10,322
    Quote Originally Posted by rdjabarov
    In the future you should set master to be the default database for all users.

    He's just drunk....

    and I'm jealous....
    Brett
    8-)

    It's a Great Day for America everybody!

    dbforums Yak CorralRadio 'Rita
    dbForums Member List
    I'm Good Once as I ever was

    The physical order of data in a database has no meaning.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •