2016-12-14

Plancache löschen

Löschen eines Abfrageplans im Plancache

USE AdventureWorks2008R2;

GO
 
 
SELECT * FROM Person.Address;

GO
 
 
SELECT plan_handle, st.text

FROM sys.dm_exec_cached_plans

CROSS APPLY sys.dm_exec_sql_text(plan_handle) AS st

WHERE text LIKE N'SELECT * FROM Person.Address%';

GO
  
Dies ist das Resultset.
plan_handle                                         text
--------------------------------------------------  -----------------------------
0x060006001ECA270EC0215D05000000000000000000000000 SELECT * FROM Person.Address;
(1 Zeile(n) betroffen)
 
 

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

GO

 
Löschen aller Pläne im Plancache
SELECT * FROM sys.dm_resource_governor_resource_pools;

GO
 
 
 
DBCC FREEPROCCACHE ('default');
GO

No comments:

Post a Comment