检查SQL SERVER数据库的使用情况
1 SELECT '进程ID' = Str(A.Spid, 4), 2 '进程ID状态' = CONVERT(VARCHAR(100), A.Status), 3 '阻塞进程的进程ID' = Str(A.Blocked, 2), 4 '工作站名称' = CONVERT(VARCHAR(100), A.Hostname), 5 '执行命令的用户' = CONVERT(VARCHAR(100), A.loginame), 6 '数据库名' = CONVERT(VARCHAR(100), Db_name(A.Dbid)), 7 '应用程序名' = CONVERT(VARCHAR(100), A.Program_Name), 8 '正在执行的命令' = CONVERT(VARCHAR(100), A.Cmd), 9 '累计CPU时间' = Str(A.Cpu, 7), 10 'IO' = Str(A.Physical_Io, 7), 11 '登录名' = A.Loginame, 12 '登录时间' = A.login_time, 13 '执行语句'=B.Text 14 FROM Master..Sysprocesses A 15 CROSS Apply Sys.Dm_exec_sql_text(A.Sql_Handle) B 16 WHERE Spid IN (SELECT TOP 10 spid 17 FROM Master..Sysprocesses 18 ORDER BY physical_io DESC) 19 ORDER BY login_time