Solved

TembDB is Full

Posted on 2013-11-15
4
275 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

U.S. Department of Agriculture and Acronis Access

With the new era of mobile computing, smartphones and tablets, wireless communications and cloud services, the USDA sought to take advantage of a mobilized workforce and the blurring lines between personal and corporate computing resources.

Question has a verified solution.

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

In this article we will get to know that how can we recover deleted data if it happens accidently. We really can recover deleted rows if we know the time when data is deleted by using the transaction log.
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.
This videos aims to give the viewer a basic demonstration of how a user can query current session information by using the SYS_CONTEXT function
Via a live example, show how to backup a database, simulate a failure backup the tail of the database transaction log and perform the restore.

808 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