Contents

    Creating a database backup of JTL-Shop

    Your task/initial situation

    You would like to carry out certain work on your JTL-Shop, for example, installing a new version of JTL-Shop. In order to test these changes safely and not risk any data loss, you would like to back up the JTL-Shop database.

    General information on the subject of JTL-Shop backups

    The data that makes up your JTL-Shop comes from three sources:

    • Item, stock, price, category, and manufacturer information is transferred from JTL-Wawi. It is located in the JTL-Wawi database.
    • Customer, order, newsletter, and much other data is stored in the JTL-Shop database.
    • Shop files, which range from core files (not data), installation configuration and your template to media files and item images, are stored in the web space.

    To be fully protected against data loss, you therefore need to create backups for all three locations or have them created. Depending on the data, we recommend the following intervals:

    • JTL-Wawi database: daily. Learn how to create a backup of the JTL-Wawi database: Creating a database backup.
    • Database of JTL-Shop: regular daily backups. Usually, your hosting provider takes care of this; contact them for details. You should also make separate backups before any major changes such as updates to a new version.
    • Shop files: after every change. For example, a backup is needed when you adjust the template or change settings. To do this, either copy your entire template and all files that change, or in the case of larger changes (e.g. an update; follow the update instructions) copy all files from the root directory of your JTL-Shop from the server to another location.

    Difference between regular and special backup

    There are two different kinds of backup:

    Regular backup: This is usually created automatically by the hosting provider at regular intervals (e.g. once every night) and kept for a certain period of time. In the event of unexpected data loss, it can be used for recovery.

    Special backup: In some situations, it is advisable to create a separate backup, for example because you will be making critical changes. The simplest example is a version update.

    With these special, separate backups, there are a few things you need to keep in mind to avoid errors, data loss or even “database asynchrony” afterwards.

    JTL-Shop works together with JTL-Wawi. Both use independent databases (JTL-Wawi: MSSQL database, JTL-Shop: MySQL database), which are synchronised via the online shop synchronisation. Asynchrony is when the data in JTL-Wawi and JTL-Shop are not the same despite successful synchronisation.

    Examples:

    • An item price was changed in JTL-Wawi and despite the synchronisation, this price is not in JTL-Shop.
    • An order was placed in JTL-Shop and although it is marked as synchronised in the order history in the back end of JTL-Shop, it cannot be found in JTL-Wawi.

    The origin of these errors can also be cache or general alignment issues. First you should check the browser cache, template cache and object cache in the back end of JTL-Shop under System > Cache.

    However, such an asynchrony can also be created when an old database backup is imported.

    Example:

    • You change item prices in JTL-Wawi and then carry out a synchronisation with JTL-Shop. The prices are displayed correctly there.
    • You import a backup into JTL-Shop that was created before the last adjustment
    • From now on, the two databases are asynchronous with regard to the item prices, because the old prices are still in JTL-Shop while the new prices are stored in JTL-Wawi. With a normal synchronisation this cannot be solved since JTL-Wawi does not know that JTL-Shop no longer has the newer data. The affected data must therefore first be transferred again in JTL-Wawi via a complete synchronisation.

    Step 1: Preparations for the backup

    Before you create a backup, you should make some preparations that will allow you to carry out the planned maintenance work or desired changes afterwards.

    1. Place JTL-Shop in maintenance mode in the back end under Settings > Global.
    2. From now on, do not carry out any more synchronisations with JTL-Wawi. If you use the background service JTL-Worker, stop it and deactivate it in JTL-Wawi under Admin > JTL-Worker.
    Alternatively, you can also deactivate only the online shop synchronisation in JTL-Worker by activating the check box Keinen Onlineshop-Abgleich für diesen Mandanten durchführen (Do not perform online shop synchronisation for this tenant) and then restarting JTL-Worker.
    1. From now on, do not change any settings in the back end.

    Step 2: Creating database backups of JTL-Shop

    Database backups of JTL-Shop are also called SQL dumps. These contain the entire database of JTL-Shop, including all data stored there such as orders, customers, and settings for newsletter recipients. They do not contain any installation or configuration-specific data (e.g. database access credentials for connecting shop files to the database; Blowfish key for encrypting and decrypting customer data), templates, item images, etc. To save these, you must save the shop files from the root directory on the server.

    In principle, you should always have database backups carried out by an expert. Ideally, this is done by your hosting/Internet provider, a server administrator specifically responsible for this, or a JTL service partner. They usually also know best how to automate the backup process and recognise at an early stage whether there could be problems.

    Should you nevertheless create a backup yourself, the available options depend on the individual hosting provider. We therefore recommend that you check with your hosting provider first.
    We will briefly explain the possible use of PHPMyAdmin, which is available almost everywhere, and then the use of Plesk, which is possible, for example, with a shop hosted by JTL.

    Possibility 1: Backup using PHPMyAdmin

    Important information: Due to server configuration and script runtimes, large databases can lead to problems when PHPMyAdmin is used, and the backup may not be created correctly. In this case, please contact your hosting provider regarding the backup! With a database size of more than 200MB, unusable results are to be expected with this method.
    1. Open PHPMyAdmin and in the Databases section, select the database for which you want to create a backup.
    2. Switch to the Export tab.
    3. Set the following settings in PHPMyAdmin for an export of the JTL-Shop database:
    • Export method: Custom
    • Tables: Check all, even structure and data!
    • Compression: Select “zip” or “gzip”.
    • Check the option “Add DROP TABLE / VIEW / PROCEDURE / FUNCTION / EVENT / TRIGGER statement”.
    • Add some zeros in the setting “Maximum length of created query”, especially for large databases.

    Your settings will then look like this:

    1. Click OK to create the database backup. You can then save it locally on your hard drive. Continue with step 3.
    Important information: Always check the saved file afterwards. Do not just assume that it worked. This is also important for regular backups. In an emergency, it does not matter how many backups you create if they are all defective.

    Possibility 2: Backup using Plesk

    You can find more information about Plesk and how to access it as a JTL-Hosting customer under Managing email addresses and FTP access for JTL-Hosting for JTL-Shop.

    1. Log in to your Plesk account.
    2. Click on Databases > Export Dump.
    3. In the next step, you must specify the destination directory. We recommend the directory /httpdocs/export/backup (it is protected from direct access via .htaccess. You cannot download the backup with your browser, but you can access it via FTP and the Plesk file browser). You can also choose here whether the file should be downloaded immediately.
    1. Click OK to create the database backup and continue with step 3.
    Important information: Always check the saved file afterwards. Do not just assume that it worked. This is also important for regular backups. In an emergency, it does not matter how many backups you create if they are all defective.

    Step 3: Follow-up

    Important information: This is the procedure without errors. If data loss/asynchrony occurs, further steps are necessary.
    1. Carry out your necessary work (e.g. the update; go to help pages on Carrying out the update).
    2. Check whether your JTL-Shop has serious errors. The various integrated test methods in Troubleshooting > Diagnostics > File structure, the directory rights, and the database structure will help you here. In addition, we recommend that you take a close look at your online shop after the changes and check all important functions.
    1. If no errors occur, you may now carry out the online shop synchronisation again, reactivate the background service JTL-Worker if necessary and continue with your normal work. If errors occur, read the instructions Restoring a database backup.
    2. Deactivate the maintenance mode under Settings > Global.