DataBase/SQL Server
SP 쿼리 실행 이력 조회 쿼리
탑~!
2026. 4. 30. 09:53
SELECT Db_name(st.dbid) DBName,
Object_schema_name(objectid, st.dbid) SchemaName,
Object_name(objectid, st.dbid) SPName,
qs.total_elapsed_time,
creation_time,
last_execution_time,
text
FROM sys.dm_exec_query_stats qs
CROSS apply sys.Dm_exec_sql_text(qs.plan_handle)st
JOIN sys.dm_exec_cached_plans cp
ON qs.plan_handle = cp.plan_handle
728x90
반응형