Shopping cart

Your cart is currently empty

Your cart is currently empty

Before proceed to checkout you must add some products to your shopping cart. You will find a lot of interesting products on our shop page.

Continue shopping

In this article we explain in detail how to create a full backup of an OXID eShop. With the backup, it is possible to completely restore your OXID eShop in the event 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 in which your image and program data are stored and the OXID eShop database in which your product and customer data are stored.

Both components are required to fully perform the 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 [DIRECTORY].

In [ARCHIVE].tar.gz there is now a full backup of your OXID eShop file system and you can store the file at your desired backup location.

To unpack the created archive again, please enter the following command:

tar xfvz [ARCHIVE].tar.gz

Create 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 to access the database and the password to log in to the MySQL server.

We get all the information we need in the OXID eShop config.inc.php file, 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] [DATABASE NAME] -u [USERNAME] -p -e 'show tables where tables_in_[DATABASE NAME] not like "oxv\_%"' | grep -v Tables_in | xargs mysqldump --host=[HOSTNAME] [DATABASE NAME] -u [USERNAME] -p > [FILE NAME].sql

You will be prompted twice to enter the user password when executing the command. 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] [DATABASE NAME] -u [USERNAME] -p > [FILE NAME].sql

You will be prompted to enter the user password once when you run the command.

Rebuild 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 search for the following line in the config.inc.php file in the OXID eShop installation directory:

$this->blSkipViewUsage = false;

and please change it as follows:

$this->blSkipViewUsage = true;

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

Then, starting from the OXID eShop installation directory, empty the /tmp directory and its subfolders 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 Regenerate 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:

$this->blSkipViewUsage = false;

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

Further information

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

Related posts

Discover more interesting posts.