4D allows you to restore entire sets of application data in case of any incidents, regardless of the cause of the incident. Two primary categories of incidents can occur:
The unexpected stoppage of an application while in use. This incident can occur because of a power outage, system element failure, etc. In this case, depending on the current state of the data cache at the moment of the incident, the restore of the application can require different operations:
- If the cache was empty, the application opens normally. Any changes made in the application were recorded. This case does not require any particular operation.
- If the cache contains operations, the data file is intact but it requires integrating the current log file.
- If the cache was in the process of being written, the data file is probably damaged. The last backup must be restored and the current log file must be integrated.
The loss of application file(s). This incident can occur because of defective sectors on the disk containing the application, a virus, manipulation error, etc. The last backup must be restored and then the current log file must be integrated. To find out if an application was damaged following an incident, simply relaunch the application using 4D. The program performs a self-check and details the necessary restore operations to perform. In automatic mode, these operations are performed directly without any intervention on the part of the user. If a regular backup strategy was put into place, the 4D restore tools will allow you to recover (in most cases) the application in the exact state it was in before the incident.
4D can launch procedures automatically to recover applications following incidents. These mechanisms are managed using two options available on the Backup/Backup & Restore page of the Settings. For more information, refer to the Automatic Restore paragraph.
If the incident is the result of an inappropriate operation performed on the data (deletion of a record, for example), you can attempt to repair the data file using the "rollback" function in the log file. This function is available on the Rollback page of the MSC.
Manually restoring a backup (standard dialog)
You can restore the contents of an archive generated by the backup module manually. A manual restore may be necessary, for instance, in order to restore the full contents of an archive (project files and enclosed attached files), or for the purpose of carrying out searches among the archives. The manual restore can also be performed along with the integration of the current log file.
The manual restore of backups can be carried out either via the standard Open document dialog box, or via the Restore page of the MSC. Restoring via the MSC provides more options and allows the archive contents to be previewed. On the other hand, only archives associated with the open application can be restored.
To restore an application manually via a standard dialog box:
- Choose Restore... in the 4D application File menu. It is not mandatory that an application project be open. OR Execute the
RESTOREcommand from a 4D method. A standard Open file dialog box appears.
- Select a backup file (.4bk) or a log backup file (.4bl) to be restored and click Open. A dialog box appears, which allows you to specify the location where files will be restored. By default, 4D restores the files in a folder named Archivename (no extension) located next to the archive. You can display the path:
You can also click on the [...] button to specify a different location.
- Click on the Restore button. 4D extracts all backup files from the specified location. If the current log file or a log backup file with the same number as the backup file is stored in the same folder, 4D examines its contents. If it contains operations not present in the data file, the program asks you if you want to integrate these operations. Integration is done automatically if the Integrate last log file... option is checked (see Automatic Restore).
4.(Optional) Click OK to integrate the log file into the restored application. If the restore and integration were carried out correctly, 4D displays a dialog box indicating that the operation was successful.
- Click OK.
The destination folder is displayed. During the restore, 4D places all backup files in this folder, regardless of the position of the original files on the disk when the backup starts. This way your files will be easier to find.
Any content related to the data file (files and
Settingsfolder) are automatically restored in a
Datasubfolder within the destination folder.
Manually restoring a backup (MSC)
You can manually restore an archive of the current application using the Restore page of the Maintenance and Security Center (MSC).
Manually integrating the log
If you have not checked the option for the automatic integration of the log file on the Restore page of the MSC (see Successive integration of several log files), a warning dialog box appears during the opening of the application when 4D notices that the log file contains more operations than have been carried out in the data file.
In order for this mechanism to work, 4D must be able to access the log file in its current location.
You can choose whether or not to integrate the current log file. Not integrating the current log file allows you to avoid reproducing errors made in the data.