Consultor Eletrônico



Kbase 22098: How To Find Who Has Resources Locked in SQL Server
Autor   Progress Software Corporation - Progress
Acesso   Público
Publicação   7/12/2002
SUMMARY:

When a DataServer user session crashes, the user may have some resources locked. When another user attempts to update a record, they often get error 2624. This Solution documents a tool you can use to find out who has what resources locked.

SOLUTION:

Bring up SQL query analyzer, and run sp_lock and sp_who commands.

-- The sp_lock command reports information about locks. Here are two examples:

A) List all locks
This example displays information about all locks currently held in SQL Server.

USE master
EXEC sp_lock

B) List a lock from a single-server process
This example displays information, including locks, on process ID 53.

USE master
EXEC sp_lock 53

-- The sp_who command provides information about current Microsoft® SQL Server? users and processes. Here are some examples:

A) List all current processes
This example uses sp_who without parameters to report all current users.

USE master
EXEC sp_who

B) List a specific user's process
This example shows how to view information about a single current user by login name.

USE master
EXEC sp_who 'janetl'

C) Display all active processes

USE master
EXEC sp_who 'active'

D) Display a specific process with process ID

USE master
EXEC sp_who '10' --specifies the process_id


References to Written Documentation:

Microsoft SQL Server help