Re: massive log file

From: Hugo Kornelis (hugo_at_pe_NO_rFact.in_SPAM_fo)
Date: 02/25/05


Date: Sat, 26 Feb 2005 00:15:40 +0100

On Fri, 25 Feb 2005 14:01:35 -0800, grumy wrote:

>the transaction log on a 10Mb database has shot up to 1G!,
>how can I reduce this and prevent this happening in the
>future.................

Hi grumy,

It depends on whether you need point-in-time recovery or not.

If you need it:
* To reduce it, backup the log, then use DBCC SHRINKFILE to shrink it.
* To prevent it from happening again, schedule regular log backups.

If you don't need it:
* To reduce it, run "BACKUP LOG databasename WITH TRUNCATE_ONLY", then
use DBCC SHRINKFILE to shrink it.
* To prevent it from happening again, change the recovery model of your
database from "Full" or "Bulk-Logged" to "Simple".

If it still happens again, check for vary long-running transactions or
for transactions that insert, update and/or delete large numbers of
rows. Reduce the running time of the former and try to split the latter
in seperate transactions that each affect only a subset of the rows
(i.e. 100 transactions to delete 10,000 rows instead of one transaction
to delete 1,000,000 rows).

Best, Hugo

-- 
(Remove _NO_ and _SPAM_ to get my e-mail address)


Relevant Pages

  • Re: sqlmaint Question
    ... Actually i'm not looking for it to shrink the file but actually clear the ... transactions that have been backed up. ... fixed at 60MB and 8.9MB was used, after the backup there was still 8.9MB used. ... > DBCC ShrinkFile ...
    (microsoft.public.sqlserver.server)
  • Re: transaction log backup & file size
    ... of 'system transactions' (only guessing, ... Need smaller SQL2K backup files? ... > alter database BBH set single_user with rollback immediate ... > /*that one breakes log sequence as I understand, ...
    (microsoft.public.sqlserver.server)
  • Re: does this backup sequence commit all data to the database
    ... the data was committed when the application transactions were ...  That could be an explicit COMMIT when an explicit BEGIN ... recovery mode there is no reason to backup the log. ... I understand that "backup log testdb to disk = '...'" will backup the ...
    (comp.databases.ms-sqlserver)
  • Re: Log Reader Last Action
    ... Second question - did you set up your database with the sync with backup ... Do this in your publication and distribution databases ... Your transactions are not getting replication until you dump your ...
    (microsoft.public.sqlserver.replication)
  • Re: Merge Replication of large database
    ... Backup the transaction log and then issue a shrink. ... Also issue a dbcc opentran to see if there are any open transactions. ... Looking for a SQL Server replication book? ...
    (microsoft.public.sqlserver.replication)