Can I delete a large LDF file in SharePoint?

10,255

Solution 1

LDF files are the transaction log files for SQL server. I would not delete it directly, but rather..

1. Right click WSS_Content and choose Tasks -> Backup
2. Select backtup type "Transaction log", select destination backup file and click Ok.
3. After backing up the DB, right click WSS_Content and choose Tasks -> Shrink -> Files
4. Select the type log and shrink action (eg release unused space)

If you don't need the transaction log, you can alter your database to use a 'Simple' rather than 'Full' recovery model, which will not keep these large files around. MSDN Link

FAIR WARNING: Always have a backup of your database/data/settings before you start mucking with it.

Solution 2

No, you shouldn't move or delete it (you will be unable to do so anyway if sql server is running) doing so can corrupt your database and leave it in an inconsistent state.

This is the transaction log file for your SharePoint database. It has grown to this size because:

  1. Database is in full recovery and you've run at least one full backup
  2. You're in simple recovery and you're database has been under heavy load with many open transactions and you transaction file has 'auto grown' to this size.

The solution for #1 is that you need to start doing regular log backups, or change your recovery model to simple

The solution for #2 is that you shrink the log if you really need the space, otherwise let it be.

EDIT: If you have space capacity on another drive then you can do a detach/attach moving the log file to another drive to avoid having to re-build the disk to a larger size. It's best practice to have your log files on different disks to your data files anyhow. Ensure you do the detach/attach logged in as sa (i.e. don't use integrated authentication)

Share:
10,255

Related videos on Youtube

Rich
Author by

Rich

Updated on September 17, 2022

Comments

  • Rich
    Rich almost 2 years

    I've got a LDF file within my SQL 2005 path for SharePoint. It's 5.8 GB in size. Can I move it or delete it without killing my SharePoint data??

  • Rich
    Rich almost 15 years
    Since I've done a complete backup of the Farm could I rebuild the RAID to consume the entire HDD space (currently a partition of 12 GB which is the SharePoint/OS and another one of 220 GB) and then do a restore?
  • vonbrand
    vonbrand over 11 years
    Don't just suggest removing files! And please, don't heed such advise without your own investigation into the matter.