Solved

TembDB is Full

Posted on 2013-11-15
4
269 Views
Last Modified: 2013-12-03
Hi -

I am trying to run some rather extensive DB cleanup scripts to create an instance where a developer put a default constraint of 0 on a field that needed to be null and the FK'd to another table.   I have written a query that removes the constraint and then sets every row of the column in question to null if it is zero.   We are dealing with 3449702 rows of data.

I am getting this error:

Msg 1105, Level 17, State 2, Line 1
Could not allocate space for object 'dbo.SORT temporary run storage:  140742971555840' in database 'tempdb' because the 'PRIMARY' filegroup is full. Create disk space by deleting unneeded files, dropping objects in the filegroup, adding additional files to the filegroup, or setting autogrowth on for existing files in the filegroup.
Msg 9002, Level 17, State 4, Line 1
The transaction log for database 'tempdb' is full. To find out why space in the log cannot be reused, see the log_reuse_wait_desc column in sys.databases

Any way around this?
0
Comment
Question by:ccleebelt
4 Comments
 
LVL 34

Expert Comment

by:Brian Crowe
Comment Utility
Is the volume your log file resides on full or have you placed limits on the size of your log files?
0
 
LVL 11

Accepted Solution

by:
John_Vidmar earned 500 total points
Comment Utility
Increase log size and/or perform the update in smaller chunks outside of a transaction (assumes implicit commits):
-- close all transactions
while(@@trancount > 0) commit

-- add a rowcount limit 
set rowcount 30000

while(1=1) begin

    update sometable
    set    somefield = NULL
    where  somefield = 0

    if @@rowcount <> 30000 break

end

-- remove rowcount limit 
set rowcount 0

Open in new window

0
 
LVL 3

Expert Comment

by:Sagir87
Comment Utility
Hi,

Please refer this link for this error
Msg 1105, Level 17, State 2, Line 1:

http://technet.microsoft.com/en-us/library/ms176029(v=sql.105).aspx

For shrinking tempdb files:

http://support.microsoft.com/kb/307487

For this error Msg 9002, Level 17, State 4, Line 1 :

http://technet.microsoft.com/en-us/library/ms175495.aspx
0
 

Author Comment

by:ccleebelt
Comment Utility
Another way of solving the problem.  Is there a more efficient way to mass update large sets of data and not create bloat in the tempdb?
0

Featured Post

Free Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

In this article I will describe the Copy Database Wizard method as one possible migration process and I will add the extra tasks needed for an upgrade when and where is applied so it will cover all.
This article explains how to reset the password of the sa account on a Microsoft SQL Server.  The steps in this article work in SQL 2005, 2008, 2008 R2, 2012, 2014 and 2016.
This video shows how to set up a shell script to accept a positional parameter when called, pass that to a SQL script, accept the output from the statement back and then manipulate it in the Shell.
Viewers will learn how to use the SELECT statement in SQL and will be exposed to the many uses the SELECT statement has.

771 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now