Cannot Open User default database

  • Hi,

    When I attempt to logon using Windows Authentication to a SQL 2000 server i get the message "Cannot Open user default database. Login Failed".

    I understand that I need to change my default database can you please tell me how I do this using osql and windows authentication?.

    The previous DBA has left and I know of no other account that has SA equivalent rights that can be of use.

    Thanks,

  • Typically, the BUILTIN\Administrators group has sysadmin rights unless the DBA has intentionally removed its rights. That corresponds to the local Administrators group for the Windows server. Have you tried logging in as one of the server administrators? Also, the service account for SQL Server also has sysadmin rights. If the service account is not set to the local System account, that's another way in. You may have to reset the password (which would you would need to go into services and modify the login appropriately and stop/restart SQL Server), but that can get you in.

    As far as connecting with osql....

    osql -E -S <server name>

    The -E tells osql to use a trusted (Windows authentication) question. Make sure you're logged in as an account you suspect has sysadmin rights.

    K. Brian Kelley
    @kbriankelley

  • You'll need a login that's a member of sysadmin or securityadmin whether it's a Windows or  SQL Server login.  Do you know the SA password?  If Builtin\administrators hasn't been removed, one of the local server administrators should be able to logon.

    Greg

    Greg

  • Looks like ur login doesnot have access to the default database associated with your account.

    Try this

    sp_grantdbaccess @loginame ='DomainName\UserName',@name_in_db ='UserName'

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

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