Statistics during replay are written to the stats-yyyyMMdd-HHmmss.db file (an SQLite file) in the stats.dir directory. This file is generated only when stats.enabled is set to true, which is the default value. Reports can be generated separately after replay ends using the --report option, without restarting the replay process.
Generate a report
java -Xmx2g -jar oma.jar replay --report <stats.db> --format html --top 20 --output replay-report.html
Options |
Default Value |
Description |
|---|---|---|
--report |
None | Specify the stats-<timestamp>.db file |
--format |
text |
Report formats: text, json, csv, and html. If the specified format is not supported, an error message report generation failed: invalid report format: xml is returned along with exit code 2. |
--top |
20 |
Number of Top N Records |
--detail-limit |
20000 |
The maximum number of SQL details that can be embedded in an HTML report.0Indicates no limit. |
--order-by |
target_p90_ms |
Sort field, which is the column name of sql_id_global_stats. If the column does not exist, an error report generation failed: invalid report order-by: not_a_column is returned and exit code 2 is returned. |
--filter-sql-type |
None | Display Specified SQL Types Only |
--output |
Standard Output | Report Written File |
--export-sql-id-global-csv |
None | Exportsql_id_global_statsFull Table CSV with Header |
--export-sql-failures-csv |
None | Exportsql_failure_logFailed SQL Details Full Table CSV with Header |
Statistical content
The stats.db file contains the following tables:
Table |
Content |
|---|---|
replay_run_metadata |
Meta Information of This Run |
replay_stats_snapshot |
Snapshot of the running process statistics |
replay_interval_stats |
Subinterval Statistics |
sql_id_stats |
Sharding statistics by SQL ID |
sql_id_global_stats |
Summary of Execution Count and Time Consumption Distribution by Source/Target for Each SQL ID |
sql_performance_stats |
Performance statistics by statement |
sql_text_performance_stats |
Performance Statistics by Original SQL Statement and MD5 |
slow_sql_log |
Exceedsstats.slowSqlThresholdMsstatements |
sql_failure_log |
Failed Statements, Error Messages, and Corresponding SQL IDs |
transaction_stats |
Transaction Count |
For each row in the sql_id_global_stats table, the columns are in the following order: sql_id, sql_type, sample_sql, sql_text_md5, sample_sql_with_binds, exec_count, source_count, source_sum_ms, source_avg_ms, source_min_ms, source_max_ms, source_p50_ms, source_p90_ms, source_p95_ms, source_p99_ms, target_sum_ms, target_avg_ms, target_min_ms, target_max_ms, target_p50_ms, target_p90_ms, target_p95_ms, target_p99_ms, first_seen_time, last_seen_time, and last_updated_time. Note that the count columns for the two groups are not symmetric: the source has source_count, but the target does not have target_count; the number of executions on the target is taken from exec_count. The default value of --order-by, target_p90_ms, comes from this group of columns. sql_type stores the capitalized value (e.g., Select, Insert); fill in --filter-sql-type accordingly.
The columns in the sql_failure_log table are: id, timestamp, session_id, database_name, sql_id, sql_type, sql_text, error_message, error_code, execution_time_ms, source_file, and original_time.
Report structure
A report in --format text format is divided into the following sections. Sections with no data fixedly display "No data":
General overview:
startTime,endTime,replayed,failed,filtered,avgQps,peakQps,maxSessions,txBegin,txCommit,txRollback.Reconciliation:
inputLines,parsedLines,parseFailedLines,submittedCount.Slow SQL Top N: Filtered by
stats.slowSqlThresholdMs.SQL ID statistics: Output as specified by
--topand--order-by.SQL original text statistics (by database, SQL ID, original text MD5).
Except for the general overview, entries in the text and json sections directly output record content, for example, {sqlType=Select, databaseName=null, executionTimeMs=56986, sqlText=select @@sql_mode}. They are not aligned into tables; use --format csv or --export-sql-id-global-csv if a table is needed.
Reconciliation values come from replay_run_metadata: A replay that completes normally displays all four values; if the process is forcibly terminated before metadata writing is complete, this section displays {inputLines=null, parsedLines=null, parseFailedLines=null, submittedCount=null}. Seeing all null does not mean no run occurred; first check if the status in replay_run_metadata is COMPLETED.
--format json outputs individual objects with keys summary, sqlTextStats, sqlIdStats, reconcile, and slowSql, corresponding to the above five sections. --format csv separates each section with comment lines like # summary and outputs them sequentially. It is recommended to use --format html with --output to write the output to a file.
Interpretation guidelines
Reconciliation fields are inclusive rather than parallel:
inputLinesis not less thanparsedLines,parsedLinesminusparseFailedLinesand filtered statements equals thesubmittedCountthat enters execution.replayedcounts the actual number of statements submitted for execution.Dry run (
--dry-run) does not execute the target database. In this case, the statistics files contain only the runtime-level data from the three tablesreplay_run_metadata,replay_stats_snapshot, andreplay_interval_stats. Tables per statement such assql_id_stats,sql_id_global_stats,slow_sql_log,sql_failure_log, andtransaction_statsare all empty, leaving only the general overview and reconciliation in the report. Such results can only verify the link and cannot be used as comparative data.source_*time comes from event fields logged in logs, whiletarget_*time is the measured value from this replay. The two have different data sources. Before direct comparison, confirm that the target database's data scale, table structure, and statistical information are comparable to the source. If the source logs do not contain timing formats (such asPLAIN_SQL),source_countandsource_*_mswill all be 0, which is not considered missing data; however, whethersource_*is credible also depends on the unit conversion of the source timing column, see Log parsing.target_includes network round-trip time and connection pool wait time, not just executor time. Direct connections toobserverand connections through OBProxy will yield different percentile values. Before cross-tenant or cross-specification replay, use a small sample to establish a consistent baseline.Before comparing two replays, ensure both completed normally: Different numbers of runs due to forced terminations can cause percentile deviation, with low-frequency statements'
target_p90_msbeing more affected; high-frequency statements' percentiles are relatively stable. Statements with few executions have unstable percentiles. When comparing, prioritize rows with similarexec_countand orders of magnitude in execution count.This report is suitable for identifying failed statements and SQL with significantly amplified execution time. The time of a single replay is influenced by data distribution, concurrency, connection pool configuration, and target tenant specifications, and does not equate to a performance test baseline. To draw performance conclusions, replay the experiment in an independent environment with continuous traffic and a fixed baseline.
For more information about replay operations, see Replay execution. For supported source ranges and usage limitations, see Performance assessment overview. For scenario-specific entry points, see Assess the performance difference between Oracle Database and OceanBase Database, Assess the performance difference between MySQL Database and OceanBase Database, and Assess the performance difference between different versions of OceanBase Database.