OXID eShop backup management

OXID eShop backup management

Within this article we take a look on how to create full a full backup of your OXID eShop system. With this backup it is possible to bring a crashed OXID eShop system back to live. You will need to have commandline access to finish this tutorial.

An OXID eShop backup consists of two seperate components. The filesystem where your pictures and shop programm code is stored and the database where your product and customer data is stored.

Both components are needed to bring a crashed OXID eShop system back online.

OXID eShop filesystem backup

To create a backup of your OXID eShop filesystem, you have to login to your servers commandline and change the directory to the parent folder of the OXID eShop home directory. If your OXID eShop is installed for example in a folder called “public_html”, you have to point your commandline tool to the parent folder of “public_html”.

After you changed your directory please enter the folowing command to create an archive parallel to your oxid eshop home directory.

tar cfvz [ARCHIVE].tar.gz [DIRECTORY]

In [ARCHIVE].tar.gz a complete filesystem backup was created and you can move the file away to a secure space.

To decompress the archive content type in the following command:

tar xfvz [ARCHIVE].tar.gz

OXID eShop database backup

To backup the OXID eShop database we have to make sure to know for different informations. We need the MySQL servers hostname, the name of the database we want to backup, a username that has access to the database and a passwort to authenticate with the MySql server.

All needed information can be found in the OXID eShop system file config.inc.php, which is located in the home directory of OXID eShop.

After we have all database related information we can start our OXID eShop 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 asked twice for a passwort after firing the above command. After the command has been finished you will find an sql file within the current commandline folder. Move the .sql file to the same space as where the filesystem backup has been moved to.

If you want to import the SQL file back into the mysql server just run the folowing command:

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

You will get promted for a user password once.

Generate database view tables

We foreced the mysql backup to be without generated OXID eShop view tables. These view tables must be generated once you import the backup back into the MySql server. To be able to log into the OXID eShop administration, you have to edit config.inc.php system file, which is located in the shops home directory. Find this line:

$this->blSkipViewUsage = false;

and edit the line like this:

$this->blSkipViewUsage = true;

If you cannot locate the line within config.inc.php just add it to the end of the file.

Please delete the contents of /tmp folder which is located in the OXID eShop home directory. Delete all the containing files and keep the .htaccess file

Now login to the OXID eShop administration and navigate to "Service" and within "Service" menu navigate to "Tools" section. On the "Tools" page you find a button named "Generate views". Click it and accept the following promt to regenerate the view tables.

Finally edit the config.inc.php file again, locate this line:

$this->blSkipViewUsage = true;

Edit the line so it looks like this:

$this->blSkipViewUsage = false;

Now you have successfully backuped and recreated your OXID eShops MySql database and it is possible to use the shopsystem as you were used to it before.