0

How would i verify that whatever the backup i have taken is correctly restored or not.

EG:

I am taking backup on live system where inserts are going on.backup size is around 50 GB.I have started the restore of the backup but for some reason i have not enable the log and also my session end.So how i will verify that restore was done successfully.

Before taking the backup i have even not calculated the data_lenght,index_lenght and tables row.So is there any way so that i can confirm that restore is successful

regards Suraj

0

You can check if the return value for the command, if 0 then OK else failure.

Put may put it in shell script as follows:

 mysql < dump.sql 1>err 2>&1 
 if [ $? -ne 0 ]; then 
    echo "dump load failed.";
 fi;

or manually run echo $? and determine the result.

3
  • HI,From the next run i will do that but what if i failed to run the shell script.Is there any other way through which i can know that restore is successfully on all ready restored file . – suraj Dec 2 '15 at 15:40
  • Well in thay case you need to manually verify if all the dump contents are properly loaded! – mysql_user Dec 2 '15 at 15:43
  • easiest way to compare it is using mysqldumpsplitter: mysqldumpsplitter --source file.sql --desc > org.txt Take fresh dump from database with --no-data and again run the same mysqldumpsplitter --source freshdump.sql --desc > new.txt diff org.txt new.txt kedar.nitty-witty.com/blog/… – mysql_user Dec 3 '15 at 6:48
0

I have started the restore of the backup but for some reason i have not enable the log and also my session end. So how i will verify that restore was done successfully.

It will almost certainly have failed.

Without specific instruction to the contrary, ending your session forcibly kills any and all processes running within that session.

Consider running the restore through the nohup command to prevent this:

nohup mysql < dump.sql 1>log 2>&1

This will allow this process to continue even if your session is interrupted.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.