Consultor Eletrônico



Kbase P4878: Who has resources locked within Microsoft SQL Server Database
Autor   Progress Software Corporation - Progress
Acesso   Público
Publicação   1/22/2007
Status: Verified

GOAL:

Who has resources locked within Microsoft SQL Server Database

GOAL:

How to determine who has resources in use within Microsoft SQL Server Database?

GOAL:

What are "sp_lock" and "sp_who" stored procedures?

FIX:

Bring up SQL query analyzer from Start->Programs->MS SQL Server->SQL Query Analyzer, and type "sp_lock" and "sp_who" commands.

I. sp_lock, reports information about locks.
Following are some 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

II. sp_who provides information about current Microsoft® SQL Server? users and
processes

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