Results 1 to 3 of 3
  1. #1
    Join Date
    Jul 2003
    Posts
    4

    Angry Unanswered: Restore from Appended Backup

    I have created a backup abtch file using

    osql -U sa -P -Q "BACKUP DATABASE dbname TO DISK = "backup.bck"

    Each time the batch file is run the appended "backup.bck" is appended.

    Restore seems to restore the first backup. How can I restore the latest (or other backups)?

    Thanks.

  2. #2
    Join Date
    Jan 2003
    Location
    Massachusetts
    Posts
    5,800
    Provided Answers: 11
    You will have to find the FileID of the backup you want by running

    restore headeronly from disk = 'backup.bck'

    Then you will have to run

    BACKUP DATABASE dbname TO DISK = "backup.bck" with FILEID = n

    The syntax is a little rusty for me, so you may want to confirm with BOL.

    Good luck

  3. #3
    Join Date
    Jul 2003
    Posts
    4

    THANKS!

    Thank-you! Thank-you! Thank-you! Happy! Happy! Happy!

    Thanks McRowley!

    The exact instructions for anyone else are...

    Restoring From an Appended Backup

    RESTORE HEADERONLY FROM DISK = 'dbbackupnameandpath'
    This will show the list of backups - locate the POSITION column. Decide which 'POSITION' you wish to restore.

    Connect to the MASTER database (or any other db)

    RESTORE DATABASE dbname FROM DISK = 'dbbackupnameandpath' WITH FILE = positionnumber, REPLACE

    If you want to prevent the appending, simply add WITH INIT to the backup command

    osql -U sa -P -Q "BACKUP DATABASE dbname TO DISK = 'dbnameandpath' WITH INIT"

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •