hassiah


Hello,

I would like a way to check a file before attempting to restore it. I want to be able to tell that this is a valid SQL backup file and not just some random file before I attempt a restore.

Any help would be appreciated!

hassiah



Re: How to verify the validity of a file prior to attempting restore?

Arnie Rowland


Lookup [RESTORE VERIFYONLY] in Books Online.





Re: How to verify the validity of a file prior to attempting restore?

Jerry Hung

Arnie Rowland wrote:
Lookup [RESTORE VERIFYONLY] in Books Online.

VERIFYONLY, yes, to verify the backup integrity (look at header and more...)

Also this may help

-- First determine the number and names of the files in the backup.

RESTORE FILELISTONLY
FROM DISK = N'\\Directory\Backup_Name.bak'







Re: How to verify the validity of a file prior to attempting restore?

hassiah

I forgot to mention that I was trying to do this programmatically in .NET... c# 2.0... I guess that is why my post got moved here... anyway, the answer, from another forum here, was to use the SqlVerify method of the SMO Restore object. Worked great!

Thanks to all for their comments.

-hassiah