Monitoring with Transact-SQL Statements

Administering SQL Server

Administering SQL Server

Monitoring with Transact-SQL Statements

Microsoft® SQL Server™ provides several Transact-SQL statements and system stored procedures that allow ad hoc monitoring of an instance of SQL Server. Use these statements when you want to gather, at a glance, information about server performance and activity. For example:

  • Current locks.

  • Current user activity.

  • Last command batch submitted by a user.

  • Data space used by a table or database.

  • Space used by a transaction log.

  • Oldest active transaction (including replicated transactions) in the database.

  • Performance information relating to I/O, memory, and network throughput.

  • Procedure cache usage.

  • General statistics about SQL Server activity and usage, such as the amount of time the CPU has been performing SQL Server operations or the amount of time SQL Server has spent performing I/O operations.

Most of this information can also be monitored using SQL Server Enterprise Manager, SQL-DMO, or System Monitor (Performance Monitor in Microsoft Windows NT® 4.0).

To view the current locks

Transact-SQL