HOW TO FIX A SQL LOCK
You CAN USE THE BELOW QUERY IN SQL SERVER TO CHECK WHICH TRANSACTIONS ARE GETTING LOCKED
BOTH THE BELOW QUERY WILL GIVE OUTPUT OF THE BLOCKED RECORDS.
OR ELSE YOU CAN JUST CLICK AT THE ROOT OF THE DATABSE AND SELECT ACTIVITY MONITOR WHIHC WILL SHOW THE LOCKED RECORDS/BLOCKED BY USER1.
USE Master
GO
EXEC sp_who2
GO
USE [master] GO SELECT session_id, blocking_session_id, wait_time, wait_type, last_wait_type, wait_resource, transaction_isolati, on_level, lock_timeout FROM sys.dm_exec_requests WHERE blocking_session_id <> 0 GO
AFTER GETTIN THE RESULTS YOU CAN EITHER FIX THE LOCK BY RUNNING /PROCESSING REQUIRED STEPS OR YOU CAN JUST KILL THE PROCESS BY THE BELOW SCRIPT
To terminate the blocking session, ID 54 in this case, use the KILL command
KILL 54
GO
thanks,
Vikas Mehta.
No comments:
Post a Comment