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
Enterprise Manager
SQL-DMO
To view the current server activity
Transact-SQL
Enterprise Manager
SQL-DMO
To view the last command batch for a connection
Transact-SQL
Enterprise Manager
SQL-DMO
To view the data space information for a database
Transact-SQL
Enterprise Manager
SQL-DMO
To view the log space information for a database
Transact-SQL
Enterprise Manager
SQL-DMO
To view the oldest active transaction in the database
Transact-SQL
To view performance information
Transact-SQL
To view procedure cache usage
Transact-SQL
To view general statistics about SQL Server activity and usage
Transact-SQL
See Also
Monitoring with SQL Server Enterprise Manager
Monitoring with System Monitor