Cannot open database requested by the login. The login failed. SQL Server Error 4060

Leave a comment (0) Go to comments

CAUSE : This problem occurs because login that you used to access database does not have sufficient permissions.

Cannot open database requested by the login. The login failed. SQL Server Error 4060 SQL Error

SOLUTION :

You need to grant permission to the user to access database and/or to execute stored procedure.

How to grant reader/writer access to SQL database:

    1. Log on to SQL Server Management Studio by going Start >> All Programs >> Microsoft SQL Server>>> SQL Management Studio. and suppl user credentials & click OK.
    2. In Object Explorer, expand Secuirty, expand Logins, for which you are getting the Error and then expand Security.  Make sure the Login exists else add that user by right click and add and then Cannot open database requested by the login. The login failed. SQL Server Error 4060 SQL Error
    3. Right-click Login, and then click Properties for the USER NAME / LOGIN NAME for which you are getting the Error “Cannot open database requested by the login. The login failed”, SQL Server Error 4060
    4. In newly opened screen of Login Properties, go to the “User Mapping” tab. Then, on the “User Mapping” tab, select the desired database – especially the database for which this error message is displayed. On the lower screen, check the role db_owner. Click OK. Cannot open database requested by the login. The login failed. SQL Server Error 4060 SQL Error

This should fix this error but consider this security recommendation


Recommendation: – Assigning a a DBO privileges to NETWORK SERVICE is security violation as mostly all security standard. Change the application / Service startup account to to dedicated Service account and then give these privileges to dedicated service / application account.

The Similar error has different interfaces. for example, In SQL Server 2012, this get the following Error Message, when you try to access a database, where user don’t have permission for specified database.

Cannot open database requested by the login. The login failed. SQL Server Error 4060 SQL Error

The database CRM is not accessible. (ObjectExplorer)

OR this error, when you access the same from Query Window

Cannot open database requested by the login. The login failed. SQL Server Error 4060 SQL Error

Msg 916, Level 14, State 1, Line 1
The server principal “hyperion” is not able to access the database “CRM” under the current security context.

OR when you try to access from front End / Application

Cannot open database requested by the login. The login failed. Login failed for user ‘NT AUTHORITY\NETWORK SERVICE’

The same solution applies to all these errors.

EOF - Cannot open database requested by the login. The login failed. SQL Server Error 4060, SQL Server 2012 , 2008 R2 , 2008 , 2005 , 2000

Leave a Reply

Your email address will not be published. Required fields are marked *


*


You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

Notify me of followup comments via e-mail. You can also subscribe without commenting.