OceanBase logo

OceanBase

A unified distributed database ready for your transactional, analytical, and AI workloads.

Product Overview
DEPLOY YOUR WAY

OceanBase Cloud

The best way to deploy and scale OceanBase

OceanBase Enterprise

Run and manage OceanBase on your infra

TRY OPEN SOURCE

OceanBase Community Edition

The free, open-source distributed database

OceanBase seekdb

Open source AI native search database

Customer Stories

Real-world success stories from enterprises across diverse industries.

View All
BY USE CASES

Mission-Critical Transactions

Global & Multicloud Application

Elastic Scaling for Peak Traffic

Real-time Analytics

Active Geo-redundancy

Database Consolidation

Resources

Comprehensive knowledge hub for OceanBase.

Blog

Live Demos

Training & Certification

Documentation

Official technical guides, tutorials, API references, and manuals for all OceanBase products.

View All
PRODUCTS

OceanBase Cloud

OceanBase Database

Tools

Connectors and Middleware

QUICK START

OceanBase Cloud

OceanBase Database

BEST PRACTICES

Practical guides for utilizing OceanBase more effectively and conveniently

Company

Learn more about OceanBase – our company, partnerships, and trust and security initiatives.

About OceanBase

Partner

Trust Center

Contact Us

International - English
中国站 - 简体中文
日本 - 日本語
Sign In
Start on Cloud

OceanBase

A unified distributed database ready for your transactional, analytical, and AI workloads.

Product Overview
DEPLOY YOUR WAY

OceanBase Cloud

The best way to deploy and scale OceanBase

OceanBase Enterprise

Run and manage OceanBase on your infra

TRY OPEN SOURCE

OceanBase Community Edition

The free, open-source distributed database

OceanBase seekdb

Open source AI native search database

Customer Stories

Real-world success stories from enterprises across diverse industries.

View All
BY USE CASES

Mission-Critical Transactions

Global & Multicloud Application

Elastic Scaling for Peak Traffic

Real-time Analytics

Active Geo-redundancy

Database Consolidation

Comprehensive knowledge hub for OceanBase.

Blog

Live Demos

Training & Certification

Documentation

Official technical guides, tutorials, API references, and manuals for all OceanBase products.

View All
PRODUCTS
OceanBase CloudOceanBase Database
ToolsConnectors and Middleware
QUICK START
OceanBase CloudOceanBase Database
BEST PRACTICES

Practical guides for utilizing OceanBase more effectively and conveniently

Learn more about OceanBase – our company, partnerships, and trust and security initiatives.

About OceanBase

Partner

Trust Center

Contact Us

Start on Cloud
编组
All Products
    • Databases
    • iconOceanBase Database
    • iconOceanBase Cloud
    • iconOceanBase Tugraph
    • iconInteractive Tutorials
    • iconOceanBase Best Practices
    • Tools
    • iconOceanBase Cloud Platform
    • iconOceanBase Migration Service
    • iconOceanBase Developer Center
    • iconOceanBase Migration Assessment
    • iconOceanBase Admin Tool
    • iconOceanBase Loader and Dumper
    • iconOceanBase Deployer
    • iconKubernetes operator for OceanBase
    • iconOceanBase Diagnostic Tool
    • iconOceanBase Binlog Service
    • Connectors and Middleware
    • iconOceanBase Database Proxy
    • iconEmbedded SQL in C for OceanBase
    • iconOceanBase Call Interface
    • iconOceanBase Connector/C
    • iconOceanBase Connector/J
    • iconOceanBase Connector/ODBC
    • iconOceanBase Connector/NET
icon

OceanBase Migration Service

