Solved

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

Posted on 2014-04-01
4
3,014 Views
Last Modified: 2014-04-04
Trying to delete 300 million records from a table that has 500 million records.
After 2 hours I get the following

Any ideas?  thx

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
0
Comment
Question by:JElster
4 Comments
 
LVL 52

Assisted Solution

by:Carl Tawn
Carl Tawn earned 250 total points
Comment Utility
I imagine you have simply run out of space in the tempdb log file. You'll have to check how big the log file is and either allow it more space (if disk capacity allows), or switch to deleting in batches, rather than attempting to delete the whole 300 million rows in one go.

Also, if you run the following statement, it should confirm what the issue is:
select log_reuse_wait_desc from sys.databases where database_id = db_id('tempdb')

Open in new window

0
 
LVL 69

Accepted Solution

by:
ScottPletcher earned 250 total points
Comment Utility
>> Trying to delete 300 million records from a table that has 500 million records. <<

Is that table in tempdb or another db?

If it's in another db, I suspect that snapshot isolation of some type is on for that table, causing SQL to have to keep versions of the deleted rows in tempdb.


Deleting 300M rows all in one shot is not normally a good idea anyway -- way too large for a single transaction, esp. if heaven-forbid that sucker needs to roll back.

If at all possible, try deleting in batches, say 100K at a time.  Add a 1/3 or 1/2 second delay (WAITFOR DELAY) between batches if you can afford the time.
0
 
LVL 1

Author Comment

by:JElster
Comment Utility
Another db
0
 
LVL 75

Expert Comment

by:Anthony Perkins
Comment Utility
In addition to the comments about doing this in batches (I would recommend not larger than 500K rows) I would also make sure that you are doing frequent Transaction Log backups if the Recovery Model for this database is Full.
0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

This article will describe one method to parse a delimited string into a table of data.   Why would I do that you ask?  Let's say that you need to pass multiple parameters into a stored procedure to search for.  For our sake, we'll say that we wa…
Recently, when I was asked to create a new SQL 2005 cluster, Microsoft released a new service pack for MS SQL 2005 what is Service Pack 3. When I finished the installation of MS SQL 2005 I found myself troubled why the installation of SP3 failed …
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.

728 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

15 Experts available now in Live!

Get 1:1 Help Now