December 3, 2002 at 8:27 am
Good morning. I need some help using RESTORE HEADERONLY. I have an automated process which receive a full backup once a week and incrementals the remaining days from our service provider. Each backup is extracted and restored overnight. The problem occurs when the job on the service providers site fails, which happens more often than I'd like. Since we are not aware of the failure, we restore the backup we've received and in the process lose a weeks worth of data - since this always happens with the full backup. What I'd like to do is check the BackupFinishDate to insure it is the correct file before I restore it. Any ideas?
Thanks.
December 4, 2002 at 9:15 am
Rita,
I just posted a script that will determine the latest backup completion time. The title is "Script to determine backup finish times".
DECLARE @FinishDate datetime
SELECT @FinishDate = MAX(backup_finish_date)
FROM backupset B
INNER JOIN backupmediafamily BF
ON B.media_set_id = BF.media_set_id
WHERE physical_device_name = 'full_path_to_device_location'
You can then use this variable to compare to the current date (GETDATE). If the value of the variable is within the time frame you are satisfied with, restore the database. All this can be automated through creating a job and scheduling it.
Hope this helps,
Lori
Viewing 2 posts - 1 through 1 (of 1 total)
You must be logged in to reply to this topic. Login to reply