1

I am taking a backup on a live system where inserts are going on. The backup size is around 50 GB. I have started the restore of the backup but for some reason I have not enabled the log, and also my session terminated. How can I verify that restore was done successfully?

Before taking the backup I have even not calculated the data size, index size, or tables row counts. So is there any way so that I can confirm that restore is successful?

mustaccio
  • 25,896
  • 22
  • 57
  • 72
suraj
  • 11
  • 3

2 Answers2

1

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.

Phill W.
  • 8,706
  • 1
  • 11
  • 21
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.

If you didn't capture the mysql exit code, or if your session terminated, you need to manually verify if all the dump contents are properly loaded.

One way to compare it is using mysqldumpsplitter: mysqldumpsplitter --source file.sql --desc > org.txt. Take a fresh dump from the database with --no-data and again run the same mysqldumpsplitter --source freshdump.sql --desc > new.txt, then diff org.txt new.txt.

See this blog for more details.

mustaccio
  • 25,896
  • 22
  • 57
  • 72
mysql_user
  • 1,942
  • 12
  • 9