This topic describes how to replay the actual traffic of an Oracle database to an Oracle-compatible tenant of OceanBase Database and compare the execution times at the source and target. For command parameters, see Log parsing and Replay execution, and for statistical fields, see Performance statistics and reports.
Input preparation
Method |
-fValue |
Description |
|---|---|---|
| Oracle Load Capture File | ORACLE_WCR |
The external plugin is responsible for parsing. Ensure the plugin directory has been loaded. The plugin handles the decoding of bound variables and types in the capture file. The coverage is subject to the implementation of the plugin. |
| Statement Text | PLAIN_SQL |
Only the statement list is provided, without source-side execution time or real-time timing. Only target-side execution time and results are available: In the event thatcostTimeMicrosis-1, no outputuseranddatabase, the report'ssource_*All columns are 0 |
When you need to compare the execution time at the source, set ORACLE_WCR. If an input event does not contain a time field, the corresponding source_ statistic in the report is empty, and only the data from the target is displayed.
Procedure
Parse the logs. The source Oracle database uses
--source-typeto record the source type. This field is not validated during format checking when writing events.java -Xmx2g -jar oma.jar analyze \ -f ORACLE_WCR --plugins-dir ./plugins \ -s ./capture/oracle-wcr -o ./work/oracle-canonical \ --source-type oracle --shards 4 --max-threads 4Configure the replay. When the target is an Oracle-compatible tenant, set
database.tenantModetoORACLE. The program usesSELECT 1 FROM DUALto verify the connection. Tenant and cluster information is included indatabase.usernameaccording to the standard OceanBase connection syntax; there is no separate tenant field in the configuration.database.databasemust be explicitly specified (for example,SYS). By default, the program attempts to connect to a database namedtest. If this database cannot be found in the Oracle-compatible tenant of OceanBase Database, an error is reported, and only "Replay failed, target transaction results may be uncertain" is displayed at the top. For specific reasons, see the description about database connections in Replay execution.Use
--dry-runto verify the link and confirm that the number of events, filtered results, and timing meet expectations.Remove
--dry-runto perform a live replay. It is recommended to first usefilters.allowedSqlTypesto restrictSELECTstatements. After testing in the test database, then allow write statements and transactions.Generate a report.
java -Xmx2g -jar oma.jar replay --report ./work/stats/stats-<timestamp>.db \ --format html --top 50 --output oracle-ob-report.html
Prerequisites on the target side
You have created an Oracle-compatible tenant and imported the object definitions such as tables, views, sequences, and synonyms involved in the logs. For static compatibility issues with objects and statements, it is recommended to first use Overview of compatibility assessment to troubleshoot and reduce replay failure noise.
The data volume and the initial data that meets query conditions need to be comparable to those at the source. Logs are not a database backup and cannot replace data migration.
The target user has the necessary privileges to execute replay statements. When multiple source schemas require different target credentials, use
database.userMappingsto map based on the initial database name/schema of the session (the matching key is not the source username). For scope convergence, usefilters.whitelistDatabases,filters.blacklistDatabases, orsqlKeywordFilter.
Result interpretation
Columns such as
source_p90_msandsource_p99_mscontain the execution time at the source recorded in the capture file. Thetarget_columns represent the results of this live replay test. For each failed statement and error, seesql_failure_log.The default sorting field is
target_p90_ms, which directly gives the slowest statement at the target. The magnification ratio needs to be calculated based on paired percentiles; the report does not directly provide a "performance difference percentage" conclusion.