Create OXID eShop Backup

Create OXID eShop Backup

In this article we explain in detail how to create a full backup of an OXID eShop. With the backup it is possible to restore your OXID eShop completely in case of a crash. To perform the backup, access to the server command line is required.

The backup consists of two components, the OXID eShop file system where your image and program data is stored and the OXID eShop database where your product and customer data is stored.

Both components are required to perform a full OXID eShop backup.

Create OXID eShop File System Backup

To create a backup of the OXID eShop file system, log on to the server via SSH and change to the level above the OXID eShop installation directory on the command line. For example, if your OXID eShop is located in a folder named "public_html", please change to the directory level above "public_html".

Then enter the following command to backup your OXID eShop file system in a compressed archive file parallel to your OXID eShop installation.

tar cfvz [ARCHIVE].tar.gz [LISTING]

ARCHIVE].tar.gz now contains a full backup of your OXID eShop file system and you can keep the file in your desired backup location.

To unpack the created archive please enter the following command:

tar xfvz [ARCHIVE].tar.gz

OXID eShop Database Backup

To create a backup of the OXID eShop database we need to know four pieces of information. We need the hostname of the MySQL server, the name of the database, a username with which we can access the database and its password to log on to the MySQL server.

We get all the necessary information in the OXID eShop file config.inc.php, which is located in the installation directory of the OXID eShop.

Once you have all the information you can perform the database backup with the following command:

mysql --host=[HOSTNAME] [DATABASENAME] -u [USERNAME] -p -e 'show tables where tables_in_[DATABASENAME] not like "oxv\_%"' | grep -v Tables_in | xargs mysqldump --host=[HOSTNAME] [DATABASENAME] -u [USERNAME] -p > [FILENAME].sql

You will be prompted to enter the user password twice when the command is executed. Once the backup is complete, there will be an SQL file in your current directory that contains your OXID eShop database backup. Place the .sql file in the same folder as your OXID eShop file system backup archive.

To restore the SQL file to the database server, change to the directory where the SQL file is located and enter the following command:

mysql --host=[HOSTNAME] [DATABASENAME] -u [USERNAME] -p > [FILENAME].sql

You will be prompted once to enter the user password when the command is executed.

Create new OXID eShop View tables

The database backup was intentionally created without the database view tables created by OXID eShop. These must be recreated before using the software. To enable login to the OXID eShop without created view tables, please look for the following line in the config.inc.php file in the OXID eShop installation directory:

$this->blSkipViewUsage = false;

and change it as follows:

$this->blSkipViewUsage = true;

If you do not find the line, please add it to the end of the file.

Then, starting from the OXID eShop installation directory, please empty the /tmp directory and its sub-folders completely except for the .htaccess file.

Now log into the OXID eShop Administration and navigate to the menu item Service and then click on Tools. The page that opens contains a button called Create new views. Click and confirm the button to recreate the view tables.

Then change the previously edited line of the config.inc.php file again:

$this->blSkipViewUsage = true;

becomes true:

$this->blSkipViewUsage = false;

Your database is now fully restored and you can use the shop as usual.

Further information

Visitors interested in this article have also found useful information on this topic on the following pages.