4060: Cannot open database requested by the login. The login failed
SQL Server의미
인증은 성공할 수 있지만 요청한 데이터베이스를 열 수 없어 연결이 거부된다. 보통 18456과 함께 나타난다.
원인
데이터베이스가 존재하지 않거나 OFFLINE/SINGLE_USER/RESTORING/SUSPECT 상태, 해당 데이터베이스에 로그인의 사용자 매핑 없음, 또는 연결 문자열의 기본 데이터베이스에 접근 불가.
해결 방법
데이터베이스가 존재하고 ONLINE인지 확인한다: SELECT name, state_desc FROM sys.databases. 데이터베이스에 로그인용 사용자를 생성하고 권한을 부여한다. 연결 문자열의 Initial Catalog/Database 값을 확인한다. 데이터베이스가 RESTORING/SUSPECT 상태라면 복구/복원 절차를 따른다.
같은 데이터베이스의 다른 항목
- 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