Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 SQL Server Administration (2000)
 Producing logs on delete

Author  Topic 

bobanjayan
Yak Posting Veteran

67 Posts

Posted - 2004-06-22 : 05:55:53
Hi all,

I have a problem when deleting 3 Cr. rows from a table.
The log files grow to the total disk space.
Database recovery mode is simple.
Why is behaves like this?

I cannot use "truncate" because delete has a "where" clause.
I had made a job and schedule for night. It failed because the transaction log was full.

Any idea?

nr
SQLTeam MVY

12543 Posts

Posted - 2004-06-22 : 06:32:17
The delete is adding entries to the rt log which cnnot be cleared unti it completes.
You need to do the delete in batches. It's better if you can loop through some indexed field but if not something like

set rowcount 10000
select 1
while @@rowcount > 0
delete tble where ....

This will delete in batches and allow the tr log to be truncated.

==========================================
Cursors are useful if you don't know sql.
DTS can be used in a similar way.
Beer is not cold and it isn't fizzy.
Go to Top of Page
   

- Advertisement -