Friday, March 30, 2012

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

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!

hassiahLookup [RESTORE VERIFYONLY] in Books Online.|||

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'

|||

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

No comments:

Post a Comment