标签:
在将tempdb数据库 ndf 文件清空时,遇到错误信息:
USE tempdb GO DBCC SHRINKFILE (N‘tempdb_30‘ , EMPTYFILE)
DBCC SHRINKFILE: Page 26:24 could not be moved because it is a work table page.
Msg 2555, Level 16, State 1, Line 1
Cannot move all contents of file "tempdb_30" to other places to complete the emptyfile operation.
错误原因主要有两个:
1,其他User使用tempdb进行查询
If there are some persisted tables in TempDB and reside on the file you are trying to remove, it will not be able to Shrink or Remove.
查看 tempdb 的Temporary Tables,能够看到当前系统正在使用的临时表
通过sys.objects 也能查询到tempdb的temporary tables
select * from tempdb.sys.objects where type=‘U‘
2,tempdb存在缓存
使用如下脚本清空缓存
USE [tempdb] GO DBCC DROPCLEANBUFFERS GO DBCC FREEPROCCACHE GO DBCC FREESESSIONCACHE GO DBCC FREESYSTEMCACHE ( ‘ALL‘) GO DBCC SHRINKFILE (N‘tempdb_30‘ , EMPTYFILE) GO
参考文档:
标签:
原文地址:http://www.cnblogs.com/ljhdo/p/5667811.html