var sidebar_align = 'right';
var content_container_margin = parseInt('290px');
var sidebar_width = parseInt('270px');
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)?
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.
Thank-you! Thank-you! Thank-you! Happy! Happy! Happy!
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"