Restored database with focus on log size

colbycolby Posts: 30
edited October 21, 2008 12:52PM in SQL Backup Previous Versions
Moving a database to another server can be more easily be done with Red Gate than attach detach methods when network is slow because the compression is so large and my copy time to the other server is so long.

My question is the restoring of the database and the associated log. Sometimes the logs are larger than the database and sometimes the logs are small. How can you minimze the size of the restored log?

For example,

Before the backup, should I truncate the log and then RedGate backup and now the restored log will be as small as possible. After restored, now start transactional backing up of log.

Or After backup and restore, truncate the log and then start hourly backing up of the log.

Thanks

Colby

Comments

  • Eddie DEddie D Posts: 1,805 Rose Gold 5
    Thank you for your post into the forum.

    I am little confused by your post but I believe I understand what you are seeking to achieve.

    Performing a Transaction Log backup will truncate the transaction log providing you have not selected the NO_TRUNCATE option. This action alone does not reduce the phyiscal size of the Transaction Log file.

    After truncating the transaction log, you need to perform a Shrink Database or Shrink File command to reduce the phyiscal size of transaction log, using DBCC SHRINK DATABASE or SHRINK FILE commands. The following SQL Server Books On-Line contain further advice on the DBCC SHRINK commands:

    SHRINK DATABASE

    SHRINK FILE

    If you wish to use SQL Backup to backup the database and restore to a different server, follow these steps.

    1. Use SQL Backup to backup the Transaction Log of the database.
    2. Use DBCC SHRINK FILE to reduce the phyiscal size of the Transation Log.
    3. Perform a Full Backup of the database using SQL Backup.
    4. Perform a Log backup of the database using the NO_TRUNCATE option.

    On the new Server

    5. Restore the Full backup taken in step 3, using the WITH NORECOVERY argument.
    6. Restore the log backup taken in step 4, using the WITH RECOVERY argument.

    Otherwise perform steps 1 and 2 in the above procedure and use the detach/attach method to move database or use the the copy database wizard via SSMS.

    Hope this answers your question.

    Many Thanks
    Eddie
    Eddie Davis
    Senior Product Support Engineer
    Redgate Software Ltd
    Email: support@red-gate.com
Sign In or Register to comment.