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 2005 Forums
 SQL Server Administration (2005)
 reduce the tempdb.mdb size automcatically

Author  Topic 

celine
Starting Member

2 Posts

Posted - 2010-04-30 : 11:42:02
Dear All,

Urgently can anybody help me how to reduce the tempdb size automatically in sql server 2005.

Thanks for your kind support

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2010-04-30 : 12:32:38
You can use DBCC SHRINKFILE, but you should not do it "automatically". It should only be done manually.

Tara Kizer
Microsoft MVP for Windows Server System - SQL Server
http://weblogs.sqlteam.com/tarad/

Subscribe to my blog
Go to Top of Page

Peter99
Constraint Violating Yak Guru

498 Posts

Posted - 2010-04-30 : 12:55:59
one options is set autoshrink database property, but that may affect performance
Go to Top of Page

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2010-04-30 : 12:57:50
Do not set autoshrink! This is a very bad idea and should not be done on any production database.

There is a reason why the file grew to that size. If you are tight on disk space, then fix that issue not tempdb.

Tara Kizer
Microsoft MVP for Windows Server System - SQL Server
http://weblogs.sqlteam.com/tarad/

Subscribe to my blog
Go to Top of Page

Kristen
Test

22859 Posts

Posted - 2010-04-30 : 13:11:13
My advice is do NOT shrink TEMPDB, no buts!

Shrinking TEMPDB whilst there are any data changes runs the risk of corrupting data ... so, in practice, you have to start SQL Service in Single User to shrink TEMPDB ... and realistically that is not an automatable task.

And notwithstanding that just restarting SQL Service should, in normal circumstance and unless something has gone badly wrong, rebuild TEMPDB to its initial size etc.

So ... scheduling a stop/start of SQL Service would effectively shrink it (assuming it isn't damaged, as per above, and if it is you will have to perform some one-time surgery to fix it anyway!)
Go to Top of Page

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2010-04-30 : 13:40:24
Make sure that tempdb's initial size is reasonable. We use one data file per CPU with each at an initial size of 1GB. On some systems, we have 16 CPUs, so we have an initial size of 16GB total. And while I'm at it, make sure that the growth increment is reasonable such as 200MB.

Tara Kizer
Microsoft MVP for Windows Server System - SQL Server
http://weblogs.sqlteam.com/tarad/

Subscribe to my blog
Go to Top of Page
   

- Advertisement -