SQLCMDを使用することでコマンドプロンプトからSQL文を発行できます。 今回はスクリプトファイルに記述したSQL文をバッチファイルから実行し その結果をテキストファイルに出力します。 インストール SQLCMDはSQLServerをインストールすれば使用できます。 単体で使用する場合はMicrosoftのサイトからFeature Packをダウンロードします。 この場合、環境変数にPATHが通っていないので設定します。 スクリプトファイル Query.sql
システムが突然遅くなる、特定の機能が突然遅くなった、いつまでたっても実行中のクエリが完了しない、などのトラブルの原因調査をリアルタイムで行うのに使えるクエリと、それらを組み合わせてトラブルシュートする一例を紹介します。 動的管理ビュー(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
リリース、障害情報などのサービスのお知らせ
最新の人気エントリーの配信
処理を実行中です
j次のブックマーク
k前のブックマーク
lあとで読む
eコメント一覧を開く
oページを開く