none
SQL Server error - Cannot Open User Default Database error 4064

    Question

  • Any idea on this?

    user is part of active directory and has windows authentication and still getting error....any thoughts?

    master is default db..

    thanks


    Please Mark As Answer if it is helpful. \\Aim To Inspire Rather to Teach A.Shah


    Tuesday, March 12, 2013 2:13 PM

Answers

  •  

    Cannot open user default database , login failed

    login failed for use'XXX\YYY' ( Microsoft SQL Server Error:4064)

    when i checked error log : error was showing me : sql error 18456 severity 14 state 16

    sorry not able to post screen shot.

    seems like something related to AD group but not sure.


    Please Mark As Answer if it is helpful. \\Aim To Inspire Rather to Teach A.Shah

    Ok .. so the state 16 means that-- the user does not have permissions to log into the database --- and this might be due to various reasons ..:

    a. the database is offline or in single user mode

    b. The login/group does not have access to the database.


    HTH, \\K [Kindly mark the reply as answer if it helps - Support SQLServer Family :-)]

    Tuesday, March 12, 2013 7:08 PM

All replies

  • deleted the user that was the owner of the db? use the sp_changeowner

    or

    user is mapped to use an non-existing db. remove that mapping.

    ...

    difficult to say with so little information. what do the logs say?

    Tuesday, March 12, 2013 2:57 PM
  • Frol SQL Log : sql error 18456 severity 14 state 16

    Use is part of Active dirctory group and that group has windows authentication ..hope this hleps

    Thanks though


    Please Mark As Answer if it is helpful. \\Aim To Inspire Rather to Teach A.Shah

    Tuesday, March 12, 2013 3:10 PM
  • Hi Ankit

    Please check Cannot open user default database

    Go to options in connect window , Change default database name and then connect


    Thanks
    Saurabh Sinha
    http://saurabhsinhainblogs.blogspot.in/
    Please click the Mark as answer button and vote as helpful if this reply solves your problem


    Tuesday, March 12, 2013 3:23 PM
  • Hi saurabh

     tried it that option but not working still. but thanks for help


    Please Mark As Answer if it is helpful. \\Aim To Inspire Rather to Teach A.Shah

    Tuesday, March 12, 2013 3:28 PM
  • The default database can also be passed in the connection string.    The error message does not log which database it is actually trying to connect too.

    Tuesday, March 12, 2013 3:33 PM
  • Any idea on this?

    user is part of active directory and has windows authentication and still getting error....any thoughts?

    master is default db..

    thanks


    Please Mark As Answer if it is helpful. \\Aim To Inspire Rather to Teach A.Shah


    Does the user have proper rights to the database ? if db was restored recently --- then check for orphan users

    Can you post the exact error message or a screenshot ?


    HTH, \\K [Kindly mark the reply as answer if it helps - Support SQLServer Family :-)]

    Tuesday, March 12, 2013 5:03 PM
  •  

    Cannot open user default database , login failed

    login failed for use'XXX\YYY' ( Microsoft SQL Server Error:4064)

    when i checked error log : error was showing me : sql error 18456 severity 14 state 16

    sorry not able to post screen shot.

    seems like something related to AD group but not sure.


    Please Mark As Answer if it is helpful. \\Aim To Inspire Rather to Teach A.Shah

    Tuesday, March 12, 2013 6:09 PM
  •  

    Cannot open user default database , login failed

    login failed for use'XXX\YYY' ( Microsoft SQL Server Error:4064)

    when i checked error log : error was showing me : sql error 18456 severity 14 state 16

    sorry not able to post screen shot.

    seems like something related to AD group but not sure.


    Please Mark As Answer if it is helpful. \\Aim To Inspire Rather to Teach A.Shah

    Ok .. so the state 16 means that-- the user does not have permissions to log into the database --- and this might be due to various reasons ..:

    a. the database is offline or in single user mode

    b. The login/group does not have access to the database.


    HTH, \\K [Kindly mark the reply as answer if it helps - Support SQLServer Family :-)]

    Tuesday, March 12, 2013 7:08 PM
  • Default DB Master which is online ...checked with System admin team and their group have required access and that person's login is also in that group.

    so when that person click on option page for SQL Server login page and manually type other db name rather then master  he is able get into that server  and able to do required work.

    But not through Master DB .

    so what could be wrong with default DB setting? 


    Please Mark As Answer if it is helpful. \\Aim To Inspire Rather to Teach A.Shah

    Wednesday, March 13, 2013 2:57 PM
  • Default DB Master which is online ...checked with System admin team and their group have required access and that person's login is also in that group.

    so when that person click on option page for SQL Server login page and manually type other db name rather then master  he is able get into that server  and able to do required work.

    But not through Master DB .

    so what could be wrong with default DB setting? 


    Please Mark As Answer if it is helpful. \\Aim To Inspire Rather to Teach A.Shah

    What does this return ... can you check if the login has proper mapping :

    SELECT name as LoginName, default_database_name FROM sys.server_principals
    where default_database_name is not NULL


    HTH, \\K [Kindly mark the reply as answer if it helps - Support SQLServer Family :-)]

    Wednesday, March 13, 2013 3:02 PM
  • Default  Database is master.

    Please Mark As Answer if it is helpful. \\Aim To Inspire Rather to Teach A.Shah

    Wednesday, March 13, 2013 6:09 PM
  • Again, the "default" database referenced by this error is the "Default Catalog" database passed in the connection string, not the one defined in the login on the server.

    You must look at the connection string and determine what it is passing as the default database.   Whatever that is, they do not have access too.


    Wednesday, March 13, 2013 8:07 PM