SCA 全称 SQL Compatibility Analyzer。用于评估源数据库中的实际业务 SQL 在目标库中是否能正常执行,以及评估异构数据库中 SQL 的实际性能差异。
本工具目前支持三种源端数据库,包括: Oracle, MySQL, DB2的数据库到MogDB(以及其他基于 openGauss 的数据库)的兼容性分析,PostgreSQL数据库也可以支持,但是效果不如MogDB/openGauss。
工具下载地址为:https://docs.mogdb.io/zh/sca/v5.1/release-notes
相关文档:https://docs.mogdb.io/zh/sca/v5.1/overview
1.license.json
获取软件license.json,填入邮箱后,会发送到邮箱,之后放到和sca的同级目录。
./sca_linux_x86_64 -T L
复制
2.初始化资料库
sca工具需要一个MogDB数据库做中间资料库,存放兼容性相关信息。这里test_usr 用户需要提前在MogDB数据库创建,其余的sca_db为在资料库初始化的库,sca_repo 是资料库里初始化的用户,这两个会自己创建。
[mog@node1 sca]$ ./sca_linux_x86_64 -T i -H 172.20.10.7 -P 29000 -N sca_db -U sca_repo -E 'SCA@password' --user test_usr --password test@123 2022-06-21 18:19:53.804247 INFO [runMe.py:337] Run steps from [1:load] to [7:excel_report] 2022-06-21 18:19:53.804304 INFO [runMe.py:381] Get license file [./license.json] 2022-06-21 18:19:53.820971 INFO [runMe.py:383] License verification succeed 2022-06-21 18:19:53.821015 INFO [runMe.py:391] Begin init repository 2022-06-21 18:19:54.028275 INFO [Repo.py:33] Create role/database 2022-06-21 18:19:55.731424 INFO [Repo.py:41] Switch to repository database 2022-06-21 18:19:55.837994 INFO [Repo.py:49] Init objects in repository 2022-06-21 18:19:56.617978 INFO [Repo.py:53] Init successfully
复制
3.oracle数据采集
oracle端用户授权,这个用户负责通过视图查询数据库里跑着的一些SQL,和相关表结构。
create user test_usr identified by "test123" ; grant connect to test_usr; grant SELECT ANY DICTIONARY to test_usr; grant CREATE PROCEDURE to test_usr; grant EXECUTE ON DBMS_LOB to test_usr; grant SELECT ON GV_$SQL_PLAN to test_usr;
复制
采集一次用(测试)
这里172.20.10.9的IP为ORACLE端的IP,-s test_usr 为数据采集的schema,-n prod指定了ORACLE端的实例名,-u test_user为刚才的用户,-e test123为密码,-q 0.001 -Q 60表示采集一次。
[mog@node1 sca]$ ./sca_linux_x86_64 -T OC -s test_usr -h 172.20.10.9 -p1521 -n prod -u test_usr -e test123 -q 0.001 -Q 60 -m off -d data 2022-06-21 18:55:43.010240 INFO [runMe.py:337] Run steps from [1:load] to [7:excel_report] 2022-06-21 18:55:43.010305 INFO [runMe.py:381] Get license file [./license.json] 2022-06-21 18:55:43.029091 INFO [runMe.py:383] License verification succeed 2022-06-21 18:55:43.336589 INFO [OraCollector.py:50] Check DB privilege for [test_usr] 2022-06-21 18:55:44.114096 INFO [OraCollector.py:157] Get DB information 2022-06-21 18:55:44.132185 INFO [OraCollector.py:181] DB Info: [PROD (11.2.0.4)] 2022-06-21 18:55:44.132277 INFO [OraCollector.py:182] DB Charset: [AL32UTF8] 2022-06-21 18:55:44.132657 INFO [OraCollector.py:222] Parse schema filter 2022-06-21 18:55:44.196589 INFO [OraCollector.py:247] SCHEMA_NAME_LIST: ['TEST_USR'] 2022-06-21 18:55:44.196903 INFO [OraCollector.py:343] Start collecting metadata information ... 2022-06-21 18:55:44.196945 INFO [OraCollector.py:345] Start meta collection for [COLUMN_DEFINITION] 2022-06-21 18:55:45.432740 INFO [OraCollector.py:373] Finish meta collection for [COLUMN_DEFINITION] 2022-06-21 18:55:45.433491 INFO [OraCollector.py:345] Start meta collection for [PLSQL_DEFINITION] 2022-06-21 18:55:47.771530 INFO [OraCollector.py:373] Finish meta collection for [PLSQL_DEFINITION] 2022-06-21 18:55:47.771690 INFO [OraCollector.py:375] All metadata information collected 2022-06-21 18:55:47.814902 INFO [OraCollector.py:302] Session query progress [1 of 1] 2022-06-21 18:55:47.841517 INFO [OraCollector.py:389] Start collecting sql information ... 2022-06-21 18:55:48.403803 INFO [OraCollector.py:486] Finish current SQL collection [All: 6, New: 6] 2022-06-21 18:55:48.408870 INFO [OraCollector.py:332] SQL collection all completed 2022-06-21 18:55:48.409912 INFO [runMe.py:511] +==================== [ Summary Information ] ====================+ 2022-06-21 18:55:48.410011 INFO [runMe.py:512] | Task Name File Name File Size | 2022-06-21 18:55:48.410062 INFO [runMe.py:513] | --------------------- ------------------------------ ---------- | 2022-06-21 18:55:48.410118 INFO [runMe.py:515] | SCA_SESSION_SQL sca_sql_information.dat 49.62KB | 2022-06-21 18:55:48.410164 INFO [runMe.py:515] | SCA_SESSION_SQL_PERF sca_sql_performance.dat 530B | 2022-06-21 18:55:48.410206 INFO [runMe.py:515] | PLSQL_DEFINITION sca_plsql_definition.dat 318B | 2022-06-21 18:55:48.410248 INFO [runMe.py:515] | SCA_DATABASE sca_database.dat 293B | 2022-06-21 18:55:48.410289 INFO [runMe.py:515] | COLUMN_DEFINITION sca_column_definition.dat 70B | 2022-06-21 18:55:48.411887 INFO [runMe.py:516] +=================================================================+ >>> Final Result is: >>> ---------------------------------------------- >>> data.zip
复制
采集一周用(不带-q -Q 默认采集一周)
./sca_linux_x86_64 -T OC -s test_usr -h 172.20.10.9 -p1521 -n prod -u test_usr -e test123 -m off -d data
复制
4.oracle数据分析
做兼容性分析时候,会从资料库里取表结构,如果怕取的表结构有问题,可以先同步一份表结构到目标库。(
其中OIS为同时进行SQL兼容度与性能评估 (资料库已初始化),OI为只分析SQL兼容度,如果是PostgreSQL数据库,建议只使用OI(目前暂未完善PostgreSQL性能分析)。
(如果要做性能评估,需要把数据迁移到目标库。迁移数据和表结构均可以使用云和恩墨的MTK工具,或者其他迁移工具,否则没有数据,性能评估参考意义不大)
MTK的链接地址为:https://www.mogdb.io/mtk
MTK全称为 Database Migration Toolkit,是一个可以将Oracle/DB2/MySQL/openGauss数据库的数据结构,全量数据高速导入到MogDB的工具。最新版本同时支持对于Oracle数据库中存储过程,函数,触发器等程序段的MogDB兼容性改写和导入。
我这里的环境资料库和目标端都是一个数据库,因此没有额外指定-h。如果资料库和目标库非一个库,需要额外加上目标端和资料库相关参数。(可以适当参考附录中的PostgreSQL的兼容度分析的例子或者参考文章开头的SCA手册)
[mog@node1 sca]$ ./sca_linux_x86_64 -T OIS -H 172.20.10.7 -P 29000 -d data 2022-06-21 19:25:57.932652 INFO [runMe.py:337] Run steps from [1:load] to [7:excel_report] 2022-06-21 19:25:57.933019 INFO [runMe.py:381] Get license file [./license.json] 2022-06-21 19:25:58.003541 INFO [runMe.py:383] License verification succeed 2022-06-21 19:25:58.003663 INFO [runMe.py:569] Load data from [data] 2022-06-21 19:25:58.003688 INFO [Loader.py:122] Begin to load data from directory [data] 2022-06-21 19:25:58.418652 INFO [Loader.py:131] Get current data id [2] 2022-06-21 19:25:58.419511 INFO [Logger.py:142] Set task [File_Loader] [0 of 52025] 2022-06-21 19:25:58.775148 INFO [Loader.py:141] Loader order [['sca_sql_information.dat', 'sca_sql_performance.dat', 'sca_plsql_definition.dat', 'sca_database.dat', 'sca_column_definition.dat']] 2022-06-21 19:25:58.783417 INFO [Loader.py:142] Start loading with [10] workers 2022-06-21 19:25:59.453712 INFO [Loader.py:25] Begin to load file [data/sca_sql_information.dat] into table [sca_sql_information] 2022-06-21 19:25:59.461333 INFO [Loader.py:25] Begin to load file [data/sca_sql_performance.dat] into table [sca_sql_performance] 2022-06-21 19:25:59.476637 INFO [Loader.py:25] Begin to load file [data/sca_plsql_definition.dat] into table [sca_plsql_definition] 2022-06-21 19:25:59.492118 INFO [Loader.py:25] Begin to load file [data/sca_database.dat] into table [sca_database] 2022-06-21 19:25:59.515902 INFO [Loader.py:25] Begin to load file [data/sca_column_definition.dat] into table [sca_column_definition] 2022-06-21 19:25:59.524734 INFO [TaskFile.py:71] Prepared reading task file [data/sca_sql_information.dat] 2022-06-21 19:25:59.553503 INFO [TaskFile.py:71] Prepared reading task file [data/sca_column_definition.dat] 2022-06-21 19:25:59.531707 INFO [TaskFile.py:71] Prepared reading task file [data/sca_sql_performance.dat] 2022-06-21 19:25:59.535854 INFO [TaskFile.py:71] Prepared reading task file [data/sca_plsql_definition.dat] 2022-06-21 19:25:59.539683 INFO [TaskFile.py:71] Prepared reading task file [data/sca_database.dat] 2022-06-21 19:26:00.145376 INFO [TaskFile.py:105] Finished reading task file [data/sca_database.dat] 2022-06-21 19:26:00.156478 INFO [Loader.py:63] [2] lines processed in task file [data/sca_database.dat] 2022-06-21 19:26:00.144288 INFO [TaskFile.py:105] Finished reading task file [data/sca_sql_performance.dat] 2022-06-21 19:26:00.144253 INFO [TaskFile.py:105] Finished reading task file [data/sca_column_definition.dat] 2022-06-21 19:26:00.164056 INFO [Loader.py:63] [0] lines processed in task file [data/sca_column_definition.dat] 2022-06-21 19:26:00.244566 INFO [Loader.py:63] [7] lines processed in task file [data/sca_sql_performance.dat] 2022-06-21 19:26:00.422637 INFO [TaskFile.py:105] Finished reading task file [data/sca_sql_information.dat] 2022-06-21 19:26:00.479841 INFO [Loader.py:63] [7] lines processed in task file [data/sca_sql_information.dat] 2022-06-21 19:26:00.544617 INFO [TaskFile.py:105] Finished reading task file [data/sca_plsql_definition.dat] 2022-06-21 19:26:00.593738 INFO [Loader.py:63] [6] lines processed in task file [data/sca_plsql_definition.dat] 2022-06-21 19:26:00.765039 INFO [Logger.py:173] Task [File_Loader] has finished in [2] seconds 2022-06-21 19:26:00.765422 INFO [Loader.py:77] Begin clean data for [CLEAN_USER_TOOL_SQL] 2022-06-21 19:26:00.771727 INFO [Loader.py:77] Begin clean data for [UNIQUE_SQL] 2022-06-21 19:26:00.775367 INFO [Loader.py:77] Begin clean data for [UNIQUE_SQL_PERF] 2022-06-21 19:26:00.782209 INFO [runMe.py:571] Data loaded with data_id [2] 2022-06-21 19:26:00.782266 INFO [ObjectComplementor.py:156] Start object completion for data_id [2] 2022-06-21 19:26:00.795469 INFO [Logger.py:142] Set task [Object_Completion] [0 of 2] 2022-06-21 19:26:00.848748 INFO [ObjectComplementor.py:36] Table worker [30009] started 2022-06-21 19:26:00.884290 INFO [ObjectComplementor.py:36] Table worker [30014] started 2022-06-21 19:26:00.969517 INFO [ObjectComplementor.py:36] Table worker [30016] started 2022-06-21 19:26:01.204704 INFO [ObjectComplementor.py:36] Table worker [30010] started 2022-06-21 19:26:01.290228 INFO [ObjectComplementor.py:36] Table worker [30015] started 2022-06-21 19:26:01.238711 INFO [ObjectComplementor.py:36] Table worker [30012] started 2022-06-21 19:26:01.370189 INFO [ObjectComplementor.py:36] Table worker [30020] started 2022-06-21 19:26:01.450435 INFO [ObjectComplementor.py:36] Table worker [30022] started 2022-06-21 19:26:01.585807 INFO [ObjectComplementor.py:36] Table worker [30021] started 2022-06-21 19:26:01.918643 INFO [ObjectComplementor.py:36] Table worker [30024] started 2022-06-21 19:26:03.101054 INFO [ObjectComplementor.py:69] Table worker [30009] completed in [2.25] seconds 2022-06-21 19:26:04.546533 INFO [ObjectComplementor.py:69] Table worker [30014] completed in [3.66] seconds 2022-06-21 19:26:06.032098 INFO [ObjectComplementor.py:69] Table worker [30012] completed in [4.8] seconds 2022-06-21 19:26:06.168861 INFO [ObjectComplementor.py:69] Table worker [30010] completed in [4.97] seconds 2022-06-21 19:26:06.173421 INFO [ObjectComplementor.py:69] Table worker [30022] completed in [4.8] seconds 2022-06-21 19:26:06.208889 INFO [ObjectComplementor.py:69] Table worker [30021] completed in [4.63] seconds 2022-06-21 19:26:06.211021 INFO [ObjectComplementor.py:69] Table worker [30015] completed in [4.99] seconds 2022-06-21 19:26:06.226953 INFO [ObjectComplementor.py:69] Table worker [30024] completed in [4.31] seconds 2022-06-21 19:26:06.227171 INFO [ObjectComplementor.py:69] Table worker [30016] completed in [5.31] seconds 2022-06-21 19:26:06.229191 INFO [ObjectComplementor.py:69] Table worker [30020] completed in [4.86] seconds 2022-06-21 19:26:06.247634 INFO [ObjectComplementor.py:83] PLSQL worker [30075] started 2022-06-21 19:26:06.249767 INFO [ObjectComplementor.py:83] PLSQL worker [30076] started 2022-06-21 19:26:06.282853 INFO [ObjectComplementor.py:83] PLSQL worker [30082] started 2022-06-21 19:26:06.284555 INFO [ObjectComplementor.py:83] PLSQL worker [30085] started 2022-06-21 19:26:06.286866 INFO [ObjectComplementor.py:83] PLSQL worker [30080] started 2022-06-21 19:26:06.297060 INFO [ObjectComplementor.py:83] PLSQL worker [30078] started 2022-06-21 19:26:06.298153 INFO [ObjectComplementor.py:83] PLSQL worker [30087] started 2022-06-21 19:26:06.299673 INFO [ObjectComplementor.py:83] PLSQL worker [30083] started 2022-06-21 19:26:06.302537 INFO [ObjectComplementor.py:83] PLSQL worker [30090] started 2022-06-21 19:26:06.302717 INFO [ObjectComplementor.py:83] PLSQL worker [30091] started 2022-06-21 19:26:07.035553 INFO [ObjectComplementor.py:117] PLSQL worker [30075] completed in [0.79] seconds 2022-06-21 19:26:07.035937 INFO [ObjectComplementor.py:117] PLSQL worker [30076] completed in [0.79] seconds 2022-06-21 19:26:07.361186 INFO [ObjectComplementor.py:117] PLSQL worker [30082] completed in [1.08] seconds 2022-06-21 19:26:07.432812 INFO [ObjectComplementor.py:117] PLSQL worker [30085] completed in [1.15] seconds 2022-06-21 19:26:07.445819 INFO [ObjectComplementor.py:117] PLSQL worker [30087] completed in [1.15] seconds 2022-06-21 19:26:07.456366 INFO [ObjectComplementor.py:117] PLSQL worker [30078] completed in [1.16] seconds 2022-06-21 19:26:07.464116 INFO [ObjectComplementor.py:117] PLSQL worker [30080] completed in [1.18] seconds 2022-06-21 19:26:07.478522 INFO [ObjectComplementor.py:117] PLSQL worker [30091] completed in [1.18] seconds 2022-06-21 19:26:07.481261 INFO [ObjectComplementor.py:117] PLSQL worker [30083] completed in [1.18] seconds 2022-06-21 19:26:07.503265 INFO [ObjectComplementor.py:117] PLSQL worker [30090] completed in [1.2] seconds 2022-06-21 19:26:07.511723 INFO [Logger.py:173] Task [Object_Completion] has finished in [7] seconds 2022-06-21 19:26:07.529520 INFO [ObjectComplementor.py:348] Completed object completion 2022-06-21 19:26:07.534394 INFO [runMe.py:590] Start Oracle inspection 2022-06-21 19:26:07.534462 INFO [OraInspector.py:336] Start Oracle inspection 2022-06-21 19:26:07.546732 INFO [Logger.py:142] Set task [SQL Checker] [0 of 10] 2022-06-21 19:26:07.557477 INFO [OraInspector.py:213] Check session SQLs 2022-06-21 19:26:07.599083 INFO [OraInspector.py:247] Wait all session SQL finished 2022-06-21 19:26:07.739479 INFO [OraInspector.py:128] Process [30153] finished [5] SQL in 0.12 secs 2022-06-21 19:26:07.829312 INFO [OraInspector.py:272] Session SQL inspector finished 2022-06-21 19:26:07.829914 INFO [OraInspector.py:290] Check SQL complexity 2022-06-21 19:26:07.874672 INFO [OraInspector.py:318] Wait all SQL complexity inspector finished 2022-06-21 19:26:07.992392 INFO [OraInspector.py:187] Process [30190] finished [5] SQL in 0.11 secs 2022-06-21 19:26:08.100857 INFO [OraInspector.py:324] SQL complexity finished 2022-06-21 19:26:08.106156 INFO [Logger.py:173] Task [SQL Checker] has finished in [1] seconds 2022-06-21 19:26:08.108422 INFO [OraInspector.py:374] Complete Oracle inspection 2022-06-21 19:26:08.115237 INFO [runMe.py:592] Oracle inspection completed 2022-06-21 19:26:08.115295 INFO [ObjectComplementor.py:353] Start object rollback 2022-06-21 19:26:08.124641 INFO [Logger.py:142] Set task [Object_Rollback] [0 of 2] 2022-06-21 19:26:08.160659 INFO [ObjectComplementor.py:130] Rollback worker [30237] started 2022-06-21 19:26:08.173981 INFO [ObjectComplementor.py:130] Rollback worker [30246] started 2022-06-21 19:26:08.165355 INFO [ObjectComplementor.py:130] Rollback worker [30240] started 2022-06-21 19:26:08.165745 INFO [ObjectComplementor.py:130] Rollback worker [30241] started 2022-06-21 19:26:08.167172 INFO [ObjectComplementor.py:130] Rollback worker [30242] started 2022-06-21 19:26:08.167196 INFO [ObjectComplementor.py:130] Rollback worker [30244] started 2022-06-21 19:26:08.168604 INFO [ObjectComplementor.py:130] Rollback worker [30239] started 2022-06-21 19:26:08.169236 INFO [ObjectComplementor.py:130] Rollback worker [30245] started 2022-06-21 19:26:08.164513 INFO [ObjectComplementor.py:130] Rollback worker [30238] started 2022-06-21 19:26:08.175606 INFO [ObjectComplementor.py:130] Rollback worker [30247] started 2022-06-21 19:26:08.211168 INFO [ObjectComplementor.py:151] Rollback worker [30246] completed in [0.04] seconds 2022-06-21 19:26:08.216913 INFO [ObjectComplementor.py:151] Rollback worker [30240] completed in [0.05] seconds 2022-06-21 19:26:08.217640 INFO [ObjectComplementor.py:151] Rollback worker [30237] completed in [0.06] seconds 2022-06-21 19:26:08.278234 INFO [ObjectComplementor.py:151] Rollback worker [30241] completed in [0.11] seconds 2022-06-21 19:26:08.281896 INFO [ObjectComplementor.py:151] Rollback worker [30239] completed in [0.11] seconds 2022-06-21 19:26:08.297052 INFO [ObjectComplementor.py:151] Rollback worker [30245] completed in [0.13] seconds 2022-06-21 19:26:08.299565 INFO [ObjectComplementor.py:151] Rollback worker [30247] completed in [0.12] seconds 2022-06-21 19:26:08.304126 INFO [ObjectComplementor.py:151] Rollback worker [30242] completed in [0.14] seconds 2022-06-21 19:26:08.304123 INFO [ObjectComplementor.py:151] Rollback worker [30244] completed in [0.14] seconds 2022-06-21 19:26:08.306738 INFO [ObjectComplementor.py:151] Rollback worker [30238] completed in [0.14] seconds 2022-06-21 19:26:08.317492 INFO [Logger.py:173] Task [Object_Rollback] has finished in [0] seconds 2022-06-21 19:26:08.319323 INFO [ObjectComplementor.py:403] Completed object rollback 2022-06-21 19:26:08.324722 INFO [runMe.py:603] Start Oracle simulation 2022-06-21 19:26:08.324787 INFO [OraSimulator.py:174] Begin Oracle SQL simulation 2022-06-21 19:26:08.334735 INFO [OraSimulator.py:192] Begin run prepare SQL [analyze] 2022-06-21 19:26:09.141634 INFO [OraSimulator.py:194] SQL completed, elapsed [0.806840181350708] 2022-06-21 19:26:09.152574 INFO [Logger.py:142] Set task [SQL_Simulator] [0 of 6] 2022-06-21 19:26:09.186617 INFO [OraSimulator.py:38] Simulator worker [30302] started 2022-06-21 19:26:09.188600 INFO [OraSimulator.py:38] Simulator worker [30303] started 2022-06-21 19:26:09.190528 INFO [OraSimulator.py:38] Simulator worker [30305] started 2022-06-21 19:26:09.199252 INFO [OraSimulator.py:38] Simulator worker [30304] started 2022-06-21 19:26:09.216333 INFO [OraSimulator.py:38] Simulator worker [30314] started 2022-06-21 19:26:09.217835 INFO [OraSimulator.py:38] Simulator worker [30316] started 2022-06-21 19:26:09.219236 INFO [OraSimulator.py:38] Simulator worker [30318] started 2022-06-21 19:26:09.228844 INFO [OraSimulator.py:38] Simulator worker [30309] started 2022-06-21 19:26:09.229457 INFO [OraSimulator.py:38] Simulator worker [30307] started 2022-06-21 19:26:09.371060 INFO [OraSimulator.py:110] Simulator worker [30302] completed in [0.18] seconds 2022-06-21 19:26:09.231130 INFO [OraSimulator.py:38] Simulator worker [30311] started 2022-06-21 19:26:09.515480 INFO [OraSimulator.py:110] Simulator worker [30303] completed in [0.33] seconds 2022-06-21 19:26:09.622636 INFO [OraSimulator.py:110] Simulator worker [30316] completed in [0.4] seconds 2022-06-21 19:26:09.685642 INFO [OraSimulator.py:110] Simulator worker [30305] completed in [0.5] seconds 2022-06-21 19:26:09.709736 INFO [OraSimulator.py:110] Simulator worker [30304] completed in [0.51] seconds 2022-06-21 19:26:09.709760 INFO [OraSimulator.py:110] Simulator worker [30311] completed in [0.48] seconds 2022-06-21 19:26:09.713903 INFO [OraSimulator.py:110] Simulator worker [30314] completed in [0.5] seconds 2022-06-21 19:26:09.724144 INFO [OraSimulator.py:110] Simulator worker [30318] completed in [0.5] seconds 2022-06-21 19:26:09.726796 INFO [OraSimulator.py:110] Simulator worker [30307] completed in [0.5] seconds 2022-06-21 19:26:09.730246 INFO [OraSimulator.py:110] Simulator worker [30309] completed in [0.5] seconds 2022-06-21 19:26:09.759663 INFO [Logger.py:173] Task [SQL_Simulator] has finished in [1] seconds 2022-06-21 19:26:09.777052 INFO [OraSimulator.py:348] Completed Oracle SQL simulation 2022-06-21 19:26:09.781913 INFO [runMe.py:605] Oracle simulation completed 2022-06-21 19:26:09.839286 INFO [OraReportData.py:414] Generate JSON data file for [Report Summary] 2022-06-21 19:26:09.845098 INFO [OraReportData.py:439] Generate JSON data file for [SQL Compatibility] 2022-06-21 19:26:09.851460 INFO [OraReportData.py:492] Generate JSON data file for [SQL Complexity] 2022-06-21 19:26:09.859068 INFO [OraReportData.py:528] Generate JSON data file for [SQL Performance] 2022-06-21 19:26:10.156675 INFO [ExcelReport.py:27] Make [Cover] page for Excel report 2022-06-21 19:26:10.162849 INFO [ExcelReport.py:132] Make [Summary] page for Excel report 2022-06-21 19:26:10.174417 INFO [ExcelReport.py:433] Make [Detail SQL] page for Excel report 2022-06-21 19:26:10.179022 INFO [ExcelReport.py:491] Make [Rewrite SQL] page for Excel report 2022-06-21 19:26:10.194170 INFO [runMe.py:633] 2022-06-21 19:26:10.194260 INFO [runMe.py:634] >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> 2022-06-21 19:26:10.194279 INFO [runMe.py:635] Summary: 2022-06-21 19:26:10.194294 INFO [runMe.py:636] Data ID: 2 2022-06-21 19:26:10.197052 INFO [runMe.py:637] SQL Count: 5 2022-06-21 19:26:10.197106 INFO [runMe.py:638] Report Directory: data/report 2022-06-21 19:26:10.197121 INFO [runMe.py:639] 
复制
tar -zcvf report.tar.gz report/
复制
拿到本地查看。其中index.html为兼容性报告,SCA_Data_Report***.xlsx里为具体抽取的SQL。
下边是sca生成的excel的内容
和下边所有分类的具体sql,可以做进一步分析
[附]下面为另一个PostgreSQL–>ORACLE库的SCA工具的相关使用语句
ORACLE端用户
create user ouser identified by 'Enmo@123'; grant connect to ouser; grant SELECT ANY DICTIONARY to ouser; grant CREATE PROCEDURE to ouser; grant EXECUTE ON DBMS_LOB to ouser; grant SELECT ON GV_$SQL_PLAN to ouser;
复制
mogdb端用户(资料库)
create user test_usr with password 'Enmo@123';
复制
pg端
create uer puser with password 'Enmo@123'; alter user puser with superuser; create database pg14;
复制
//初始化资料库
./sca_linux_x86_64 -T i -H 172.16.0.176 -P 27000 -N sca_db -U sca_repo -E 'SCA@password' --user test_usr --password Enmo@123
复制
//只采集一次
./sca_linux_x86_64 -T OC -s OUSER -h 119.3.182.31 -p15221 -n ORACLE21C -u ouser -e Enmo@123 -q 0.001 -Q 60 -m off -d data
复制
如果太慢或者不收集绑定变量和执行计划,可以加上–ignore-bind-plan
通过–sql-config sql_config.json 可以自定制采集SQL的语句
//进行分析
./sca_linux_x86_64 -T OI -H 172.16.0.176 -P 27000 -N sca_db -U sca_repo -E 'SCA@password' -h 172.16.0.176 -p 5432 -n pg14 -u puser -e 'Enmo@123' --target-type=POSTGRESQL -d data
复制