Solved

TembDB is Full

Posted on 2013-11-15
4
274 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
ID: 39652308
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
ID: 39653459
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
ID: 39655486
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
ID: 39661253
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

Ransomware: The New Cyber Threat & How to Stop It

This infographic explains ransomware, type of malware that blocks access to your files or your systems and holds them hostage until a ransom is paid. It also examines the different types of ransomware and explains what you can do to thwart this sinister online threat.  

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

If you have heard of RFC822 date formats, they can be quite a challenge in SQL Server. RFC822 is an Internet standard format for email message headers, including all dates within those headers. The RFC822 protocols are available in detail at:   ht…
International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
Using examples as well as descriptions, and references to Books Online, show the documentation available for datatypes, explain the available data types and show how data can be passed into and out of variables.
Viewers will learn how to use the INSERT statement to insert data into their tables. It will also introduce the NULL statement, to show them what happens when no value is giving for any given column.

832 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