システムが突然遅くなる、特定の機能が突然遅くなった、いつまでたっても実行中のクエリが完了しない、などのトラブルの原因調査をリアルタイムで行うのに使えるクエリと、それらを組み合わせてトラブルシュートする一例を紹介します。 動的管理ビュー(DMV)を使用します。 1. 現在実行中のクエリ一覧を取得する SELECT TOP 100 der.session_id as spid ,der.blocking_session_id as blk_spid ,datediff(s, der.start_time, GETDATE()) as elapsed_sec ,DB_NAME(der.database_id) AS db_name ,des.host_name ,des.program_name ,der.status -- Status of the request. (background