1204: The instance of the SQL Server Database Engine cannot obtain a LOCK resource (SQL Server Database Engine 인스턴스가 LOCK 리소스를 확보할 수 없음)
SQL Server의미
SQL Server가 락 관리자에 필요한 메모리를 할당할 수 없어 더 이상 락을 생성할 수 없다. 락 메모리 풀이 고갈되어 작업이 실패한다.
원인
동시에 너무 많은 세분화된(행/페이지) 락 보유: 인덱스 없는 대규모 또는 대량 DML, lock escalation 방지, 서버의 전반적인 메모리 압박, 장시간 열린 트랜잭션이 원인이다. 가끔 외부 메모리 압박이 트리거가 된다.
해결 방법
대규모 작업을 작은 배치로 나눠 동시 락 수를 줄인다. 적절한 인덱스를 사용해 스캔/락이 걸리는 행 수를 줄인다. lock escalation을 비활성화하는 구성을 검토한다: trace flag 1211/1224 및 ALTER TABLE ... SET (LOCK_ESCALATION = DISABLE); SELECT name, lock_escalation_desc FROM sys.tables; 와 DBCC TRACESTATUS(-1);로 확인한다. 서버 메모리와 max server memory 설정을 확인하고 메모리 압박을 완화한다.
같은 데이터베이스의 다른 항목
- 40613Database is not currently available (Azure SQL) (데이터베이스를 현재 사용할 수 없음)
- 102Incorrect syntax near 'token'
- 8114Error converting data type X to Y
- 3906Failed to update database because the database is read-only (데이터베이스가 읽기 전용이어서 갱신 실패)
- 15023User already exists in the current database (현재 데이터베이스에 사용자가 이미 존재)
- 18452Login failed. The login is from an untrusted domain and cannot be used with Windows authentication (로그인 실패. 신뢰할 수 없는 도메인의 로그인은 Windows 인증에 사용할 수 없음)
- 605Attempt to fetch logical page belongs to a different allocation unit (가져오려는 논리 페이지가 다른 allocation unit에 속함)