shrink transaction log?

  • I know to shrink and backup a transaction log, its

    something like a three step process truncate, shrink, truncate could someone help me here?

  • Depending on the database recovery mode. If it is 'simple', you can backup log with truncate_only and dbcc shrinkfile. If database is in 'Full Recovery' mode, you should backup the log then shrink the log file.

    Which version of SQL Server do you run?

  • i thought you had to enter in a certain order repeating one action twice.

  • got it....

    DBCC SHRINKFILE(<DatabaseName>, 1)

    BACKUP LOG <DatabaseName> WITH TRUNCATE_ONLY

    DBCC SHRINKFILE(<DatabaseLogName>, 1)

  • Hi,

    Last Sunday I shrinked a transaction log from 15GB to 1GB. I did the following:

    1. Backup of transaction log

    2. Ran DBCC Shrinkdatabase with TRUNCATEONLY option

    You can find useful help in online help for the following topics: 1. Shrinking the transaction log. 2. DBCC Shrinkdatabase

    Hope this helps.

    Charles L. Nichols


    Charles L. Nichols

  • My DB is in full recovery mode. For some reason(say after optimizing) the trans log file grows too large, there is no romm to do transaction log backup, so I did the followings:

    1. dbcc shrinkdatabase(DBname, truncateonly).

    2. Change recovery mode to single.

    3. dbcc shrinkfile(logfile name)

    4. Change recovery mode back to full.

    5. do complete database backup.

    In this way shall I loss any data or transaction? Thanks!

    Robert

  • although this is not the correct sequence to do this, if the db is not corrupted you 'are fine. There is 'No data loss'.

Viewing 7 posts - 1 through 6 (of 6 total)

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