Re: Clear/Purge Log files

From: Dan Guzman (danguzman_at_nospam-earthlink.net)
Date: 05/19/04


Date: Tue, 18 May 2004 20:02:56 -0500

The way you manage your log file is driven by your database recovery plan.
If your recovery plan is to restore from your last full backup and not apply
transaction log backups, then change your database recovery model to SIMPLE.
This will keep your log size reasonable by removing committed transactions
from the log. The log will still need to be large enough to accommodate
your largest single transaction. If you want to reduce potential data loss,
you should use the BULK_LOGGED or FULL recovery model and backup your log
periodically.

The proper way to shrink files is with DBCC SHRINKFILE. See the Books
Online for details. You should not need to do this as part of routine
maintenance.

-- 
Hope this helps.
Dan Guzman
SQL Server MVP
"Carlos" <wt_know@hotmail.com> wrote in message
news:OueiitTPEHA.620@TK2MSFTNGP10.phx.gbl...
> The MDF file is 800 MB but the LDF file is 5 GB. I run the "shrink
database"
> but this does not seems to reduce the mdf or ldf filesize.
>
> What I did is detach the database, delete the ldf file, re-attach the
> database to create a new ldf file. If I do not do so, the application
cannot
> work (hang!) because the ldf file is too huge and it takes ages to commit
a
> transaction. Is there a "better" way to control the ldf file like
> auto-purging ? Should I restrict the log file size to a specific filesize
> like 500MB ? Does this mean it will auto-purge each time it reach 500MB
for
> the ldf file ?
>
> Thanks
>
>
>


Relevant Pages

  • Re: .LDF files and SharePoint Portal
    ... So when you take a backup of the database, ... I have some questions about .LDF files and Sharepoint. ... Is it safe to delete the data in the .LDF file or will it cause ...
    (microsoft.public.sharepoint.portalserver)
  • Re: What is LOP_SHRINK_NOOP
    ... The ldf file is about 100Mb after months and never grows large. ... I add nightly backup to the system using DBCC backup. ... you need to have every transaction log backup since the last FULL Backup in order to successfully recover the database. ...
    (comp.databases.ms-sqlserver)
  • Re: Crash Recovery
    ... You can't apply an LDF file to a restored database backup. ... >> How to restore the BAK file. ...
    (microsoft.public.sqlserver.server)
  • Flat File Backup Failed *suddenly*
    ... DB: SQL Server 2000 SP3a ... I have a database maintenanec plan set up to do full database backup (i.e. ... I have a DB which has a 3.8GB LDF file which backup with no problems!) ...
    (microsoft.public.sqlserver.server)
  • Flat File Backup Failed *suddenly*
    ... DB: SQL Server 2000 SP3a ... I have a database maintenanec plan set up to do full database backup (i.e. ... I have a DB which has a 3.8GB LDF file which backup with no problems!) ...
    (microsoft.public.sqlserver.server)