文档中心MogDBMogDB StackUqbar

文档:v2.0

支持的版本:

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

Copyright © 2011-2024 www.enmotech.com All rights reserved.