OceanBase
English日本語简体中文
Docs Home
Products
Integrations
Release Notes

Databases

OceanBase DatabaseOceanBase AI DatabaseOceanBase Cloud OceanSeekOceanBase Best Practices

Tools

OceanBase Cloud PlatformOceanBase Migration ServiceOceanBase Developer CenterOceanBase Migration AssessmentOceanBase Admin ToolOceanBase Loader and DumperOceanBase DeployerKubernetes operator for OceanBaseOceanBase Diagnostic Tool OceanBase Binlog ServiceOceanBase DataPilotOceanBase OAgent

Connectors and Middleware

OceanBase Database Proxy OceanBase Connector/C OceanBase Connector/J OceanBase Connector/ODBC OceanBase Connector/NETOceanBase Command-Line Client

Databases

OceanBase DatabaseOceanBase AI DatabaseOceanBase Cloud OceanSeekOceanBase Best Practices

Connectors and Middleware

OceanBase Database Proxy OceanBase Connector/C OceanBase Connector/J OceanBase Connector/ODBC OceanBase Connector/NETOceanBase Command-Line Client

Tools

OceanBase Cloud PlatformOceanBase Migration ServiceOceanBase Developer CenterOceanBase Migration AssessmentOceanBase Admin ToolOceanBase Loader and DumperOceanBase DeployerKubernetes operator for OceanBaseOceanBase Diagnostic Tool OceanBase Binlog ServiceOceanBase DataPilotOceanBase OAgent
OceanBase DatabaseOceanBase Cloud ToolsConnectors and MiddlewareLifecycle Support Policy

OceanBase Migration Assessment

V5.0.0Enterprise Edition
  • What's New
  • Product Introduction
    • Overview
    • Application scenarios
  • Install OMA
  • Compatibility assessment
    • Overview
    • System architecture
    • Product form
    • Object and Metadata Assessment
    • Assess SQL statement compatibility
    • Sybase ASE assessment
    • Custom rules
    • Database assessment
      • Overview of Database Assessment
      • Assess an Oracle database
      • Assess a MySQL database
      • Assess a TiDB database
      • Assess a PostgreSQL database
    • SQL execution verification
    • Mapper Scan Audit
    • Special Identification and Declaration Association
  • Performance assessment
    • Standalone edition
      • Overview
      • System architecture
      • Product form
      • Assess the performance difference between an Oracle database and an OceanBase database
      • Assess the performance differences between a MySQL database and an OceanBase database
      • Assess the performance differences between different versions of OceanBase Database
      • Log parsing
      • Replay execution
      • Performance statistics and reports
  • Release Notes
    • OMA V5.0.0

Download PDF

Document Feedback
  1. Documentation Center
  2. OceanBase Migration Assessment
  3. V5.0.0

Replay execution

Last Updated:2026-11-27 06:14:19

Command form
Option description
Configuration file search order
Configuration structure
Configuration example
Common configuration errors
Mock replay
Dry-run diagnostic report
Live replay
Which database is connected for each session
End and cleanup of replay
Quick troubleshooting for runtime errors
Sharding and Resuming Playback

The oma replay command reads the CANONICAL_JSONL event stream, replays it to the target OceanBase Database as configured, and accumulates statistics. Log parsing must be completed before replaying. For supported source ranges, see Performance assessment overview.

Command form

java -Xmx2g -jar oma.jar replay -c <configuration file> [--dry-run] [--output-format json]

Option description

Options
Default Value
Description
-c, --config ./config.json JSON Configuration File Path
--dry-run Off Only performs parsing, filtering, conversion, and timing control; skips database execution
--read-only Off Read-only mode, which replays only SELECT statements and disables transactions and DDL. Events excluded by this mode are counted in Filtered Quantity, and the filtering reason is recorded as FILTERED_BY_SQL_TYPE.
--output-format text Output format:textorjson
--verbose Off Output DEBUG-level logs
--replayer-count Configuration Value Overwritereplay.replayerCount, the total number of processes participating in the replay (the base for directory hash modulo), must be greater than or equal to 1.
--replayer-index Configuration Value Overwritereplay.replayerIndex, the current process number, which must be greater than or equal to 0 and less than the total number of processes.
--start-time None Start filter time, in the format of"yyyy-MM-dd HH:mm:ss", which takes precedence over the resume time recorded in the checkpoint. Seconds are not compared; runtime is accurate to only minutes.
--report None Generates a report only for existing statistical files without starting playback. For more information, see Performance statistics and reports.
-h, --help、--version None View Help and Version

