Search

Friday, September 2, 2011

Shrink tempdb


There are several ways to Shrink TempDB:


Method 1:
Restart SQL Server, it will create new empty TempdB.


Method 2:
DBCC FREEPROCCACHE
GO
USE [tempdb]
GO
DBCC SHRINKFILE (N’tempdb’ , 5000)
GO


Method 3:
Run the following Transact-SQL commands:
ALTER DATABASE tempdb MODIFY FILE (NAME = 'tempdev', SIZE = target_size_in_MB) 
--Desired target size for the data file
ALTER DATABASE tempdb MODIFY FILE (NAME = 'templog', SIZE = target_size_in_MB) 
--Desired target size for the log file

No comments:

Post a Comment