3. 在线扫描

提供web页面,上传需要扫描的文件,评估完成后自动下载得到兼容性报告。

配置文件 application.yaml 中配置项 scanSourceonline 时,即为 在线扫描模式

3.1. 配置application.yaml

server:
  port: 8766
  tomcat:
    max-swallow-size: 100MB #重要的一行,修改tomcat的吞吐量

配置文件中,server.port表示服务的端口号,其余勿动

3.2. 使用

运行jar包(命令:java -jar LtMigrateAssist.jar),打开对应的页面(如:http://127.0.0.1:8766/),页面如下

image-2023103100001

使用说明见页面上Notice,目前支持扫描sql、xml文件,可支持扫描jar中java文件的mybatis注解。

3.3. 在线API

  • 接口名 /webChecker/processSql

  • 参数说明

    入参的格式为List[],其中元素为对象,字段如下

    字段名

    字段类型

    允许空

    层级

    集合

    字段类型

    sql

    String

    1

    sql片段

    targetDBType

    String

    1

    支持的数据库类型

    descriptionLength


    Integer




    1




    匹配到SQL的长度,为空则显示30,传值,例如传100,处理字符串,
    首先SQL的长度,大于100,取字符串前后各50个字符,中间用… 替换,
    小于100,就不处理
    allLength

    Integer


    1


    默认值为80,会将匹配到SQL长度前移和后移
    (allLength-descriptionLength)的长度

    targetDBType可传参数见下表格为:

    参数

    含义

    Oracle-to-LightDB-Oracle

    Oracle适配LightDB的Oracle模式

    Oracle-to-LightDB-MySQL

    Oracle适配LightDB的MySQL模式

    Oracle-to-LightDB-PostgreSQL

    Oracle适配LightDB的PostgreSQL模式

    Oracle-to-PostgreSQL

    Oracle适配PostgreSQL数据库

    Oracle-to-OBOracle

    Oracle适配OceanBase的Oracle模式

    Oracle-to-OBMySQL

    Oracle适配OceanBase的MySQL模式

    Oracle-to-TDMySQL8

    Oracle适配TDSQL MySQL8模式

    Oracle-to-TDMySQL57

    Oracle适配TDSQL MySQL5.7模式

    Oracle-to-DM8

    Oracle适配达梦8数据库

    Oracle-to-openGauss

    Oracle适配openGauss 5.0数据库

    Oracle-to-GaussDB-Oracle

    Oracle适配GaussDB的Oracle模式 3.x版本数据库

    MySQL-to-LightDB-MySQL

    MySQL适配LightDB的MySQL模式

    MySQL-to-DM8

    MySQL适配达梦8数据库

    MySQL-to-OBMySQL

    MySQL适配OceanBase的MySQL模式

    MySQL-to-openGauss

    MySQL适配openGauss 5.0数据库

    MySQL-to-TDSQL-PostgresSQL

    MySQL适配TDSQL-PostgreSQL数据库

  • 入参示例

[
        {
                "sql":"select sname,xmlagg(xmlparse(content hobby ||','wellformed)order by hobby).getclobval() from student group by sname;",
                "sourceDbType":"",
                "targetDbType":["Oracle-to-PostgreSQL"],
                "descriptionLength": 10,
                "allLength": 12
        },
        {
                "sql":"select sname,xmlagg(xmlparse(content hobby ||','wellformed)order by hobby).getclobval() from student group by sname;",
                "sourceDbType":"",
                "targetDbType":["Oracle-to-OBOracle"],
                "descriptionLength": 60
        },
        {
                "sql":"select sname,xmlagg(xmlparse(content hobby ||','wellformed)order by hobby).getclobval() from student group by sname;",
                "sourceDbType":"",
                "targetDbType":["Oracle-to-OBMySQL"],
                "descriptionLength": 50
        }
]
  • 响应示例

[
        {
                "success": true,
                "errorMessage": "OK",
                "issues": [
                        {
                                "description": "[函数校验]第1个语句 包含不兼容目标数据库[Oracle-to-PostgreSQL]函数: ,xmlagg(x不兼容,用于检测的正则【\\bxmlagg\\s*\\(】",
                                "advise": "pg暂不支持",
                                "beginLine": null,
                                "beginCol": null,
                                "endLine": null,
                                "endCol": null,
                                "targetDb": "Oracle-to-PostgreSQL",
                                "sourceSql": "select sname,xmlagg(xmlparse(content hobby ||','wellformed)order by hobby).getclobval() from student group by sname",
                                "level": "intercept"
                        },
                        {
                                "description": "[函数校验]第1个语句 包含不兼容目标数据库[Oracle-to-PostgreSQL]函数: (xmlparse(c不兼容,用于检测的正则【\\bxmlparse\\s*\\(】",
                                "advise": "pg不支持",
                                "beginLine": null,
                                "beginCol": null,
                                "endLine": null,
                                "endCol": null,
                                "targetDb": "Oracle-to-PostgreSQL",
                                "sourceSql": "select sname,xmlagg(xmlparse(content hobby ||','wellformed)order by hobby).getclobval() from student group by sname",
                                "level": "intercept"
                        },
                        {
                                "description": "[函数校验]第1个语句 包含不兼容目标数据库[Oracle-to-PostgreSQL]函数: .getclobval(不兼容,用于检测的正则【\\bgetclobval\\b】",
                                "advise": "推荐使用lt-Oracle",
                                "beginLine": null,
                                "beginCol": null,
                                "endLine": null,
                                "endCol": null,
                                "targetDb": "Oracle-to-PostgreSQL",
                                "sourceSql": "select sname,xmlagg(xmlparse(content hobby ||','wellformed)order by hobby).getclobval() from student group by sname",
                                "level": "intercept"
                        }
                ]
        },
        {
                "success": true,
                "errorMessage": "OK",
                "issues": [
                        {
                                "description": "[函数校验]第1个语句 包含不兼容目标数据库[Oracle-to-OB-Oracle]函数: ect sname,xmlagg(xmlparse(c不兼容,用于检测的正则【\\bxmlagg\\s*\\(】",
                                "advise": "ObOracle暂不支持",
                                "beginLine": null,
                                "beginCol": null,
                                "endLine": null,
                                "endCol": null,
                                "targetDb": "Oracle-to-OBOracle",
                                "sourceSql": "select sname,xmlagg(xmlparse(content hobby ||','wellformed)order by hobby).getclobval() from student group by sname",
                                "level": "intercept"
                        },
                        {
                                "description": "[函数校验]第1个语句 包含不兼容目标数据库[Oracle-to-OB-Oracle]函数: by hobby).getclobval() from st不兼容,用于检测的正则【\\bgetclobval\\b】",
                                "advise": "ObOracle暂不支持",
                                "beginLine": null,
                                "beginCol": null,
                                "endLine": null,
                                "endCol": null,
                                "targetDb": "Oracle-to-OBOracle",
                                "sourceSql": "select sname,xmlagg(xmlparse(content hobby ||','wellformed)order by hobby).getclobval() from student group by sname",
                                "level": "intercept"
                        }
                ]
        },
        {
                "success": true,
                "errorMessage": "OK",
                "issues": [
                        {
                                "description": "[函数校验]第1个语句 包含不兼容目标数据库[Oracle-to-OB-MySQL]函数: select sname,xmlagg(xmlparse(conten不兼容,用于检测的正则【\\bxmlagg\\s*\\(】",
                                "advise": "ObMysql暂不支持",
                                "beginLine": null,
                                "beginCol": null,
                                "endLine": null,
                                "endCol": null,
                                "targetDb": "Oracle-to-OBMySQL",
                                "sourceSql": "select sname,xmlagg(xmlparse(content hobby ||','wellformed)order by hobby).getclobval() from student group by sname",
                                "level": "intercept"
                        }
                ]
        }
]