Restoring Databases on an r1soft Backed Up cPanel/WHM Server

Follow

With databases, you have the option of using the R1soft Restore, OR the cpmove file within /home/r1softtemp.

Below is an example of how to use the file in /home/r1softtemp.

To restore using the SQL from the cpmove file within /home/r1softtemp, you can extract the SQL using the following method.

Find your user (I will be using "acctest" for this example)

Find the account, and the time the backup was done using the below example.

# cd /home/r1softtemp/

# ls *{USER}* -lah

root@server [/home/r1softtemp]# ls *acctest* -lah

-rw------- 1 root root 6.3M May 6 02:26 cpmove-acctest.tar.gz

 

You will see that there is a backup from 2AM, on the 6th of May.

 

To list the SQL files, you can use the following command on the file.

# tar tf cpmove-{USER}.tar.gz | grep sql | grep -v 'timestamps\|.create'

root@server [/home/r1softtemp]# tar tf cpmove-acctest.tar.gz | grep sql | grep -v 'timestamps\|.create'

cpmove-acctest/psql_grants.sql

cpmove-acctest/mysql/

cpmove-acctest/mysql/openfileslimit

cpmove-acctest/mysql/acctest_test.sql

cpmove-acctest/mysql.sql

cpmove-acctest/psql/

cpmove-acctest/psql_users.sql

 

This gives a list of all available databses (removing mysql-timestamp files, and .create files which are not required for us).

 

If I want to extract the acctest_test database, I would use the following command

# tar xzvf cpmove-acctest.tar.gz cpmove-acctest/mysql/acctest_test.sql

As you can see, this extracts only the file itself.

root@server [/home/r1softtemp]# find cpmove-acctest

cpmove-acctest

cpmove-acctest/mysql

cpmove-acctest/mysql/acctest_test.sql

 

To Restore this file, you will want to first, take a backup of the already existing database first! 

# mysqldump acctest_test > /home/acctest/acctest_test.BAK20140506.sql 

You will then be able to restore the database using the following command

# mysql acctest_test < cpmove-acctest/mysql/acctest_test.sql

This file should generate on a daily or every 2-3 days basis to backup an accounts cpanel databases.

These files are also backed up, so you may be able to find copies from a few days back, based on the configured Recovery Points.

Have more questions? Submit a request

Comments

Powered by Zendesk