Backup of Internal and External PostgreSQL Database
Before the backup
It is recommended to stop YSoft SafeQ services before database backup is performed.
The backup of databases shall be done at the same time to prevent inconsistency among databases.
- Stop all YSoft SafeQ services in the whole environment (Management Servers, Site Servers) except the following (leave the services listed below running):
YSoft SafeQ Bundled PostgreSQL (available if an embedded PostgreSQL DB is used)
You can use the following PowerShell script to perform the task:
POWERSHELLGet-Service *YSoft* | Where-Object {$_.Name -ne 'YSoftPGSQL' -and $_.Name -ne 'YYSoftPGSQL' } | Stop-Service
- pgAdmin4
PostgreSQL Backup
Important information
All backup procedures should be consulted first with Database Administrator/Owner in case an external PostgreSQL database is used.
Please note that this is just a quick guide for pgAdmin tool. Latest documentation is always available on PostgreSQL web pages.
Backup using pgAdmin administration tool
- On the database server, run the pgAdmin administration tool
- On pgAdmin tool click on Add New server
- Fill SQDB6 in Name section and continue to Connection tab
- Fill the connection information of the database
- In browser window, double-click the newly added item to connect to the server
- Right-click in the database to backup and click the Backup... option
- Set a Filename of your choice
- Keep Format set as Custom
- Set the Role name as postgres
- Press the Backup button
- If everything is correct, a popup should appear with information that the procedure ended successfully
- You can check the log if you click on More details
Additional information
The backup process is executed by the tools using Python (embedded with PG Admin). The installer adds a path to Python libraries into the PATH system variable.
If the backup process fails and displays the Cannot locate Python36.dll error message, make sure that the "PATH" system variable contains the path to the "bin" folder of pgAdmin (for Embedded PostgreSQL, this path is "%SAFE_HOME%\PGSQL\pgAdmin 4\bin")
Repeat steps 1. - 11. for SQDB6_DWH database on the appropriate server
- Repeat steps 1. - 11. for SQDB6_IMS database on the appropriate server
- Repeat steps 1. - 11. for SQDB6_YPS database on the appropriate server
Backup using command line
If you prefer to use command line and YSoft SafeQ was installed with the embedded PostgreSQL database, use the following commands:
"%SAFEQ_HOME%\PGSQL\bin\pg_dump.exe" --host localhost --port 5433 --username "postgres" --role "postgres" --format custom --blobs --verbose --file "SQDB6.backup" "SQDB6"
"%SAFEQ_HOME%\PGSQL\bin\pg_dump.exe" --host localhost --port 5433 --username "postgres" --role "postgres" --format custom --blobs --verbose --file "SQDB6_IMS.backup" "SQDB6_IMS"
<# Use the command below only when Data Warehouse deployment is used #>
"%SAFEQ_HOME%\PGSQL\bin\pg_dump.exe" --host localhost --port 5433 --username "postgres" --role "postgres" --format custom --blobs --verbose --file "SQDB6_DWH.backup" "SQDB6_DWH"
<# Use the command below only when using Payment System #>
"%SAFEQ_HOME%\PGSQL\bin\pg_dump.exe" --host localhost --port 5433 --username "postgres" --role "postgres" --format custom --blobs --verbose --file "SQDB6_YPS.backup" "SQDB6_YPS"
You might need to enter password for the "postgres" user after executing the command.
Backup will be created in the folder from which the command is run.
%SAFEQ_HOME%\PGSQL\bin\pg_dump.exe &$env:SAFEQ_HOME\PGSQL\bin\pg_dump.exe
%SAFEQ_HOME%\PGSQL is the default location of the PostgreSQL that comes embedded in SafeQ.
When using an external PostgreSQL server, you need to locate the executable "pg_dump.exe" which comes as part of PostgreSQL installation and adjust the script accordingly:
- replace the "%SAFEQ_HOME%\PGSQL\bin\pg_dump.exe" with path to "pg_dump.exe"
- replace also --host and --port values if needed
After the backup
Start YSoft SafeQ services with Automatic startup type on Management Servers again
Do not start YSoft SafeQ Spooler Controller Group Service. It will be started by YSoft SafeQ Spooler Controller service when proper configuration is ready.
- Start YSoft SafeQ Management Service first
- Start remaining YSoft SafeQ services in no particular order
You can use the following PowerShell script to perform the task
POWERSHELLGet-Service *YSoft* | Where-Object {$_.Name -ne 'YSoftSQ-SPOCGS'} | Start-Service
Start YSoft SafeQ services with Automatic startup type on Site Servers again
Do not start YSoft SafeQ Spooler Controller Group Service. It will be started by YSoft SafeQ Spooler Controller service when proper configuration is ready.
- Start YSoft SafeQ Spooler Controller first
- Start remaining YSoft SafeQ services in no particular order
You can use the following PowerShell script to perform the task
CODEGet-Service *YSoft* | Where-Object {$_.Name -ne 'YSoftSQ-SPOCGS'} | Start-Service