Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 Transact-SQL (2000)
 Can't shrink TempDb Database

Author  Topic 

mdelgado
Posting Yak Master

141 Posts

Posted - 2002-12-06 : 10:40:56
I've been having trouble trying to shrink the Temp-DB database. Current size shows 1363.0 mb and space used shows 1.0 mb. I've tried all combinations of the following 2 commands with no luck.

backup log TEMPDB WITH TRUNCATE_ONLY
use [TEMPDB] DBCC SHRINKFILE (N'TEMPDB_2',TRUNCATEONLY)

can anyone help me please?

thanks.

izaltsman
A custom title

1139 Posts

Posted - 2002-12-06 : 15:41:59
Backup Log command is not required in your case, 'cause tempdb always truncates its log on checkpoint (but even though the active portion of the log is truncated, the size of the physical file doesn't decrease automatically).

You are on the right track with DBCC SHRINKFILE command though. You simply need to make sure that
a) you are shrinking the right file (perhaps it's not the TEMPDB_2 that needs to be shrunk -- run sp_helpdb 'tempdb' to look at the filesizes and determine which files take up more space than you like)
b) you don't use TRUNCATEONLY option
c) if you are looking at your DB size via EM, you refresh your view after you shrink your files.



Go to Top of Page

monkeybite
Posting Yak Master

152 Posts

Posted - 2002-12-06 : 16:09:17
tempdb is recreated when you start SQL services. Can you stop your SQL service, rename the tempdb files, then restart?

-- monkey

Go to Top of Page

mdelgado
Posting Yak Master

141 Posts

Posted - 2002-12-06 : 16:10:17
I wound up creating a new file on another drive and migratin the contents to the new file. After doing that, the filesize went back down to 1 mb...

Go to Top of Page
   

- Advertisement -