Shrink Log

  • Hi Experts,

    Am not able to shrink the log files of a database the log file size is 15gb .I tried dbcc shrinkfile but no use and before that i took a full backup

    Please help in solve this issue.

    TIA

  • Instead of taking full backup, take log file backup and try to shrink it. 99.99% of times you would be able to shrink log file after taking log file backup.

    SQL DBA.

  • If not search for "forcibly shrink" here for a script that can help.

    you should rarely shrink anything. Usually this is because something hasn't been done correctly in the past or you had a one-time event. Do not use shrink on a regular basis. You should have space allocated (data and log) to handle events for the daily load (log) and the next months (data).

  • Have you changed the database recovery option to simple before shrinking the database. After shrinking, revert the recovery mode to Normal.

  • If your database is set up for replication, transactions marked as not replicated can prevent the log from being shrunk. You may need the run the sp_repldone stored procedure to mark any such transaaction as having been replicated before shrinking the log. This may have been the cause of your log growing unbounded in the first place.

  • I tried the dbcc shrinkfile after taking a log backup but still the log file is not shrinking ...Is there any option to truncate log???

  • You might try:

    dump transaction with no_log

  • Sorry, that should be:

    dump transaction databasename with no_log

  • Hi,

    try to run

    backup log log_logical_name with truncate_only

    before running the shrink command.

    It normally works for me,

    regards,

    SG

  • To be more exact:

    backup log DATABASE_NAME with truncate_only

    dbcc shrinkfile ([DATABASE_LOG_NAME],2)

    where "2" is the desireded size of the log file after shrinking.

    Please keep in mind, however, that (quoting SQLBill at http://qa.sqlservercentral.com/Forums/Topic266619-5-1.aspx)

    "If you use truncate (with DBCC SHRINKFILE or with BACKUP LOG dbname WITH TRUNCATE_ONLY), you 'break' the backup chain and must start a new chain. That means that you must do a Full backup after you issue the truncate command. Truncate means that log and any after it cannot be applied to the FULL backup done before the truncate.

    I have used truncate at times.....but I always do a full backup right after it."

    Regards,

    SG

  • dump log with no_log or backup log,you can try it

Viewing 11 posts - 1 through 10 (of 10 total)

You must be logged in to reply to this topic. Login to reply