Please whitelist cPanel in your adblocker so that you’re able to see our version release promotions, thanks!

The Community Forums

Interact with an entire community of cPanel & WHM users!
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Restore all databases ibdata1 corrupted

Discussion in 'Database Discussions' started by MarceloKonrath, Oct 29, 2017.

Tags:
  1. MarceloKonrath

    MarceloKonrath Active Member

    Joined:
    Jun 8, 2013
    Messages:
    30
    Likes Received:
    2
    Trophy Points:
    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
     
    #1 MarceloKonrath, Oct 29, 2017
    Last edited by a moderator: Oct 29, 2017
  2. cPanelMichael

    cPanelMichael Forums Analyst
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    41,516
    Likes Received:
    1,616
    Trophy Points:
    363
    cPanel Access Level:
    Root Administrator
  3. MarceloKonrath

    MarceloKonrath Active Member

    Joined:
    Jun 8, 2013
    Messages:
    30
    Likes Received:
    2
    Trophy Points:
    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

    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
     
    #3 MarceloKonrath, Oct 30, 2017
    Last edited by a moderator: Oct 31, 2017
  4. cPanelMichael

    cPanelMichael Forums Analyst
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    41,516
    Likes Received:
    1,616
    Trophy Points:
    363
    cPanel Access Level:
    Root Administrator
  5. MarceloKonrath

    MarceloKonrath Active Member

    Joined:
    Jun 8, 2013
    Messages:
    30
    Likes Received:
    2
    Trophy Points:
    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

     
  6. cPanelMichael

    cPanelMichael Forums Analyst
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    41,516
    Likes Received:
    1,616
    Trophy Points:
    363
    cPanel Access Level:
    Root Administrator
    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:

    Thank you.
     
  7. MarceloKonrath

    MarceloKonrath Active Member

    Joined:
    Jun 8, 2013
    Messages:
    30
    Likes Received:
    2
    Trophy Points:
    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




     
  8. cPanelMichael

    cPanelMichael Forums Analyst
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    41,516
    Likes Received:
    1,616
    Trophy Points:
    363
    cPanel Access Level:
    Root Administrator
  9. MarceloKonrath

    MarceloKonrath Active Member

    Joined:
    Jun 8, 2013
    Messages:
    30
    Likes Received:
    2
    Trophy Points:
    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

     
Loading...

Share This Page