Manually backing up the database when updating the system
A database can be backed up both manually or automatically.
Automatic back up (ABU) – backing up the data according to a specific script. The advantage of this method is that user involvement in the backup copying is not necessary.
ABU is supported for
- PostgreSQL (when ELMA and DBMS are installed on the same server).
To disable ABU, stop the server and add backupEnabled="false" to the configuration.config configuration file. This file is in ..\ELMA3-[Edition]\UserConfig. To learn more, see this article.
Manual back up (MBU) – manual back up copying by a user.
MBU is available for:
- PostgreSQL (when ELMA server and PostgreSQL are installed on different machines);
In case of MBU, a user receives a notification on the server start page, which informs about the backup progress. The following variants are possible:
1. This notification will be displayed if the ABU option is disabled (fig. 1).
Fig.1 Server start page
In this case, you need to wait until the system shows a notification about successful backup copying (fig. 3) or the MBU form (fig. 2).
Fig. 2 MBU form
When the MBU form opens (fig. 2) you need to enter a confirmation code (fig. 3), located in a text file. The path to the text file is specified on the form fig. 2.
Fig. 3 Confirmation code
The confirmation code is generated automatically for each MBU.
2. This notification will be displayed if the server is restarted and to updates were made to the DB (fig. 4).
Fig. 4 Server start page
3. This notification will be displayed if the ELMA server had automatically backed up the DB (fig. 5).
Fig. 5 Server start page
4. This notification will be displayed if the administrator had confirmed (fig. 2) creation of a backup copy (fig. 6).
Fig. 6 Server start page
Back up for PostgreSQL
Back up is performed using the pg_dump.exe application, located in ..\ELMA3-[Edition]\PostgreSQL\bin.
If several PostgreSQL instances are installed on the ELMA server and you need to use a specific one, you can use the pathToPgDump option. It allows specifying the absolute path to the executable file pg_dump, including the name and the extension. Example:
connectionStringName="MainDB" type="EleWise.ELMA.Extensions.PostgreSQL.PostgreSQLProvider, EleWise.ELMA.Extensions.PostgreSQL"
Changes have been made to the configuration file for PostgreSQL in <configSections>.
As the type in the line
<section name="main.db" type="EleWise.ELMA.Configuration.MainBaseSettingsSection, EleWise.ELMA.SDK, Version=188.8.131.52, Culture=neutral, PublicKeyToken=cb29d04eca9b031d" />
now you need to specify
<section name="main.db" type="EleWise.ELMA.Extensions.PostgreSQL.PostgreSQLSettingsSection, EleWise.ELMA.Extensions.PostgreSQL" />
Back up for MSSQL
If you use MSSQL, you can use one of several backup methods:
- backupPath="specified_path" – the back up is saved to the specified location. If you specify a local path (e.g. C:\Base\Backups), it must exist on the DB server. You can also specify a network path (e.g. ..\Server\ELMA-Backups).
- backupPath="" (i.e. empty path is specified) – the back up is saved to the folder, specified in the MSSQL properties.
- backupPath(no path is specified) – additional check is performed:
- The connection string contains the AttachDBFilename parameter – the folder for storing the back up is taken from the parameter.
- The connection string contains the AttachDBFilename parameter – the back up is saved to the folder, specified in the MSSQL properties.
Saving the backup copy
All operations with the backup copy are registered in a log file. The location of the log file relative to the web server catalog is ..\logs\Backup\backup-log-*.
If backupPath is not specified in the configuration file and you need to back up, then the DBMS:
- Firebird – will attempt to save to the DB folder (under the condition that the user, who started the DBMS service, has permissions to write to this folder);
- MSSQL – will attempt to save to the default folder (under the condition that the user, who started the DBMS service, has permissions to write to this folder);
- PostgreSQL – will attempt to save to the folder, specified in backupPath (under the condition that the user, who started the DBMS service, has permissions to write to this folder);
- Oracle – the backupPath parameter is not used, ABU is not supported by this DBMS.