对目前的数据库的运行状况有一个基本的了解
SELECT TOP ( 10 ) DB_NAME(a.dbid) AS dbname , loginame , spid , cpu , b.text , lastwaittype , waitresource , a.[status] , hostname AS WebServer , [program_name] AS AppName , [cmd] , ‘cpu‘ AS Type --into #cpu FROM master..sysprocesses AS a CROSS APPLY sys.dm_exec_sql_text(sql_handle) AS b INNER JOIN master..sysdatabases AS c ON a.dbid = c.dbid AND a.status <> ‘sleeping‘ --and a.blocked>0 ORDER BY cpu DESC
查询目前运行状态-CPU等情况
时间: 2024-10-10 05:06:36