本文共 620 字,大约阅读时间需要 2 分钟。
plan cache非常大。将仅仅使用一次的缓存计划清除,而不用清除整个cache.declare @sid varbinary(64)declare cur01 cursor forselect plan_handle from (SELECT plan_handle FROM sys.dm_exec_cached_plans AS cp CROSS APPLY sys.dm_exec_sql_text(cp.plan_handle) stWHERE cp.cacheobjtype = N'Compiled Plan'AND cp.objtype IN (N'Adhoc', N'Prepared')AND cp.usecounts =1 and text like 'select%') copen cur01fetch next from cur01 into @sidwhile @@fetch_status=0beginDBCC FREEPROCCACHE(@sid)fetch next from cur01 into @sidendclose cur01deallocate cur01go
版权声明:本文博客原创文章。博客,未经同意,不得转载。
本文转自mfrbuaa博客园博客,原文链接:http://www.cnblogs.com/mfrbuaa/p/4713077.html,如需转载请自行联系原作者