Home » SQL Server Error : 1222, Severity: 16. Lock request time out period exceeded.

SQL Server Error : 1222, Severity: 16. Lock request time out period exceeded.

sql server DBA 999

SQL Server Error : 1222 Details


SQL Server Error: 1222
Severity: 16
Event Logged or not: No
Description:
Lock request time out period exceeded.
Severity 16 Description:
Indicates general errors that can be corrected by the user.

 

What is MS SQL server error 1222?

The error occurs as a result of a longer query running wait time than lock timeout settings. The lock timeout indicates the time spent waiting for a backend resource to be available.

Reading sql server error log location from SQL Query

Identifying SQL Server Error Log File used by SQL Server Database Engine can be done by reading SQL Server Error Logs. DBA can execute the XP_READERRORLOG extended stored procedure to read the SQL Server Error Log and search for its location used by the instance of SQL Server.

USE master
Go
xp_readerrorlog 0, 1, N'Logging SQL Server messages in file', NULL, NULL, N'asc'
Go

https://sqlserver-dba.co.uk/error-log/sql-server-identify-location-of-the-sql-server-error-log-file.html

Solution for Resolving the Error

The Error 1222 is caused by a transaction holding a lock on the target resource for a longer time than the query can wait.

The error message might appear in a variety of circumstances.
Example 1: A transaction with a BEGIN TRAN but no ROLLBACK or COMMIT is executing. It’s possible that the transaction is locking the system tables.
Identifying the active transaction data is the quickest way to solve the problem.

To find out more about an active transaction, run the following command in SQL Server Management Studio

  1. DBCC opentran()
  2. Using Activity Monitor to look at active transactions
  3. using sp_who2 to check who has active transactions

When viewing trees, tables, or methods in object explorer in Microsoft SQL Server Management Studio, you get an error. When a query waits longer than the lock timeout settings, this error occurs. The lock timeout is measured in milliseconds and indicates how long it will take for a backend resource to become available (the default lock timeout is -1). After waiting for more than 10ms, a query usually fails with the lock request time out period error.

Check for any sessions that are currently established in the database with blocking, excessive CPU utilization, high I/O usage, or multiple entries for the same SPID using sp who2. Your lock time outs will be caused by them, and you will need to troubleshoot them.

Alternate Solutions

  1. Restarting SQL Server Service(non production instances only), only if nothing else is working….

  • To Restart, Start or Stop the SQL Server instance by right click on sql server instance in SSMS or in SQL. You may need to open SSMS as administrator to start, stop the instance.

db-mail4

  • Other ways for restarting SQL server Service

  1. From SQL Configuration manager from Start menu
  2. From Services in Windows server
  3. From Cmd using net start and net stop

Different Ways to Open up Activity Monitor in SQL Server 2008 are mentioned below:

Open up Activity Monitor Using Object Explorer

In Object Explorer, right click the SQL Server 2008 Instance and click on Activity Monitor.

Also can be opened from SQL Server 2008 Management Studio’s toolbar, by clicking Activity Monitor

Opening SQL Server Activity Monitor method2

SSMS Activity Monitor by Method2

It shows the graphical display of Processor Time (%), Number of Waiting Tasks, Database I/O (MB/Sec) and the Number of Batch Requests/second.

For information on SQL Server Activity monitor go to https://sqlserver-dba.co.uk/sql-server-administration-basics/activity-monitor

Or using SQL Query analyzer window to run sp_who2 command which is less resource intensive and gives same information as activity monitor.

SQL Server Error Code and solution summary


SQL Server Error: 1222
Severity: 16
Event Logged or not: No
Description:
Lock request time out period exceeded.

Check for active transactions by using activity monitor or sp_who2 or dbcc opentran()

Leave a Reply

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