By default, ZENworks automatically backs up and vacuums the PostgreSQL database every week. By using the AutomaticPostgresMaintenanceConfigureAction, you can schedule the automatic backup and vacuum of the database. The default database backup and vacuum schedule is set to Sunday midnight. However, you can use the pgsql-maintenance.xml file to customize the schedule.
NOTE:
The AutomaticPostgresMaintenanceConfigureAction takes backup only the Embedded PostgreSQL database.
In ZENworks 2020 Update 2 and earlier, pgsqlDBbackupConf.xml was used to take a backup of the PostgreSQL database. While upgrading from Update 2 to the latest version, pgsqlDBbackupConf.xml is replaced with pgsql-maintenance.xml. If customer has enabled backup only for audit, vacuum will also be done only for the audit database. If the backup is done for both databases, the vacuum will also be done for both databases.
Database backup directory for Linux should be under /var/opt/microfocus/zenworks
If you have configured your zone to use custom JDBC URL for connecting to database, automatic database maintenance actions will not be performed.
After successfully running the configure action, the backup (PGDUMP) is saved in the following location:
On Linux:
/var/opt/microfocus/zenworks/common/pgsql/ZCMDB_pg_dump/currentBackupFolder
/var/opt/microfocus/zenworks/common/pgsql/AuditDB_pg_dump/currentBackupFolder
On Windows:
%ZENSERVER_HOME%\work\pgsql\ZCMDB_pg_dump\currentBackupFolder
%ZENSERVER_HOME%\work\pgsql\AuditDB_pg_dump\currentBackupFolder
Based on requirements, you can customize the pgsql-maintenance.xml file and then run the microfocus-zenworks-configure -c AutomaticPostgresMaintenanceConfigureAction command.
The pgsql-maintenance.xml file is located in the following location:
On Windows: %ZENSERVER_HOME%\conf\pgsql
On Linux: /etc/opt/microfocus/zenworks/pgsql
NOTE:By default, only ZENworks database is backed up. If required, you can enable the backup of audit database by setting the AuditEnabled parameter to true in the pgsql-maintenance.xml file.
Following is an example of the pgsql-maintenance.xml file:
<?xml version="1.0" encoding="UTF-8" standalone="yes"?> <PostgresMaintenanceInputsType xmlns:ns2="http://www.novell.com/ZENworks/v1.0/Backup" xmlns:ns3="http://www.novell.com/ZENworks/v1.0"> <ns2:PostgresBackupInputs> <ns2:backupDir>/var/opt/microfocus/zenworks</ns2:backupDir> <ns2:backupZen>true</ns2:backupZen> <ns2:backupAudit>false</ns2:backupAudit> </ns2:PostgresBackupInputs> <ns2:PostgresVacuumInputs> <ns2:vacuumZen>true</ns2:vacuumZen> <ns2:vacuumAudit>false</ns2:vacuumAudit> </ns2:PostgresVacuumInputs> <ns3:Schedule> <ns3:DailySchedule> <ns3:DaysOfWeek> <ns3:Sunday>true</ns3:Sunday> <ns3:Monday>false</ns3:Monday> <ns3:Tuesday>false</ns3:Tuesday> <ns3:Wednesday>false</ns3:Wednesday> <ns3:Thursday>false</ns3:Thursday> <ns3:Friday>false</ns3:Friday> <ns3:Saturday>false</ns3:Saturday> </ns3:DaysOfWeek> <ns3:StartTime Hour="23" Minute="55" Second="0"/> </ns3:DailySchedule> </ns3:Schedule> </PostgresMaintenanceInputsType>
IMPORTANT:In case you have your own mechanism of taking backup of the databases, and do not want ZENworks to take a backup, you can run the following command:
microfocus-zenworks-configure -c AutomaticPostgresMaintenanceConfigureAction -Dpgsql.delete.maintenance.queue=yes