?
Solved

TembDB is Full

Posted on 2013-11-15
4
Medium Priority
?
281 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 2000 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

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

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

For both online and offline retail, the cross-channel business is the most recent pattern in the B2C trade space.
Ever wondered why sometimes your SQL Server is slow or unresponsive with connections spiking up but by the time you go in, all is well? The following article will show you how to install and configure a SQL job that will send you email alerts includ…
This video shows, step by step, how to configure Oracle Heterogeneous Services via the Generic Gateway Agent in order to make a connection from an Oracle session and access a remote SQL Server database table.
Via a live example combined with referencing Books Online, show some of the information that can be extracted from the Catalog Views in SQL Server.
Suggested Courses

800 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