Home » Computers » Enterprise Computing » Reduce SQL Log and TempDB File Sizes

Reduce SQL Log and TempDB File Sizes

Shrink the TempDB:
use tempdb
go
-- this command shrinks the primary data file
dbcc shrinkfile (tempdev, 'target size in MB')
go
-- this command shrinks the log file, look at the last paragraph.
dbcc shrinkfile (templog, 'target size in MB')
go

Shrink Log File:
DBCC SHRINKFILE ('Test_log',TRUNCATEONLY)
BACKUP LOG "Test DB Name" WITH TRUNCATE_ONLY