Question

The observed problem and error message is:

The instance of the SQL Server Database Engine cannot obtain a LOCK resource at this time. Rerun your statement when there are fewer active users.Ask the database administrator to check the lock and memory configuration for this instance, or to check for long-running transactions

Environment: SQL Server 2005 Standard edition on Windows server 2003 Standard edition. Virtualized on a VM - with 8 GB RAM Automatic applications are processing data - reading raw data and writing results to the database. These applications get the error message and they crash on it. (There are also database backup and index maintenance jobs scheduled.)

The same error was never observed on a similar system with sql server 2005 enterprise edition and windows 2003 enterprise edition.

I have already searched the web and found some answers. But e.g. SQL Server cannot obtain a LOCK resource at this time - What to do? was not helpful in my case

One source suggested to check:

SELECT request_session_id, COUNT (*) num_locks
FROM sys.dm_tran_locks
GROUP BY request_session_id 
ORDER BY count (*) DESC

One session came up with 10.

The memory and lock settings are both in the default settings.

My current idea is to purge most of the data which is old and can be removed.

Does anybody have any other ideas how to deal with the lock resource problem? What exactly is its cause? Does SQL server standard edition allow less resources - is the problem related to the sql server version? How to fix the issue?

Was it helpful?

Solution

The autoshrink function had multiple locks on the database catalog. The autoshrink also fragmented the primary key of a table after rebuilding the primary key.

Switching off the autoshrink function has solved the problem

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top