4060: Cannot open database requested by the login. The login failed
SQL ServerWhat does it mean?
Authentication may succeed, but the connection is rejected because the requested database cannot be opened. Usually seen together with 18456.
Why does it happen?
The database does not exist, is OFFLINE/SINGLE_USER/RESTORING/SUSPECT, the login has no user mapping in that database, or the default database in the connection string is inaccessible.
How to fix it
Verify that the database exists and is ONLINE: SELECT name, state_desc FROM sys.databases. Create a user for the login in the database and grant permissions. Check the Initial Catalog/Database value in the connection string. If the database is RESTORING/SUSPECT, follow the repair/restore steps.
More from this engine
- 1105Could not allocate space for object in database because the filegroup is full
- 208Invalid object name
- 229The SELECT/EXECUTE permission was denied on the object
- 233A connection was successfully established with the server, but then an error occurred (no process is on the other end of the pipe)
- 823The operating system returned error to SQL Server during a read/write at offset in file (I/O error)
- 824SQL Server detected a logical consistency-based I/O error (page corruption)
- 701There is insufficient system memory in resource pool to run this query