Verifying File Integrity

  • Is there a T-SQL command/function that will allow you to input a list of .mdf, .ndf, and .ldf files and check their integrity, similar to the RESTORE VERIFYONLY that you can use to verify SQL backups?

    I've had a couple of situations in the past few months where I tried to attach a DB, and the files I used to attach were corrupt enough it hangs on the attach, and won't let go until a server reboot. I'm trying to think of a way to verify that the files are in good shape before I attach them.

    The Redneck DBA

  • have the backup verify the files at backup time. if storing on a backup on a network,

    backup to local drive first then copy to network

    -----------------------------------------------------------------------------------------------------------

    "Ya can't make an omelette without breaking just a few eggs" 😉

  • Perry Whittle (8/12/2008)


    have the backup verify the files at backup time. if storing on a backup on a network,

    backup to local drive first then copy to network

    It's not backup files I want to verify, it's the actual .mdf, .ldf, .ndf files of a database.

    The Redneck DBA

  • The question you are asking is similar to asking about database verification which means running DBCC CHECKDB command.

    MJ

  • What syntax do you use to run that before it is attached?

    The Redneck DBA

  • Check out dbcc checkprimaryfile this is used by SQL before the attachment occurs, don't know what checks it does other than reading the .mdf but it's what SQL uses initial as part of the attachment process.

    Andrew

Viewing 6 posts - 1 through 5 (of 5 total)

You must be logged in to reply to this topic. Login to reply