mssql sqlhandle기반 query plan 확인
DB Skill/MSSQL 2021. 8. 18. 23:24
--{SQL handle} 부분에 값을 입력하여 실행
(방법 1)
SELECT sql_handle AS Handle,
SUBSTRING(st.text, (qs.statement_start_offset/2)+1,
((CASE qs.statement_end_offset
WHEN -1 THEN DATALENGTH(st.text)
ELSE qs.statement_end_offset
END - qs.statement_start_offset)/2) + 1) AS Text
FROM sys.dm_exec_query_stats AS qs
CROSS APPLY sys.dm_exec_sql_text(qs.sql_handle) AS st
WHERE sql_handle = --{SQL Handle}
(방법2)
select * from sys.dm_exec_query_plan({SQL Handle})
select * from sys.dm_exec_query_plan(0x0600030D550343000000000000000)
참고
https://rauofthameem.wordpress.com/2012/09/14/sql-query-that-gets-sql-statement-from-sqlhandle/
'DB Skill > MSSQL' 카테고리의 다른 글
mssql tempdb 물리적 위치 변경 (0) | 2021.08.18 |
---|---|
mssql table identity 확인 및 변경 ( DBCC CHECKIDENT 사용 ) (0) | 2021.08.18 |
MSSQL 사용자 계정에 SQL Server Agent Job 권한 부여 (0) | 2021.08.18 |
mssql 메타 데이터 갱신 (sp_refreshsqlmodule) (0) | 2021.08.18 |
MSSQL에 MySQL Linked Server 등록 (0) | 2021.08.18 |