TempDB Full ProblemsSolutions

RESOLUTION OF TEMPDB PROBLEM #1

The tempdb is used for creating temporary tables or storing temporary information. For example, a temporary table in a stored procedure or sql statement may create a temporary work table as a result of a query with a ‘group by’ or ‘order by’ clause.

PROBLEM

My SQL Server
(6.5) had Tempdb set to 400 MB and a Tempdb Log set to 100 MB. It also had
devices of similar sizes. For my requirements this was a lot of wasted
space.  Therefore, I decided to shrink Tempdb using two methods of which
only one worked.

METHOD 1 SOLUTION

1.  Set
the database to ‘single user’ mode.

2.  Execute the dbcc shrinkdb command
or click the shrink db button. This produced the following message:

"Attempt
to set ‘tempdb’ database to single user mode failed because the usage count is
three. Make sure that no other users are currently using the database."

I then
executed the ‘sp_who active’ command which indicated that the usage count was
three because of internal sql server processes running. These internal processes
were Mirror Handler, Lazy Writer, Checkpoint Sleep, etc. These processes can not
be killed.   (I was not able to kill them).  Therefore, I
performed Method 2.

METHOD 2 SOLUTION

1.  Put a
modest size Tempdb into RAM (sp_configure ‘temp’, 10).

2.  Stop/Start the Server.

3.  Drop the devices that were being
used for Tempdb.

4.  Make sure Master is the default device.


5.  Remove Tempdb out of RAM (sp_configure ‘temp’, 0).


6.  Stop/Start the Server. And boooom! Tempdb
was placed on the Master device with a more reasonable size of 2 MB (default).

Get the Free Newsletter!

Subscribe to Cloud Insider for top news, trends & analysis

Latest Articles