Database Journal
MS SQL Oracle DB2 Access MySQL PostgreSQL Sybase PHP SQL Etc SQL Scripts & Samples Links Database Forum

» Database Journal Home
» Database Articles
» Database Tutorials
MS Access
Database Tools
SQL Scripts & Samples
» Database Forum
» Slideshows
» Sitemap
Free Newsletters:
News Via RSS Feed

follow us on Twitter
Database Journal |DBA Support |SQLCourse |SQLCourse2

Featured Database Articles

SQL Scripts & Samples

Posted Oct 18, 2004

Check Database Activity Script

By Staff

This SQL script from Richard Ding checks the current database activity in SQL server by using a cursor to loop through the db name list into which table joins pull out rows from sysprocesses and syslockinfo. The result of table names currently being used as well as the type of locks set on them are then displayed. The script differs with sp_who or sp_who2 in that it shows what object and lock the spid is accessing. It is useful in monitoring processes such as DBCC DBREINDEX. Running this script constantly will disclose a dynamic pattern of a certain process to better understand what it is doing.

It has been tested on SQL 7 and 2000.

Download the Script

SQL Scripts & Samples Archives

Comment and Contribute


(Maximum characters: 1200). You have characters left.



Latest Forum Threads
SQL Scripts & Samples Forum
Topic By Replies Updated
sql help!! add 1 August 22nd, 11:58 AM
How To Combine These 2 Queries into 1 Query ? tarek_land 1 June 7th, 08:37 AM
solving query svibuk 1 February 3rd, 06:08 AM
converting from a character string to uniqueidentifier saturnius 4 January 4th, 05:56 AM