alter system flush shared_pool;
alter system flush buffer_cache;
SHOW STATUS LIKE 'Qcache%';
RESET QUERY CACHE;
SHOW STATUS LIKE 'open_tables';
flush tables;
方法はない模様
use master
go
DBCC FREESYSTEMCACHE ('ALL');
DBCC FREESESSIONCACHE;
--プランキャッシュのクリア
DBCC FREEPROCCACHE;
--特定ハンドルのプランキャッシュのクリア
--Identify the plan handle
SELECT cp.plan_handle, st.[text],*
FROM sys.dm_exec_cached_plans AS cp
CROSS APPLY sys.dm_exec_sql_text(plan_handle) AS st
WHERE text like '%tab1%'
GO
--Clean up the plan for TEST procedure
DBCC FREEPROCCACHE(0x06000700BAAAA61580B824240100000001000000000000000000000000000000000000000000000000000000)
GO
--バッファプールのクリア
DBCC DROPCLEANBUFFERS
--データベースのプランキャッシュのクリア
Select dbid,db_name(dbid),count(1) From sys.dm_exec_cached_plans dec
CROSS APPLY sys.dm_exec_sql_text(dec.plan_handle) AS des
where db_name(dbid) in ('AdventureWorks2012') --Sample Databases for the demonstration
Group by db_name(dbid), dbid
DBCC FLUSHPROCINDB (7) -- 7 is the databaseid of AdventureWorks2012
GO