Restore multiple database backup using T-SQL

  • I want to restore a database from a backup file that contain more than one backup, i.e it has been backed up with append and the same .bak file contain more than one backup set. Is this possible with T-SQL and if so how?

  • FROM BOL:

    RESTORE HEADERONLY

    FROM

    WITH FILE = file_number

    Identifies the backup set to be described. For example, a file_number of 1 indicates the first backup set and a file_number of 2 indicates the second backup set. If not specified, all sets on the device are described.

    RESTORE DATABASE { database_name | @database_name_var }

    [ FROM [ ,...n ] ]

    [ WITH

    [ RESTRICTED_USER ]

    [ [ , ] FILE = { file_number | @file_number } ]

    FILE = { file_number | @file_number }

    Identifies the backup set to be restored. For example, a file_number of 1 indicates the first backup set on the backup medium and a file_number of 2 indicates the second backup set.

    You do the restoreheaderonly to find which file you want to restore.



    ----------------
    Jim P.

    A little bit of this and a little byte of that can cause bloatware.

  • Jim,

    thanks for the quick reply. That seems to work fine.

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

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