SQL SERVER – RESTORE VERIFYONLY – TO CHECK WHETHER DATABASE BACKUP CORRUPT OR NOT

Today is April 1st Fool’s day. So today I am going to tell a scenario where I and Joy (My Colleague) became fool (just kidding) and how we overcome the scenario. Yesterday we got a backup from client and we want to restore it. When we tried restore command to restore the database it throws error. First we checked whether there is any problem in our syntax, but we didn’t find any syntax errors. So I came up with an Idea to check whether the database backup is corrupt or not. We issued a restore verify command to check the whether database is corrupt or not. The command applied is as follows, 

 We found an error in the data page in the database backup.

  • Tips:

 Before restoring a database, Please check whether database is corrupt or not. You can save your time.

print

7 thoughts on “SQL SERVER – RESTORE VERIFYONLY – TO CHECK WHETHER DATABASE BACKUP CORRUPT OR NOT

  1. Author’s gravatar

    Good post varunji…it’s really helpful..

  2. Author’s gravatar

    Hai varun,
    Your blog is really helpful and understandable to the beginners in SQL.Your posts are highly remarkable..
    Now i have a scenario can u plz help me?.I have a table and it contains a Varchar field .The data in the field like ‘17262000003’.I need to create a stored procedure
    to select the specified field .but my problem is i need to get a results set its satisfy the following:

    1.if the field contains 11 digits eliminate the last digit and make it as a 10digit.
    2.if the field contains 12 digits take the digits from 2 to 11 and make it as 10 digit(eg.’102345678921′ it should be ‘0234567892’)
    3.if the field contains more than 12 digts need to check in the same way..
    I need to retrieve a new column which contains only 10 digits along with my original column from my stored procedure..Waiting for a good solution from you.
    Thanks in advance
    Preethy Kamath

    1. Author’s gravatar

      Hi Preethy,

      I think this script may help you.

      select [OrginalCOlumnName],case when LEN(‘172620000034’) > 11
      then substring(‘17262000003’,2,11)
      when LEN(‘172620000034’) = 11
      then SUBSTRING(‘17262000003’,0,10)
      else ‘17262000003’ end as [DerivedColumn]
      Use This in the Stored Procedure.Hope this may help u.

      Reply
      1. Author’s gravatar

        Thanks Varun…I got expected results from this.

        Reply
  3. Author’s gravatar

    Hi Varun,
    txs for your precious site full of usefull things.

  4. Author’s gravatar

    Thanks Wolfgang…!

  5. Author’s gravatar

    Hi Varun,
    I would like to be a member of your blog…

    Regards,
    Chandra

Leave a Reply

Your email address will not be published. Required fields are marked *


+ 8 = fourteen