SQL Code to verify a restored Database?

  • I am looking for some simple sql statements that would help me verify that a database was restored? For example, if I restore the pubs database are there scripts I can run which would list the user tables in the pubs database, count the user tables and system tables, count other objects (views, sps, etc.). I would like to run these scripts before the restore and then after the restore just to verify my objects are the same.

    Thanks in advance, Kevin

  • Try the system table, sysobjects.

  • I would almost consider this a waste of time. The restore will restore what's in the backup. If you are worried about your backup not containing the right objects, that won't happen if it's the correct backup.

    If you're worried about changes made after the backup that are lost, you need a good scheme to regularly run and get a list of objects.

    INFORMATION_SCHEMA views will help.

  • Simply checkmarking the verify checkbox on a backup will do what you want as well.

Viewing 4 posts - 1 through 3 (of 3 total)

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