To shrink tempdb

Many times we try to shrink Tempdb due to space issue, but even after more than 90% space free it doesn't shrink

for this recently I got a script from my friend Alpesh , who is also a SQL Developer
Here is the script for it


USE TempDB
GO
DBCC FREEPROCCACHE
GO
DBCC DROPCLEANBUFFERS
go
DBCC FREESYSTEMCACHE ('ALL')
GO
DBCC FREESESSIONCACHE
GO
dbcc shrinkfile (, SizeInMB)
GO

No comments:

Post a Comment

Popular Posts