Can't open EM or QA after deleting default db

  • Tidying up, I deleted a couple of user dbs in EM. When I then tried to get back into EM I got the error message:

    "A connection could not be established to SERVERNAME - Cannot open user default database '<ID>'. Using master database instead..

    Please verify SQL Server is running and check your SQL Server registration properties (by right-clicking on the SERVERNAME node) and try again."

    And when I try and open QA I get:

    "Unable to connect to server \\SERVERNAME:

    Server: Msg 4062, Level 16, State 1

    [Microsoft][ODBC SQL Server Driver][SQL Server]Cannot open user default database '<ID>'. Using master database instead."

    I found MS KB article 307864. As it suggested, I tried "C:\>isql -E", and then at the prompt "sp_defaultdb 'Administrator', 'master'" and at the second prompt "go". However, it fails with the message:

    "Msg 15007, Level 16, State 1, Server SERVERNAME, Procedure sp_defaultdb, Line 39 The login 'Administrator' does not exist."

    I get the same error message if I try setting the default to a user database.

    According to BOL, the login can be an existing Microsoft® SQL Server™ login or a Microsoft Windows NT® user or group. If the Windows NT user or group does not exist in SQL Server, it is automatically added - but Administrator does exist!

    I don't understand where I'm going wrong. I'm logged onto the NT box as Administrator as I always do. SQL Server is using Windows Authentication. When I opened EM or QA before this problem both would open without entering a username or password.

    I'm running SQL Server 7 SP4 on NT4 SP6a.

    Thanks,

    Barry

  • Every login (SQL or Windows) has a default database property. When the connection is made to SQL Server, the login is verified via sysxlogins, and then taken to the default database. If that db has been deleted, you will start seeing the error messages that you are getting. You must change the default database property of your administrator login to a database that exists.

  • I have tried to change the default database of Administrator but as I mentioned I get an error message.

  • Are you sure there's a separate login for Administrator ? In most cases the administrator account get's acccess through the BUILT-IN\Admins group. So you might have to change the default database for this group.

    [font="Verdana"]Markus Bohse[/font]

  • Thanks Markus, that got me on the right track. When using sp_defaultdb I had to use the domainname, e.g.:

    sp_defaultdb 'DOMAINNAME\Administrator','master'

Viewing 5 posts - 1 through 4 (of 4 total)

You must be logged in to reply to this topic. Login to reply