Language:


Journaling - Applying the Journal

If you need to revert to an old database, follow these steps:
  1. The old database must be one that was created after you started journaling. If you are using the database duplication feature, the most recent database copy will be named "HANSA.HDB.COPY".

    Before reverting to this old database, you may wish to check that it does not contain the damage that caused you to revert to it. You must carry out this check using a copy of the "HANSA.HDB.COPY" file. If you use the "HANSA.HDB.COPY" file itself for this check, you will no longer be able to apply the journal successfully because you will break the synchronicity between the database and the journal. You must not even open the "HANSA.HDB.COPY" file or log in to it, let alone save any records before applying the journal.

    To carry out this check, follow these steps:

    1. Create a copy of the folder containing the Standard ERP server application.

    2. Place a copy of the "HANSA.HDB.COPY" database in the folder from point (a).

    3. Rename "HANSA.HDB.COPY" to "HANSA.HDB". This database was created after you started journaling but does not contain the most recent changes and additions that are in the journal file. The database and the journal file are therefore out of synchronisation, so you must turn off journaling in order to check the database.

    4. Ensure there is no "journal" folder in the folder from point (a) or at least that you have kept a copy in a separate folder.

    5. Launch the command line application on the server by typing:
      ./StandardERPServer --stop-journaling --i-know-this-is-dangerous (Linux 32-bit),
      ./StandardERPServer64 --stop-journaling --i-know-this-is-dangerous (Linux 64-bit) or
      ./StandardERPServer --stop-journaling --i-know-this-is-dangerous (Mac OS X)
      Starts the Standard ERP server application and stops journaling. --i-know-this-is-dangerous is a check to ensure that you do want to stop journaling. Note that this will delete all journal files in the "journal" folder, hence the need to remove it as described in point (d).
      If you are using the service application (Windows) or a GUI single-user application, you will need to place the --stop-journaling --i-know-this-is-dangerous parameters in a "parameters.txt" file before launching the application (the latter option is described in the 'Launching the Server with Parameters ' section on the Loading an Existing Database and Company page). After starting the service or the application, remove the parameters from the "parameters.txt" file.

    6. You now either log in from a client or close the server and open the database using the GUI application, as described on the Shutting Down page.

    7. Check the database as required.

    8. Because database duplication is activated in the test database, a new file named “HANSA.HDB.COPY” will be created. This file can be discarded: do not confuse it with the “HANSA.HDB.COPY” that you will use for the reversion

    !

    Make sure you have an untouched "HANSA.HDB" file and journal file at all times.


  2. When you are sure that the "HANSA.HDB.COPY" file does not contain any damage, place it in the folder containing the Standard ERP server application and ensure it is named "HANSA.HDB". Remember that this must be a database that is untouched by any testing. Similarly, the "J0000001.HJN" journal file in the "journal" folder must also be one untouched by any testing. It is recommended that you keep copies of both files, at least until you are sure the journal has been applied successfully, in case of a power failure or hardware problem occurring while the journal is being applied. Then, launch the command line application on the server by typing:
    ./StandardERPServer --apply-journal (Linux 32-bit),
    ./StandardERPServer64 --apply-journal (Linux 64-bit) or
    ./StandardERPServer --apply-journal
    Starts the Standard ERP server application and imports everything in the journal file that is not already in the database. The application will then quit.
    Again, if you are using the service application (Windows) or GUI single-user application, you will need to place the --apply-journal parameter in the "parameters.txt" file before launching the application, and to remove that parameter from the "parameters.txt" file when the application quits.

    !

    You must apply the journal immediately after reverting to the copy. If you open the copy and allow users to log in before applying the journal, the data in both the database and the journal file will be corrupted.


  3. The final step is to stop and restart journaling. Restart the command line or service application using the --stop-journaling --i-know-this-is-dangerous parameters. Note that this will delete the "J0000001.HJN" file from the "journal" folder so, if you need to keep it along with the corresponding "HANSA.HDB.COPY", make copies first. Then either log in from a client and start journaling from the Journaling setting in the System module or close the server and then restart the command line or service application again, this time using the --start-journaling parameter. After logging on from clients, every change will, as before, be saved in the database and in a new "J0000001.HJN" file.
---

In this section:

See also:
Go back to: