[MSSQL]執行計劃


--清除資料庫執行計劃cache

use 資料庫

alter database scoped configuration clear procedure_cache


--查詢執行計劃cache

select cap.usecounts as '使用次數'

      ,cap.cacheobjtype as '快取類型'

  ,objtype as '物件類型'

  ,st.text

from sys.dm_exec_cached_plans cap

CROSS APPLY sys.dm_exec_sql_text(plan_handle) as st

where st.text not like '%sys%'

  and st.text like '%myparatest%'

go 



留言

這個網誌中的熱門文章

ORA-12514: TNS: 監聽器目前不知道連線描述區中要求的服務

Oracle 例外控制(Exception Control)

Oracle 工作排程 DBMS_JOB 筆記