您的位置:首页 > 数据库

How to shrink the tempdb database in SQL Server

2014-01-20 14:12 831 查看
官方文档
http://support.microsoft.com/kb/307487
很多时候会发现,shrink DB后,数据文件的大小没有变化。甚至在shrink前显示文件的availabl free space非常大,shrink也不起什么作用。原因是:

It's
more a function of how SQL Server relies more and more on TempDB in each release. When something's active in TempDB, you can't move its data around, and each new version of SQL Server works more in TempDB. For example, when you enable Read Committed Snapshot
Isolation, the version store it uses lives in TempDB. When you use AlwaysOn Availability Groups, it tracks user database statistics in TempDB too. This is just another reason why you set aside a logical volume for TempDB, size the data files to fill it up,
and then walk away - your work here is done, and don't try to shrink those files.

这里有其他非常规的方法来shrink
tempDB,大致就是删除tempDB存储的一些catch文件。但是在production应该严禁使用,因为这些命令会严重影响数据库的性能。例如,

DBCC
DROPCLEANBUFFERS

DBCC FREEPROCCACHE

但是DBA可以根据实际情况在其他非production使用。具体是方法
http://sqlsunday.com/2013/08/11/shrinking-tempdb-without-restarting-sql-server/
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: 
相关文章推荐