8.2 Backing Up the PostgreSQL Database

By default, ZENworks automatically backs up the PostgreSQL database every week. By using the AutomaticPostgresMaintenanceConfigureAction, you can schedule the automatic backup of the database. By default, the database backup schedule is set to Sunday midnight. However, you can use the pgsqlDBbackupConf.xml file to customize the backup schedule.

NOTE:

  • The AutomaticPostgresMaintenanceConfigureAction takes backup only the Embedded PostgreSQL database.

  • Ensure that you take the backup of the database at a regular intervals.

  • It is recommended that you do not disable the backup. This might ensure that you have a backup of the database in case of a disaster.

  • VACUUM reclaims storage occupied by dead tuples. In normal PostgreSQL operation, tuples that are deleted or obsoleted by an update are not physically removed from their table; they remain present until a VACUUM is done. Therefore it is necessary to VACUUM periodically, especially on frequently-updated tables.

  • In ZENworks 2020 Update 2 and earlier, pgsqlDBbackupConf.xml was used to configure backups 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

  • The custom JDBC URL cannot be used for automatic database maintenance.

After successfully running the configure action, the backup (PGDUMP) is saved in the following location:

  • On Windows: %ZENSERVER_HOME%\work\pgsql

  • On Linux: /var/opt/microfocus/zenworks/

Based on requirements, you can customize the pgsqlDBbackupConf.xml file and then run the microfocus-zenworks-configure -c AutomaticPostgresMaintenanceConfigureAction command.

The pgsqlDBbackupConf.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 pgsqlDBbackupConf.xml file.

The ZENworks and Audit databases will be created under ZCMDB_pg_dump and AuditDB_pg_dump folders respectively.

Following is an example of the pgsqlDBbackupConf.xml file:

<Schedule>
        <DailySchedule>
            <DaysOfWeek>
                <Sunday>true</Sunday>
                <Monday>false</Monday>
                <Tuesday>false</Tuesday>
                <Wednesday>false</Wednesday>
                <Thursday>false</Thursday>
                <Friday>false</Friday>
                <Saturday>false</Saturday>
            </DaysOfWeek>
            <StartTime Hour="23" Minute="55" Second="0"/>
        </DailySchedule>
    </Schedule>
    <ns2:BackupDir>C:\Program Files (x86)\Novell\ZENworks\work</ns2:BackupDir>
    <ns2:AuditEnabled>false</ns2:AuditEnabled>
    <ns2:ZenEnabled>true</ns2:ZenEnabled>
</ns2:BackupConfig>

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:

-zenworks-configure -c AutomaticPostgresMaintenanceConfigureAction -Dpgsql.delete.maintenance.queue=yes