Background information
OMA can assess statements in SQL text, MyBatis, and iBATIS files. You should select the source dialect and a valid target mode based on the actual statements. Common file formats supported are .sql, .ddl, and .txt. You can input a single file or recursively scan a directory. The --source-format option supports the following inputs:
--source-format |
Description |
|---|---|
sql |
SQL/DDL text, accepts.sql、.ddl、.txt, single file or recursive directory |
mybatis |
MyBatis Mapper XML |
ibatis |
iBATIS Mapper XML (Unified to Mapper assessment link) |
SQL text scanning processes terminators and dialect bodies line by line. The batch separator for SQL Server supports independent GO lines, while the process body for Oracle supports independent / lines.
Assess SQL statement compatibility via TEXT files
Assess Oracle-compatible mode
java -jar oceanbase-compat-engine.jar compat \
--mode full --task-name oracle_sql \
--type file --source-type oracle --source-format sql \
--source /data/oma/input.sql \
--target oceanbase-oracle --target-ob-version 4.4.2 \
--report-lang zh --output /data/oma/reports/oracle-sql.html
Assess MySQL-compatible mode
java -jar oceanbase-compat-engine.jar compat \
--mode full --task-name mysql_sql \
--type file --source-type mysql --source-format sql \
--source /data/oma/mysql-sql \
--target oceanbase-mysql --target-ob-version 4.4.2 \
--report-lang zh --output /data/oma/reports/mysql-sql.html
Files in the example directory will be scanned recursively. Regular files retain their source path relative to the root scan directory, and identified CREATE objects have their object type and name recorded.
The assessment commands for other dialects (mariadb, postgresql, sqlserver, tidb) follow the same format as above. Replace --source-type and select the target mode as described in Overview of compatibility assessment, for example:
java -jar oceanbase-compat-engine.jar compat \
--mode full --task-name pg_sql \
--type file --source-type postgresql --source-format sql \
--source /data/oma/pg-sql \
--target oceanbase-mysql --target-ob-version 4.4.2 \
--report-lang zh --output /data/oma/reports/pg-sql.html
Assess SQL statement compatibility via MyBatis files
Source path configuration
Use --source-format mybatis. You can specify a single Mapper file or the root directory with --source. If cross-file includes exist, the related files should be included in the same scan scope.
java -jar oceanbase-compat-engine.jar compat \
--mode full --task-name mybatis_sql \
--type file --source-type mysql --source-format mybatis \
--source /data/oma/mappers \
--target oceanbase-mysql --target-ob-version 4.4.2 \
--report-lang zh --output /data/oma/reports/mybatis-sql.html
Dynamic SQL and fragments
The system parses Mapper namespaces, SQL statements, and referenced fragments, expanding dynamic tags such as include, if, choose, where, set, trim, and foreach. selectKey is collected independently, identified with the parent statement ID plus !selectKey.
The maximum expansion depth for dynamic paths is 256. When exceeded, only the limited path is retained, along with the override pattern and diagnostics recorded; not executing the complete Java/OGNL business runtime does not mean all actual parameter combinations have been exhausted.
Assess SQL statement compatibility via iBATIS files
Use --source-format ibatis, and fill in the remaining parameters according to the source dialect and target mode:
java -jar oceanbase-compat-engine.jar compat \
--mode full --task-name ibatis_sql \
--type file --source-type oracle --source-format ibatis \
--source /data/oma/ibatis \
--target oceanbase-oracle --target-ob-version 4.4.2 \
--report-lang zh --output /data/oma/reports/ibatis-sql.html
The iBATIS format is processed via the Mapper assessment pipeline, supporting iBATIS condition tags, dynamic, and iterate structures. For Mapper XML, you must select mybatis or ibatis.
View the assessment report
Open the specified HTML report to view issues and sources. Mapper tasks also output scan audits. When fragments are missing, partially expanded, or parsing is incomplete, you should check the coverage against the audit ledger. For the ledger file list and statistical criteria, see Mapper scan audit.