Verify backup files

jmeyerjmeyer Posts: 70 Bronze 2
edited December 9, 2014 11:00AM in SQL Backup Previous Versions
I know that I can verify backup files while the backup itself is running. However, I'm trying to shorten my backup window and would like to run the verify option separately against the backup files. Is that possible?

Comments

  • peteypetey Posts: 2,358 New member
    You can verify backup files at any time by using the RESTORE VERIFYONLY syntax e.g.
    DECLARE @errorcode INT
    DECLARE @sqlerrorcode INT
    EXEC master..sqlbackup '-sql "RESTORE VERIFYONLY FROM DISK = [e:	emppubs01.sqb]"', @errorcode OUT, @sqlerrorcode OUT
    SELECT @errorcode, @sqlerrorcode
    

    You can find the latest backup files from the msdb..backupset and msdb..backupmediafamily tables. The 2 tables are linked using the media_set_id value.
    Peter Yeoh
    SQL Backup Consultant Developer
    Associate, Yohz Software
    Beyond compression - SQL Backup goodies under the hood, updated for version 8
  • Thanks for this. I was wondering the same thing as jmeyer.
Sign In or Register to comment.