1 SELECT SYS.DM_EXEC_REQUESTS.SESSION_ID,TEXT AS '执行SQL',CLIENT_NET_ADDRESS AS '请求IP',SYS.DM_EXEC_CONNECTIONS.CONNECTION_ID AS '连接ID',LAST_READ AS '最后读取时间',LAST_WRITE AS '最后写入时间',CLIENT_TCP_PORT AS '客户端端口',CPU_TIME AS 'CPU时间',BLOCKING_SESSION_ID AS '加锁ID' 2 FROM SYS.DM_EXEC_REQUESTS CROSS APPLY SYS.DM_EXEC_SQL_TEXT(SQL_HANDLE) 3 LEFT JOIN SYS.DM_TRAN_LOCKS ON SYS.DM_EXEC_REQUESTS.SESSION_ID=SYS.DM_TRAN_LOCKS.REQUEST_SESSION_ID 4 LEFT JOIN SYS.DM_EXEC_CONNECTIONS ON SYS.DM_EXEC_CONNECTIONS.SESSION_ID=SYS.DM_EXEC_REQUESTS.SESSION_ID 5 WHERE RESOURCE_TYPE='OBJECT' 6 ORDER BY CPU_TIME DESC