ADD HEARTBEATTABLE

Valid for all supported databases. See the Certification Matrix for details on supported databases.

This command requires a database login using DBLOGIN.

Use ADD HEARTBEATTABLE to create the objects necessary to use the automatic heartbeat functionality. This command performs the following tasks

Note: The heartbeat table objects should never be created in the root CDB of an Oracle Multitenant Database.

The default seed, heartbeat, and history table names are GG_HEARTBEAT_SEED, GG_HEARTBEAT, and GG_HEARTBEAT_HISTORY respectively.

In Microservices Architecture, the schema is configured using Replication Settings.

For Db2 LUW, you must set the DB2_ATS_ENABLE property with the db2set DB2_ATS_ENABLE=yes command.

For Db2 for i, to handle upgrade or misconfiguration of heartbeat table functionality, you can run the ADD HEARTBEATTABLE command again, which will repair the functionality of an exisiting heartbeattable setup without deleting the existing heartbeat data.

For Db2 for i, the licensed program, 5770SS1 Option 39 International Components for Unicode, must be installed.

For Db2 for i, the heartbeat table must be journaled to the same journal as the objects that are being replicated in the Extract using the said heartbeat table. If not, the Extract will abend indicating that more than one journal is available. In addition, any other Extract in the specific Oracle GoldenGate installation that is not reading the same journal cannot have the heartbeat table enabled for it.

For Amazon Aurora MySQL, the global variable event_scheduler must be enabled in the parameter group because Amazon RDS doesn’t allow setting global variables. When the database is restarted, the event_scheduler returns to being disabled. To avoid this, you need to enable the event_scheduler in the my.cnf/ini file.

For PostgreSQL, a system job must manually be created to periodically call the heartbeat record update and history record purge function, gg_hb_job_run. For example, a cron job could be created that runs every minute. The function will check the actual heartbeat record update and purge frequency settings of the heartbeat configuration and only process operations within those boundaries:

PGPASSWORD="$passwd" psql -U *gguser* -d *dbname* -h *dbhostname* -p *dbport#* -c "select <ggschema.gg_hb_job_run();" >/dev/null 2>&1

For Azure SQL Database, only ADD HEARTBEATTABLE TARGETONLY is supported and because there is no SQL Server Agent with Azure SQL Database, the purge routine cannot be created. So, the users must periodically run the GG_PURGE_HB_TAB stored procedure to remove old heartbeat records.

Syntax

ADD HEARTBEATTABLE
[, FREQUENCY *number_in_seconds*]
[, RETENTION_TIME *number_in_days*] |
[, PURGE_FREQUENCY *number_in_days*]
[, PARTITIONED]
[, TARGETONLY]

FREQUENCY number_in_seconds

Specifies how frequently the heartbeat records are generated. The default is 60 seconds.

Consider the following limits:

RETENTION_TIME number_in_days

Specifies that heartbeat entries older than the retention time in the heartbeat history table are purged. The default is 30 days.

The minimum value for all databases is 1 and the maximum is 2147483646.

PURGE_FREQUENCY number_in_days

Specifies how often the purge scheduler is run to delete table entries that are older than the retention time from the heartbeat history table. The default is 1 day.

For Db2 LUW and Db2 z/OS, the minimum value is 1 and the maximum is 31.

For all other supported databases, the minimum value is 1 and the maximum value is 199.

PARTITIONED

Valid for Oracle.

Enables partitioning on the heartbeat history table. The column for the heartbeat time stamp received is used to partition the table with an interval of one day. By default the heartbeat history table is not partitioned.

TARGETONLY

Valid for Oracle AI Database, Db2 i Series, Db2 LUW, Db2 z/OS, MySQL, PostgreSQL, and SQL Server.

Does not enable supplemental logging on both the heartbeat seed and heartbeat tables and it does not create a scheduler job for updating the heartbeat table.

Examples


The following command creates default heartbeat tables, procedures and jobs.

ADD HEARTBEATTABLE

The following command creates the heartbeat tables, procedures and jobs with custom frequency, retention time, and purge frequency.

ADD HEARTBEATTABLE, FREQUENCY 120, RETENTION_TIME 10, PURGE_FREQUENCY 2

The following command creates the heartbeat tables, procedures and jobs with partitioning enabled in the heartbeat history table, and supplemental logging is not enabled in the heartbeat and heartbeat seed tables.

ADD HEARTBEATTABLE, partitioned, TARGETONLY