Solved

TembDB is Full

Posted on 2013-11-15
4
277 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

SharePoint Admin?

Enable Your Employees To Focus On The Core With Intuitive Onscreen Guidance That is With You At The Moment of Need.

Question has a verified solution.

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

Suggested Solutions

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.
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.
Via a live example, show how to setup several different housekeeping processes for a SQL Server.
Viewers will learn how to use the SELECT statement in SQL to return specific rows and columns, with various degrees of sorting and limits in place.

740 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