Restore all databases ibdata1 corrupted

MarceloKonrath

Active Member
Jun 8, 2013
44
9
8
cPanel Access Level
Root Administrator
Hello,

we all know how is terrible have the file ibdata1 corrupted.

What am I going to do? A new installation of MYSQL and then restore all databases. This will rebuild ibdata1

This script I found is wonderful but it works with compressed backups only.

Does anyone know how to reprogram it to work on incremental backups?


See the script I found in

tfmm.co/restore-all-databases-from-cpanel-backups/

Code:
#!/bin/bash
backuppath=""
restoredir=""

for bckp in $(\ls $backuppath/*.tar.gz);
 do
   noprfx=$(sed -e 's/\.tar\.gz//' <<< $bckp);
   acctname=$(awk -F"/" '{print $NF}' <<< $noprfx);
   tar xzvf $bckp -C $restoredir/ $acctname/mysql;
  for creat in $(\ls $restoredir/$acctname/mysql/*.create);
   do
   echo "Creating $creat"
   mysql < $creat;
   done;
  for dump in $(\ls $restoredir/$acctname/mysql/*.sql);
   do
   echo "Importing $dump"
   dbname=$(awk -F"/" '{print $NF}' <<< $dump);
   mysql $(sed -e 's/\.sql//' <<< $dbname) < $dump;
  done ;
 /usr/local/cpanel/bin/restoregrants --cpuser=$acctname --db=mysql --all;
done
All the solutions I found in this forum are too complex for a simple task. ( Rebuild ibdata1 )

The simplest and quickest thing to do is to restore all databases.


Thank you !
Marcelo
 
Last edited by a moderator:

MarceloKonrath

Active Member
Jun 8, 2013
44
9
8
cPanel Access Level
Root Administrator
Hello cPanelMichael

I just want to recover the databases and not make complex repairs on idbdata1

The script I posted is capable of doing what I need, though it was designed for compressed backups.

Can anyone change that to incremental backups?

This is my call for help. Someone who can help.

Thank you




Hello,

We provide the following InnoDB corruption repair guide:

InnoDB Corruption Repair Guide

Let us know if this helps.

Thank you.
Hello

Can anyone help me to modify this script to restore databases from an incremental backup?

I really need it.

Maybe some programmer who sells programming service.

Thank you
 
Last edited by a moderator:

MarceloKonrath

Active Member
Jun 8, 2013
44
9
8
cPanel Access Level
Root Administrator
Hi cPanelMichael

I contacted modulesgarden.com

I asked for script modifications to work with incremental backups.

I appreciate your repair post in inoodb, but just try to understand that I am on a server with thousands of websites with problems.

I also kindly ask that cPanel provide a database-only restore tool (bulk, all databases from all sites).

I do not have time now to study how to repair inoodb.

The quickest thing to do is simply restore all databases.

Anyway, if anyone knows how to modify the script that helps. This can help others with the same problem.

Thank you
Marcelo

Hello,

You can find a list of companies offering system administration services at:

System Administration Services | cPanel Forums

Thank you.
 

cPanelMichael

Technical Support Community Manager
Staff member
Apr 11, 2011
47,911
2,234
363
cPanel Access Level
DataCenter Provider
Twitter
I also kindly ask that cPanel provide a database-only restore tool (bulk, all databases from all sites).
Hello,

I encourage you to open a feature request if this is something you'd like to see added to the product in the future:

Submit A Feature Request

In the meantime, you could follow the section titled "C/2.2 Restore Multiple/All InnoDB Databases and Re-create ibdata/ib_log files" on the InnoDB recovery guide referenced in my previous post. Note this sentence:

You can also use this method if you already have backup dumps that you'd like to restore over the existing corrupted databases - just start at Step 2.
Thank you.
 

MarceloKonrath

Active Member
Jun 8, 2013
44
9
8
cPanel Access Level
Root Administrator
Hello cPanelMichael

Yes, I saw the instruction

However the mysql dump breaks several times.

The best thing to do is move the mysql folder to mysql-backup. Reinstall mysql and restore all databases.

That's what I want.

Thank you
Marcelo




Hello,

We provide the following InnoDB corruption repair guide:

InnoDB Corruption Repair Guide

Let us know if this helps.

Thank you.
 

MarceloKonrath

Active Member
Jun 8, 2013
44
9
8
cPanel Access Level
Root Administrator
Hi cPanelMichael

thank you so much.

Now I just need to find a way to package the MYSQl folder of each account in batch.

It's already something. However, I still wonder if anyone can help change the script I posted to restore incremental backup databases.

But his tip is valuable. I will search how to package only MYSQL in batch of all accounts.

Thank you

Hello,

Another solution would be to archive the account incremental backup directories into .tar.gz files if you wanted your custom script to work the way it did before:

How do I Compress a Whole Linux or UNIX Directory?

Thank you.