I have pretty much automated all of the data feeds that feed our DW. Due to the nature of the way we designed things, our tempdb (data file) fills up during the course of the week. Once it fills up the drive space, all jobs (including DW jobs) start to fail. To circumvent this problem, I had created another job that runs twice a day and has the following code:
USE [tempdb]
GO
DBCC SHRINKFILE (N'tempdev' , 5)
GO
Now, even this code runs fine most of the time until temdb (data file) fills up at which point the above job starts to fail. The only way to reclaim tempdb (data file) space is to restart SQL server and run the above code either manually or via Management Studio. Here is an error message that the job generated before we had to shutdown SQL Server and fix the problem:
Message
Executed as user: CCC\svc-sql. Could not cleanup worktable IAM chains to allow shrink or remove file operation. Please try again when tempdb is idle. [SQLSTATE 42000] (Error 5054) Could not cleanup worktable IAM chains to allow shrink or remove
file operation. Please try again when tempdb is idle. [SQLSTATE 42000] (Error 5054). The step failed.
My quesion is, Isn't there a way to periodically clean up tempdb as opposed to restarting SQL Server?? TIA
Jagannathan Santhanam