x

Purging MOSS DB, auditdata table in SQL

Hi, There is MOSS database (ContentDB) which contains auditdata table of 150GB size and one million rows. This table has a column with datatype ntext. A delete command is fired from sharepoint side (stsadm command) which deletes data from table for one day. When delete is happening, log file grows to 240GB and finally fails as we dont have any more space for log file to grow. It seems sharepoint tables should not be deleted directly from SQL side. I tried changing recovery mode to bulk logged but no help as delete is not a minimally logged operation. Also truncate log doesnot work as whole delete is one huge transaction.

Why deleting just one day's data creating 240+GB of log?Is there anyway to handle this?

Thanks
more ▼

asked Nov 11 '10 at 06:31 PM in Default

Sonali gravatar image

Sonali
11 1 1 1

(comments are locked)
10|1200 characters needed characters left

1 answer: sort voted first

If you delete data from a table and DB is in Full recovery or bulk mode, then every deleted record is logged to a transaction log. If you need to delete large amount of data and don't have enought log space, you have several possibilities.

  1. Delete data in batches and backup log between batches
  2. Try backup the log before deleting and if there is still not enought space, add some space to log.
  3. If you want to delete all the data, then switch to bulk logged and truncate table
4. Switch to simple mode and delete data. Then go back to full recovery mode.
more ▼

answered Nov 11 '10 at 10:47 PM

Pavel Pawlowski gravatar image

Pavel Pawlowski
22.2k 8 11 21

(comments are locked)
10|1200 characters needed characters left
Your answer
toggle preview:

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

New code box

There's a new way to format code on the site - the red speech bubble logo will automatically format T-SQL for you. The original code box is still there for XML, etc. More details here.

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

SQL Server Central

Need long-form SQL discussion? SQLserverCentral.com is the place.

Topics:

x51

asked: Nov 11 '10 at 06:31 PM

Seen: 1352 times

Last Updated: Nov 11 '10 at 06:31 PM