Configuration file search order

  1. The path specified by -c.
  2. ./config.json in the current directory.
  3. ~/.oceanbase-replay/config.json in the user's home directory.
  4. The built-in classpath:config.json of the program.

Configuration structure

The configuration is in JSON format. The top-level groups are s3, database, replay, filters, sqlKeywordFilter, sqlTransform, sqlMapping, checkpoint, and stats.

Group
field
Description
s3 logPath Event stream input path, must include the scheme prefix: file:///absolute_path for local directories, or s3://… or oss://… for object storage. An empty value will trigger the error "s3.logPath configuration cannot be empty"; an absolute path without a prefix will be identified as non-local storage, triggering the error "s3.endpoint configuration cannot be empty (required in S3/OSS mode)".
s3 logFormat Input format. Leave this parameter empty for the parsed result.CANONICAL_JSONL; Other optionsTIDB_AUDIT、TIDB_AUDIT_V2、KEY_VALUE、GENERAL_LOG
s3 endpoint、region、bucketName、accessKey、secretKey、connectionTimeout、readTimeout、maxRetries、s3ReadBackoffInitialMs、s3ReadBackoffMaxMs、subdirPrefix、subdirCount Read input from object storage. The storage type is specified by thelogPathPrefix determination, no independentstorageTypeParameter;s3://andoss://NextendpointandbucketNameRequired
database host、port、username、password、database、tenantMode Target connection information.tenantModeTakeMYSQLorORACLE; The port for connections through OBProxy is typically 2883.
database jdbcUrl、jdbcParameters、userMappings Custom connection string and connection parameters.userMappingsMaps the target credentials (obtained from the event's) to the initial database name/schema of the session as the key.databaseField. If empty, use the default value.database.database), which containsusernameandpassword; used when the key is not hitdatabase.username、database.password. The match key is the database name, not the source username.
database poolInitialSize、poolMaxActive、poolMinIdle、poolMaxWait Connection Pool Size and Wait Strategy
replay replayMode Replay mode. Only FULL_SPEED, TIME_BASED, RATE_LIMITED, and TIME_BASED_LIMITED are supported. Other values will result in the error message replayMode only supports FULL_SPEED, TIME_BASED, RATE_LIMITED, TIME_BASED_LIMITED.
replay rateLimitQps、timeBasedMaxWaitMs The target QPS for rate limiting. It indicates the maximum wait time in milliseconds for a single step during chronological replay.
replay dynamicInput Whether to Continuously Read New Inputs
replay replayerCount、replayerIndex Total number of processes and current process number. Command-line options take precedence over configuration. An out-of-range number will result in a parameter error. For details, see "Common configuration errors".
replay bufSize、commandBufferCapacity、queueMaxPending、sessionQueueCapacity、pollTimeoutMs、drainTimeoutSeconds Read Buffer, Command Queue, and Final Wait
replay abortThreshold Replay stops when the failure count reaches this threshold.
replay sessionTimeoutMs、reconnectDelayMs、maxReconnectAttempts、strictSessionLifecycle Session Keepalive, Reconnection on Disconnection, and Strict Session Lifecycle Mode
replay psMode.enabled、psMode.cacheMaxSize Prepared Statement Mode and Statement Cache Upper Limit
filters allowedSqlTypes、enableDDL、transactionEnabled List of allowed SQL types, whether to replay DDL statements, and whether to replay transactions
filters useWhitelist、whitelistDatabases、blacklistDatabases、excludedUsers Database and user filtering. The allowlist switch determines which list to use.
sqlKeywordFilter useWhitelist、whitelistKeywords、blacklistKeywords Filter by SQL keywords
sqlTransform removeTiFlashHints、removeTidbRowid、transformBatchStatements、customRules Statement preprocessing: Remove TiFlash hints, remove TiDB ROWIDs, and split batch statements.customRules(pattern、replacement(List) The current version only supports configuration definition and does not integrate with the execution pipeline. Configurations will not take effect after being set.
sqlMapping enabled、filePath、mappings Statement rewrite mapping. The actual effective link is loaded from an independent mapping file:filePathSpecify the path. If not specified, environment variables will be used in sequence.SQL_MAPPING_FILE, Defaultconfig/sql-mappings.json), match the entire statement by its MD5 fingerprint and replace it as a whole. The entry'senabledDecides whether to take effect. Top-levelenabledNot read in the execution link, set tofalseCannot prevent enabled entries in the mapping file from taking effect. Inlinemappings(pattern、replacement(List) The current version only supports configuration definition and has not connected the execution link. The configuration will not take effect after being set.
checkpoint filePath、saveIntervalMs The checkpoint save path and save interval.filePathIt only determines where the checkpoint is written. When loading progress, it reads from the directory where the execution command is located.checkpoint.json, they may not be the same file. For more information, see "Sharding and resuming runs".
stats enabled(Default:false)、dir(Default:stats)、flushIntervalSec(Default:5)、slowSqlThresholdMs(Default:1000)、sourceLabel、targetLabel Statistics switch, output directory, disk persistence interval, slow SQL threshold, and source label in the report.enabledisfalseNo statistical files are generated during this time;dirWhen it is a relative path, it is relative to the current directory where the command is executed.

Configuration example

The configuration for simulated replay is as follows, with target connections as placeholders:

{
  "s3": {
    "logPath": "file:///abs/path/work/rds-canonical",
    "logFormat": "CANONICAL_JSONL"
  },
  "database": {
    "host": "127.0.0.1",
    "port": 2883,
    "username": "root",
    "password": "",
    "database": "test",
    "tenantMode": "MYSQL"
  },
  "replay": {
    "replayMode": "FULL_SPEED",
    "dynamicInput": false
  },
  "filters": {
    "transactionEnabled": false,
    "enableDDL": false,
    "allowedSqlTypes": ["SELECT"]
  },
  "sqlMapping": {
    "filePath": "/abs/path/work/sql-mappings.json"
  },
  "checkpoint": {
    "filePath": "/abs/path/work/checkpoint.json"
  },
  "stats": {
    "enabled": true,
    "dir": "/abs/path/work/stats"
  }
}

The mapping file is a JSON object. The keys are the MD5 fingerprints of the original SQL statements, and the values contain the following fields:

{
  "<MD5 of original SQL>": {
    "sqlFingerprint": "<MD5 of original SQL>",
    "originalSql": "<Original statement>",
    "mappedSql": "<Replaced statement>",
    "description": "<Remarks>",
    "enabled": true,
    "createdTime": "2026-11-01T00:00:00",
    "updatedTime": "2026-11-01T00:00:00"
  }
}

When no statement rewriting is needed, set filePath to a non-existent file or an empty mapping file with content {}. Do not rely on sqlMapping.enabled=false to prevent rewriting; this switch is not read during execution.

Common configuration errors

The program exits during startup if the configuration is invalid. Common configuration errors include:

The s3.logPath configuration cannot be empty.
The s3.endpoint configuration cannot be empty (required in S3/OSS mode).
replayMode only supports the values FULL_SPEED, TIME_BASED, RATE_LIMITED, and TIME_BASED_LIMITED.
Parameter error: replayerIndex must be within the range [0, replayerCount).

The corresponding causes are as follows: the configuration file is empty or s3.logPath is not specified; logPath does not have a scheme prefix; replayMode has an invalid value; the shard index exceeds the total number of shards.

Mock replay

First, use --dry-run to verify parsing, filtering, and the time-series link:

java -Xmx2g -jar oma.jar replay -c work/dry-run.json --dry-run --output-format json
  • In this mode, no connection is established to the target database, and no execution occurs. Configuration parameters such as host and port can be placeholder values.

  • It is recommended to select only SELECT and disable DDL and transactions, which is consistent with the example configuration.

  • The program starts an internal HTTP service that listens on port 9080 by default. The operating system must allow local listening. If the process continues listening after processing is complete, you can exit normally by pressing Ctrl+C.

  • If sqlMapping.filePath is not configured, the program sequentially checks the environment variable SQL_MAPPING_FILE and the default path config/sql-mappings.json. If this file does not exist, it runs with an empty mapping and automatically creates the file in the current directory upon exit. To avoid generating an extra file, explicitly point it to an existing one.

  • A "successful" mock replay only indicates that events were processed correctly and does not guarantee that SQL statements can be executed in OceanBase.

Dry-run diagnostic report

After the run completes, a diagnostic report for reconciliation is printed. The fields and their meanings are as follows:

field
Meaning
Total Log Lines Number of Rows of Events Read
Parsing succeeded / Parsing failed Deserialized event results. The sum of these two values equals Total log lines.
Number of Filters Events Excluded by Filter Rules, Read-only Mode, or Keyword Filtering
Filter reason Filter details counted by cause code, such as those in read-only mode.FILTERED_BY_SQL_TYPE
SQL Mapping Hit / SQL Translation Hit Events Hit by Rewrite Rules
Estimated Parsing QPS Throughput reference value in parsing phase
SQL Type TopN / Database TopN / User TopN / Table TopN Event distribution,nullwill appear as a group
Number of Outliers Number of Events with Exceptions During Parsing or Transformation

You can reconcile the Total log lines with the number of output events from Log parsing, and the Successfully parsed count with the number of commits in the subsequent replay. If these three do not match, first check if other formats are mixed in the input directory or if any events were skipped.

Live replay

Before performing a live replay, ensure the following conditions are met; otherwise, statements will fail due to missing tables, missing databases, or data mismatch:

  1. Accessible target OceanBase tenant address, port, username, password, and necessary permissions.
  2. Database and table structures involved in the logs, along with initial data that meets query conditions. Logs are not database backups and cannot replace data migration.
  3. Database name mapping or filtering rules. The same log may involve multiple source database names; confirm they can be mapped to target databases.
  4. Independent replay configuration, checkpoint directory, and statistics directory.

Replace the target connection with actual values and verify the mapping, then remove --dry-run and execute java -Xmx2g -jar oma.jar replay -c <actual configuration>. It is recommended to first limit the queries to a small number of SELECT statements to verify in a test database, then gradually increase the volume. Historical logs usually also contain INSERT, DDL, and management statements.

To determine which databases and objects need to be preconfigured, you can first use the mock replay to look at the diagnostic report's Top N Databases, Top N Tables, and Top N SQL Types: For samples primarily containing probe-active statements and metadata queries, only the databases involved in the logs need to be created. For samples containing business table queries, table structures and data that meet query conditions are also required; otherwise, statements can execute but return an empty set, and target_* execution times cannot represent real load.

Which database is connected for each session

In a live replay, the target database for each session connection is determined by the event, which is counterintuitive:

  • In MYSQL mode, the database to connect to is taken from the event's own database field. database.database is only used to count target_endpoint records in the database and does not participate in constructing the connection string. When the source log's database name is empty, this field is set to the string "null" (not the JSON null), and the connection string becomes jdbc:oceanbase://127.0.0.1:2883/null, which manifests as an error indicating the database cannot be found when the connection database name is null, with 0 successful events submitted. To resolve this, use filters.useWhitelist with filters.whitelistDatabases to exclude non-existent database names, allowing normal replay.

  • In ORACLE mode, the connection string does not include a database name. If database.database is missing by default, it defaults to test. In an OceanBase Oracle-compatible tenant, there is no test database, so an error is reported for its absence. After retries are exhausted, the top-level prompt only shows "Replay failed, target transaction results may be uncertain," which is unrelated to the actual cause. For Oracle-compatible tenant replay, explicitly configure database.database, for example, by setting it to SYS.

  • Idle detection statements for the connection pool differ by tenantMode: SELECT 1 FROM DUAL for ORACLE and SELECT 1 for MYSQL.

End and cleanup of replay

  • After input processing is complete, the main thread initiates a graceful shutdown, performing seven steps in sequence: stop the replay service, wait for the queue to clear, save the checkpoint, close the connection pool, close the queue manager, refresh statistics and Kafka, and output the runtime summary. The process exits automatically upon completion without requiring manual intervention.

  • The fields in the runtime summary are Total Processed, Success, Failed, Current QPS, Avg Exec Time, Queue Depth, Active Conns, and Elapsed Time. During submission, there are also ReplayScheduler Submitted: N, Rejected: N. The difference between the number of submitted events and Total Processed represents events that are in transit and have not been replayed.

  • For multi-session, cross-database replays, after all events are submitted, Total Processed may stop increasing, Queue Depth may be 0, but Active Conns may not zero out. In this case, press Ctrl+C to trigger the same seven-step cleanup sequence. The log will prompt "Press Ctrl+C again to force exit (unsaved data may be lost)."

  • Forced termination (kill -9) skips the cleanup: the checkpoint stops at the last automatic save time, the status in the statistics database replay_run_metadata stops at RUNNING, ended_at is empty, and the "Replay reconciliation" section in the report becomes all null, as described in Performance statistics and reports.

Quick troubleshooting for runtime errors

Corresponds to the following scenarios:

  • Event database is the string "null" (an error indicating the database cannot be found when the connection database name is null). Use a database whitelist to exclude this.
  • Samples contain queries for information_schema.EVENTS, which OceanBase does not support. This is an expected failure. For large volumes, rewrite or filter using sqlMapping.
  • An Oracle-compatible tenant is not configured with database.database, which defaults to test, resulting in an error indicating the database cannot be found. See "Which database is the session connected to".

Sharding and Resuming Playback

  • When a single process handles large-scale events, use --replayer-count to specify the total number of processes and --replayer-index to specify the index of the current process. The total number of processes must be the same, and their indices must be unique. Unlike --worker-count in Log Parsing, this set of options does take effect during playback. However, shards are not split in the order of shard_N indices: each input subdirectory is hashed with its absolute path using the FNV-1a 64-bit hash function, then modulo replayerCount. Only the directories whose remainder equals the current process's replayerIndex are read by that process.

  • Therefore, replayerCount does not need to equal the --shards value used during parsing: it only determines the base for the hash modulo operation and has no direct correspondence with the number of directories. If replayerCount is greater than the number of shards, some processes may run idle without any directories; if it is less, one process will handle multiple directories. When replayerCount is 1, a single process handles all directories.

  • All processes participating in the same round of local playback must use the same layout of absolute input paths and the same replayerCount (each process has a unique index, consecutively covering from 0 to replayerCount - 1). Attribution is determined by path string hashing. If the absolute path of the same directory varies across different machines (due to different mount points or working directories), it will be assigned to different processes, leading to duplicate playback or missed shards.

  • Playback progress is recorded in checkpoint files, with the shard_N in the input directory as the key. Each shard contains lastProcessedTime, lastProcessedSequence, and lastSavedTime. A checkpoint is considered usable if it meets all the following criteria: sourcePath matches the current s3.logPath, logFormat is consistent, and at least one shard's lastProcessedSequence is greater than 0 and has a lastProcessedTime.

  • When loading a checkpoint, the system reads the checkpoint.json file located in the directory where the execution command resides, not the file specified by checkpoint.filePath. If a checkpoint.json file exists in the runtime directory, it is loaded and the completed portion is skipped based on the shard progress. The new progress is written to the file specified by filePath. If no checkpoint.json file exists in the runtime directory but one exists at the path specified by filePath, that checkpoint is still not loaded, and a full replay is performed.

  • Therefore, always execute oma replay from the same directory and set checkpoint.filePath to point to the checkpoint.json file within that directory to avoid reading from A and writing to B. When you need to restart from the beginning, remove the checkpoint.json file from the runtime directory.

  • --dry-run does not persist checkpoints to disk, so resume playback behavior can only be verified during actual playback.

  • --start-time specifies the start time to skip already processed periods, and it has a higher priority than the resume time recorded in checkpoints. This time only applies during the execution scheduling phase and does not affect the number of events read for the diagnostic report.

For information on viewing playback results, see Performance statistics and reports.

Previous topic

Log parsing
Last

Next topic

Performance statistics and reports
Next
on this page
Command form
Option description
Configuration file search order
Configuration structure
Configuration example
Common configuration errors
Mock replay
Dry-run diagnostic report
Live replay
Which database is connected for each session
End and cleanup of replay
Quick troubleshooting for runtime errors
Sharding and Resuming Playback