RESTORE...

  • Is there any difference between RESTORE DATABASE and RESTORE LOG?

    Actually let me rephrase that!!

    If I specify a transaction log file I can use both commands, is there any difference in what occurs?

    D

    'Only he who wanders finds new paths'

  • A database backup consists of all the committed pages of the database and enough of the log roll forward or roll back active transactions at the time of the backup. A log backup consists of all the committed transactions currently in the log and any active transactions that are needed to roll forward or roll back the log.

    So, a restore of database moves all those data pages and then, if you're doing it WITH RECOVERY (the default) it rolls forward or rolls back the logs. But, if you do it WITH NO_RECOVERY, it completes any transactions (roll forward) and then stops. You can then apply a log restore which will walk through all it's transactions committing them to the data pages that were already restored by the database restore operation as defined by the transactions in question.

    So, yeah, they're a little different. To a degree you can think of a database restore as both a data and a log restore (again, to a degree) while a log restore is just a log restore.

    "The credit belongs to the man who is actually in the arena, whose face is marred by dust and sweat and blood"
    - Theodore Roosevelt

    Author of:
    SQL Server Execution Plans
    SQL Server Query Performance Tuning

  • Outstanding answer sir thank you very much, clears that up!

    D

    'Only he who wanders finds new paths'

Viewing 3 posts - 1 through 2 (of 2 total)

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