SHARE
Facebook X Pinterest WhatsApp

TempDB Full ProblemsSolutions

Written By
thumbnail
Kevin Goodwyn
Kevin Goodwyn
Jan 25, 2000

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).

Recommended for you...

Best Online Courses to Learn SQL
Ronnie Payne
Sep 23, 2022
Best Courses for Database Administrators
Ronnie Payne
Jul 22, 2022
Tip 74 – Changing Cost Threshold for Parallelism
Gregory Larsen
Feb 24, 2021
How Many Databases Can You Name?
Brad Jones
May 11, 2020
Database Journal Logo

DatabaseJournal.com publishes relevant, up-to-date and pragmatic articles on the use of database hardware and management tools and serves as a forum for professional knowledge about proprietary, open source and cloud-based databases--foundational technology for all IT systems. We publish insightful articles about new products, best practices and trends; readers help each other out on various database questions and problems. Database management systems (DBMS) and database security processes are also key areas of focus at DatabaseJournal.com.

Property of TechnologyAdvice. © 2025 TechnologyAdvice. All Rights Reserved

Advertiser Disclosure: Some of the products that appear on this site are from companies from which TechnologyAdvice receives compensation. This compensation may impact how and where products appear on this site including, for example, the order in which they appear. TechnologyAdvice does not include all companies or all types of products available in the marketplace.