Tuesday, January 24, 2017

Remove specific plan for procedure or query from the cache in SQL Server



--Find the plan handle by providing the procedure name
SELECT plan_handle, st.text ,*
FROM sys.dm_exec_cached_plans  
CROSS APPLY sys.dm_exec_sql_text(plan_handle) AS st 
WHERE
objtype = 'Proc'
and text LIKE N'%zz_%'; 

-- Remove the specific plan from the cache. 
DBCC FREEPROCCACHE (0x05000600D1D5E903F057B85B0400000001000000000000000000000000000000000000000000000000000000); 


No comments:

Post a Comment