restore database is ok?

  • Dear Friends,

    when i restore a Database backup,how can check restored Database is OK?

    before that after i restore Database, i check

    1- all Tables are exist

    2- all Sp,view,Login are exist

    3- Data in each Table are similar with main Database Table

    i think this is not correct way for check restore Database is OK.

    would you please help me, I would be sure to healthy Database that restored.

    please hurry up.

    Best Regards,

    zohreh

  • Use DBCC CHECKDB to check its integrity.

    John

  • only DBCC Check is enough.

    i should not check data in Tables?

  • No. There are three things that can happen:

    (1) The restore fails, in which case you know it hasn't worked.

    (2) The restore succeeds but DBCC CHECKDB highlights issue, in which case you go through the normal troubleshooting steps.

    (3) The restore succeeds and DBCC CHECKDB is OK, in which case you know that the database you have restored is the same as the one you backed up.

    Even if you were to check the data, what would you check it against? The whole idea of backing up a database is to have a copy of the database as it looked at the time it was backed up. Chances are, by the time you attempt any comparison, the data in the online version will have changed.

    John

  • Can I Define Job for Restore a Backup and DBCC Check?

    with which Syntax?

  • Yes, you can. But I'm afraid I can't do that for you - it'll depend on your exact requirements. I use SSIS for stuff like that. You'll either need to do your own research on this or get someone in to do it for you.

    John

  • The point-and-click method for doing this is to set up a Maintenance Plan in SQL Server Management Studio. Open the tree view under Management until you see Maintenance Plans. Right-click and create a New Maintenance Plan. In the Toolbox window on the left, click and drag the Check Database Integrity item into the plan on the right.

    Then schedule the plan using the window above (click the calendar button). Ensure the plan is enabled (right click on the box you dragged in and check properties. Rename, amend properties as you see fit. Then right click on the tab at the top and Save the maintenance plan.

    To 'test-execute' it, find the Jobs list under SQL Server Agent and the name of the check integrity job, right click and Start Job At Step...

    There are many other ways of doing it, personally I'd prefer to set up a job from scratch and specify the DBCC with my parameters and schedule, best researching this for yourself and deciding the best way of doing it.

    ---

    Note to developers:
    CAST(SUBSTRING(CAST(FLOOR(NULLIF(ISNULL(COALESCE(1,NULL),NULL),NULL)) AS CHAR(1)),1,1) AS INT) == 1
    So why complicate your code AND MAKE MY JOB HARDER??!:crazy:

    Want to get the best help? Click here https://www.sqlservercentral.com/articles/forum-etiquette-how-to-post-datacode-on-a-forum-to-get-the-best-help (Jeff Moden)
    My blog: http://uksqldba.blogspot.com
    Visit http://www.DerekColley.co.uk to find out more about me.

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

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