V4.2.4Enterprise Edition

    Download PDF

    OceanBase logo

    The Unified Distributed Database for the AI Era.

    Follow Us
    Products
    OceanBase CloudOceanBase EnterpriseOceanBase Community EditionOceanBase seekdb
    Resources
    DocsBlogWhite PaperLive DemosTraining & CertificationTicket
    Company
    About OceanBaseTrust CenterLegalPartnerContact Us
    Follow Us

    © OceanBase 2026. All rights reserved

    Cloud Service AgreementPrivacy PolicySecurity
    Contact Us
    Document Feedback
    1. Documentation Center
    2. OceanBase Migration Service
    3. V4.2.4
    iconOceanBase Migration Service
    V 4.2.4Enterprise Edition
    Databases
    • OceanBase Database
    • OceanBase Cloud
    • OceanBase Tugraph
    • Interactive Tutorials
    • OceanBase Best Practices
    Tools
    • OceanBase Cloud Platform
    • OceanBase Migration Service
    • OceanBase Developer Center
    • OceanBase Migration Assessment
    • OceanBase Admin Tool
    • OceanBase Loader and Dumper
    • OceanBase Deployer
    • Kubernetes operator for OceanBase
    • OceanBase Diagnostic Tool
    • OceanBase Binlog Service
    Connectors and Middleware
    • OceanBase Database Proxy
    • Embedded SQL in C for OceanBase
    • OceanBase Call Interface
    • OceanBase Connector/C
    • OceanBase Connector/J
    • OceanBase Connector/ODBC
    • OceanBase Connector/NET
    Enterprise Edition
    • V 4.3.2
    • V 4.3.1
    • V 4.3.0
    • V 4.2.5
    • V 4.2.4
    • V 4.2.3
    • V 4.0.2
    • V 3.4.0
    Community Edition
    • V 4.2.13
    • V 4.2.12
    • V 4.2.11
    • V 4.2.10
    • V 4.2.9
    • V 4.2.8
    • V 4.2.7
    • V 4.2.6
    • V 4.2.5
    • V 4.2.4
    • V 4.2.3
    • V 4.2.1
    • V 4.2.0
    • V 4.0.0
    • V 3.3.1

    Create and update a heartbeat table

    Last Updated:2026-04-14 07:36:49  Updated
    Share
    What is on this page
    Background
    Prerequisites
    MySQL database
    PostgreSQL database
    Create and update a heartbeat table in a MySQL database
    Create and update a heartbeat table in a DB2 LUW database
    Create and update a heartbeat table in a PostgreSQL database

    folded

    Share

    This topic describes how to create and update a heartbeat table when you migrate data from a MySQL database, DB2 LUW database, or PostgreSQL database.

    Background

    When you create a MySQL, PostgreSQL, or DB2 LUW database, if you select Allow OMS to automatically write heartbeat data into this instance during incremental synchronization. This resolves the problem of high latency when no business data is written in the source database. and the entered database user has the privileges to create and write tables, OMS will create a heartbeat table in the corresponding database and update it every 5 seconds.

    If you do not want the heartbeat table to be automatically created and updated by OMS, you can create a database table and configure a crontab task to periodically perform the UPDATE operation on the source database.

    Prerequisites

    The source database account is granted the privileges to create databases or schemas and the privileges to read and write heartbeat tables.

    Note

    The DB2 LUW database account has all required privileges by default.

    MySQL database

    • Grant a database user the privilege to create the drc.heartbeat table:

      GRANT CREATE ON drc.heartbeat TO '<user_name>';
      
    • Grant a database user the privilege to write the drc.heartbeat table:

      GRANT INSERT, UPDATE, DELETE ON drc.heartbeat TO '<user_name>';
      

    PostgreSQL database

    • Grant a database user the privilege to create the drc.heartbeat table:

      GRANT CREATE ON SCHEMA public TO '<user_name>';
      
    • Grant a database user the privilege to write the drc.heartbeat table:

      GRANT INSERT, UPDATE, DELETE ON oms_postgres_heartbeat TO '<user_name>';
      

    Create and update a heartbeat table in a MySQL database

    • Create a heartbeat table

      CREATE DATABASE IF NOT EXISTS drc;
      CREATE TABLE IF NOT EXISTS drc.heartbeat (`id` smallint(6) NOT NULL DEFAULT 1,`ts` int(11) DEFAULT NULL, PRIMARY KEY (`id`)) ENGINE=InnoDB;
      
    • Insert data

      INSERT INTO drc.heartbeat VALUES (1,0) ON DUPLICATE KEY UPDATE ts=0;
      
    • Update data

      UPDATE drc.heartbeat SET ts=%d WHERE id=1;
      

    Create and update a heartbeat table in a DB2 LUW database

    • Create a heartbeat table

      CREATE TABLE IF NOT EXISTS drc.heartbeat (id SMALLINT NOT NULL DEFAULT 1, ts INTEGER DEFAULT NULL, PRIMARY KEY (id));
      
    • Insert data

      MERGE INTO drc.heartbeat AS ht USING(
        SELECT * FROM TABLE (
          VALUES(1,0)
        )
      ) AS vt(id,ts) ON (ht.id=vt.id)
      WHEN MATCHED THEN 
        UPDATE SET ts=vt.ts
      WHEN NOT MATCHED THEN 
      INSERT (id, ts) VALUES(vt.id,vt.ts); 
      
    • Update data

      UPDATE drc.heartbeat SET ts=%d WHERE id=1
      

    Create and update a heartbeat table in a PostgreSQL database

    • Create a heartbeat table

      CREATE TABLE IF NOT EXISTS public.oms_postgres_heartbeat (id int NOT NULL DEFAULT 1, ts int DEFAULT NULL, PRIMARY KEY (id));
      
    • Insert data

      INSERT INTO public.oms_postgres_heartbeat VALUES (1,0) ON CONFLICT (id) DO UPDATE SET ts=0;
      
    • Update data

      UPDATE public.oms_postgres_heartbeat SET ts=%d WHERE id=1;
      

    Previous topic

    Instructions on schema migration
    Last

    Next topic

    Change the topic
    Next
    What is on this page
    Background
    Prerequisites
    MySQL database
    PostgreSQL database
    Create and update a heartbeat table in a MySQL database
    Create and update a heartbeat table in a DB2 LUW database
    Create and update a heartbeat table in a PostgreSQL database