v2.0
- 简介
- 环境依赖
- 快速上手
- 配置文件
- 命令介绍
- mtk
- init-project
- config
- license
- mig
- show
- sync
- sync-schema
- sync-sequence
- sync-object-type
- sync-domain
- sync-wrapper
- sync-server
- sync-user-mapping
- sync-queue
- sync-table
- sync-nickname
- sync-rule
- sync-table-data
- sync-table-data-estimate
- sync-index
- sync-constraint
- sync-db-link
- sync-view
- sync-mview
- sync-function
- sync-procedure
- sync-package
- sync-trigger
- sync-synonym
- sync-table-data-com
- sync-alter-sequence
- sync-coll-statistics
- check-table-data
- gen
- gen completion
- encrypt
- convert-plsql
- report
- self
- mvd
- usql
- 图形化
- 常见问题
- Release
mtk
数据库迁移工具
Synopsis
MTK(数据库迁移工具)用于帮助您迁移数据库
mtk [flags]
Examples
# init project
./mtk init-project -n ora2og
# Generate configuration file.
# edit connection information and migration objects (tables/schemas).
# the directory definition does not need to be modified
vi ora2og/config/mtk.json
# Run
./mtk -c ora2og/config/mtk.json
# Specify migration report
./mtk -c ora2og/config/mtk.json
# Specify debug mode
./mtk -c ora2og/config/mtk.json --debug
# Migrate to a file
./mtk -c ora2og/config/mtk.json --file
# Only Schema is migrated
./mtk -c ora2og/config/mtk.json --schemaOnly
# Only Data is migrated
./mtk -c ora2og/config/mtk.json --dataOnly
# Defining the migration table overrides the contents of the configuration file
./mtk -c ora2og/config/mtk.json --tables schema1.table1,schema2.table2
# Defining the migration schema overrides the contents of the configuration file
./mtk -c ora2og/config/mtk.json --schemas schema1,schema2
# Exclude specific object types
./mtk -c ora2og/config/mtk.json --exclude sequence,package
Options
--batchSize int 指定批量插入或Copy条数大小.
有效值为 1-50000, 默认大小为 1000
支持Oracle、PostgreSQL、openGauss、MySQL.
--bufferSize int 指定批量插入、Copy缓存大小.
有效值为1-1024,默认为8 MB
for postgres,openGauss,mysql.
--caseSensitive int SQL语句中的对象大小写参数.
1 - 小写
2 - 大写
3 - 保持与源数据库相同.
-c, --config string 设置MTK配置文件。支持json、yaml格式. [env MTK_CONFIG] (default "mtk.json")
--cpBufferSize int 定义Copy命令中使用的缓存大小(以MB为单位).
有效值为1-1024,默认批量大小为8 MB
for Postgres,openGauss.
--dataOnly 仅迁移表数据
-d, --debug 设置调试模式.
正常使用不需要此选项. [env MTK_DEBUG]
--disableCollStatistics 禁用采集统计信息.
--disableFKCons 禁用表外键约束同步
--disableIgnoreCase 禁用查询忽略大小写
--disableSelectPart 禁言分区并行查询
--disableTableDataComp 禁用统计表行数对比.
--enableSyncCompTabPro 启用同步表压缩属性
-e, --exclude strings 排除特定对象类型.
For example, exclude=sequence,table
--fetchSize int 指定一次行提取行数大小
有效值为 1-50000, 默认大小为 1000
for Oracle.
--file 导出成文件
--fileType string 指定导出的文件类型。
支持csv、sql
-h, --help help for mtk
--httpAddr string 设置MTK运行的Http服务端口 [env MTK_HTTP_ADDR]
--license string Specify the license file
--limit int 指定迁移每张表多少行数据。如果指定--test参数则参数默认值为10000
--logDir string 设置MTK运行的Http服务日志目录 [env MTK_LOG_DIR]
--logfile string 设置MTK日志文件。默认值为reportFile目录.
--noTerminalReport 终端不打印迁移报告概览
-p, --parallel int 指定并行度.
并行度目前仅在并行迁移表数据和创建索引时有用. (default 1)
--path string 指定要导出数据的文件的目录。
默认值为 config.target.parameter.path。如果不配置,系统默认值./data
命令值 > 配置值 > MTK 默认值
--preRun 预运行.
-r, --reportFile string 设置 mtk 报告文件或目录。如果是文件,则使用文件目录。
默认值为 ./report
报告目录格式 [./report/reportYYYYMMDDHHMISS] ./report/report20210101121314
--reportServer string 指定报告服务器 [env MTK_REPORT_SERVER]
--schemaOnly 仅迁移模式DDL
--schemas string 迁移模式, 以逗号分隔. (schema1,schema2,db1)
--scn string 数据一致性点. 如Oracle SCN
--seqLastNumAddNum int 指定序列最后值统一增加多少
--splitTabMethod string 指定拆分方式.
选项: rowid,mod,ora_hash
Oracle 默认为 auto(sample,mod), 其他数据默认 mod
--splitTabSamplePercentage float 采样百分比
--splitTabSize int 配置当单个表/单个分区大于此值后进行任务拆分并发执行
--splitTabTaskNum int 配置单个表/单个分区拆分多少个任务执行
--tableSkip stringArray 指定表拆分条件,允许指定多少.
format schema.tableName --tableSkip MTK.TABLE01 --tableSkip MTK.TABLE02
--tableSplit stringArray 指定表拆分条件,允许指定多少.
format schema.tableName:where:where:where
--tableSplit 'MTK.TABLE01: "ID">100 AND ID<=200: ID>200 AND ID<=300:ID>300'
--tableSplit "MTK.TABLE02: \"ID\">100 AND ID<=200: ID>200 AND ID<=300:ID>300 AND COL1='1'"
--tables string 迁移表, 以逗号分隔. (tab1,schema1.tab1)
--test 指定MTK是否运行测试模式. 测试模式下每张表只迁移参数limit指定的行数. 测试模式数据不进行提交
-v, --version MTK Version
SEE ALSO
- mtk init-project - 初始化 mtk 项目目录。目录将在当前目录下创建。
- mtk config-check - 检查配置文件是否有误
- mtk config-gen - 交互式生成配置文件
- mtk gen - 生成命令行文档,shell自动补全脚本
- mtk license - 管理许可证
- mtk mig-tab-pre - 迁移数据库对象 Schema,Sequence,ObjectType,Domain,Queue,Wrapper,Server,UserMapping,Table,NickName,Rule
- mtk mig-tab-data - 迁移数据库对象 TableData,TableDataEstimate,CheckTableData
- mtk mig-tab-post - 迁移数据库对象 Index,Constraint,AlterSequence,TableDataCom,CollStatistics
- mtk mig-tab-other - 迁移数据库对象 DBLink,View,MaterializedView,Function,Procedure,Package,Trigger,Synonym
- mtk mig-select - 迁移自定义查询语句到csv文件或目标表
- mtk mig-selects - 迁移自定义查询语句到csv文件或目标表
- mtk show-schema - 查看源数据库方案.
- mtk show-db-info - 查看数据库基本信息.
- mtk show-type - 查看支持数据类型.
- mtk show-table - 查看Top n 表大小
- mtk show-table-split - 根据用户定义的并行度,并行拆分大表
- mtk show-support-db - 查看支持数据库版本.
- mtk show-table-data-estimate - 预估表数据迁移时间.
- mtk report - 转换MTK报告成sql脚本.
- mtk sync-schema - 迁移方案.
- mtk sync-object-type - 迁移对象类型.
- mtk sync-domain - 迁移域.
- mtk sync-sequence - 迁移序列.
- mtk sync-queue - 迁移队列表.
- mtk sync-wrapper - 迁移DB2 Wrapper.
- mtk sync-server - 迁移DB2 Server.
- mtk sync-user-mapping - 迁移DB2 User Mapping.
- mtk sync-table - 迁移表.
- mtk sync-nickname - 迁移DB2 Nickname.
- mtk sync-table-data - 迁移表数据.
- mtk sync-table-data-estimate - 预估表数据迁移时间.
- mtk sync-index - 迁移索引.
- mtk sync-constraint - 迁移约束.
- mtk sync-view - 迁移视图.
- mtk sync-mview - 迁移物化视图.
- mtk sync-trigger - 迁移触发器.
- mtk sync-procedure - 迁移存储过程.
- mtk sync-function - 迁移函数.
- mtk sync-package - 迁移包.
- mtk sync-synonym - 迁移同义词.
- mtk sync-db-link - 迁移数据库链接.
- mtk sync-rule - 迁移规则.
- mtk sync-table-data-com - 统计表行数对比.
- mtk sync-alter-sequence - 修改序列下一个值.
- mtk sync-coll-statistics - 采集统计信息.
- mtk check-table-data - 检查表数据是否存在异常数据
- mtk show-drop-index - 生成删除索引语句
- mtk show-drop-cons - 生成删除约束语句
- mtk version - mtk version
- mtk encrypt - 提供一种方便的方式来加密您的文本/密码
- mtk convert-plsql - 转换PLSQL语句
- mtk self - MTK本身管理
- mtk mvd - 运行MVD进行数据校验
- mtk usql - SQL数据库的通用命令行接口