文档中心MogDBMogDB StackUqbar

文档:v2.0

支持的版本:

MTK Configuration File Description

Config

配置文件

Field Type Group Description
source Option 源数据库配置信息。
target Option 目标数据库配置信息。
object Object 迁移对象定义。
limit Limit 迁移并发配置。
dataOnly bool 是否只迁移数据。
schemaOnly bool 是否只迁移数据库结构.
disableTableDataComp bool 当数据迁移完成后,MTK会统计两边的行数进行对比.
disableCollStatistics bool 当数据迁移完成后,MTK会收集目标端统计信息.
reportFile string 迁移报告目录.
debug bool 是否开启日志debug模式。
preRun bool 预运行.
test bool 试迁移.
disableIgnoreCase bool 关闭在源库查询忽略大小写功能.
disableSelectPart bool 关闭分区查询功能。
disableFKCons bool 禁用外键同步.
disableSyncIdxAfterData bool 在一次性迁移模式下禁用在同步完单个表数据后立即创建这个表的索引. 改为全部完全部迁移表数据后,在进行同步索引。
disableSequence bool 禁用序列同步.

示例:

{
  "source": {
    "type": "oracle",
    "connect": {
      "version": "",
      "host": "127.0.0.1",
      "user": "system",
      "port": 1521,
      "password": "******",
      "dbName": "orcl",
      "clientCharset": "",
      "pureDriverClientCharset": ""
    }
  },
  "target": {
    "type": "opengauss",
    "connect": {
      "version": "3.0.0",
      "host": "127.0.0.1",
      "user": "gaussdb",
      "port": 26000,
      "password": "******",
      "dbName": "postgres",
      "clientCharset": "",
      "pureDriverClientCharset": ""
    },
    "parameter": {
      "parallelInsert": 1,
      "dropSchema": false,
      "dropExistingObject": false,
      "skipExistPLSQL": false,
      "truncTable": false,
      "colKeyWords": {},
      "objKeyWords": {},
      "caseSensitive": 0,
      "quoteMark": false,
      "path": "./data",
      "schemaPath": "",
      "dataPath": "",
      "errDataPath": "",
      "fileType": "",
      "fileSize": "",
      "csvHeader": false,
      "csvNullValue": "",
      "csvFieldDelimiter": ",",
      "csvOptionallyEnclosed": "\"",
      "excludeSysTable": [],
      "remapSchema": {},
      "remapTable": {},
      "remapTablespace": {},
      "enableSyncTabTbsPro": false,
      "enableSyncCompTabPro": false,
      "timeFormat": "HH:MI:SS",
      "dateFormat": "YYYY-MM-DD",
      "dateTimeFormat": "YYYY-MM-DD HH24:MI:SS",
      "timeStampFormat": "YYYY-MM-DD HH24:MI:SSXFFFFFF",
      "timeStampZoneFormat": "YYYY-MM-DD HH24:MI:SSXFFFFFF TZR",
      "noSupportPartTabToNormalTab": false,
      "ignoreDB2PartInclusive": false,
      "igNotSupportIntervalPart": false,
      "igErrorData": false,
      "enableBatchCommit": false,
      "ignoreTabPartition": false,
      "ignoreTabPartitionTabList": [],
      "autoAddMaxvaluePart": false,
      "autoAddMySQLAutoIncr": false,
      "autoAddMySQLAutoIncrTabList": [],
      "ignoreNotSupportDefault": false,
      "replaceZeroDate": "",
      "replaceBCDate": "",
      "virtualColToNormalCol": false,
      "virtualColConv": {},
      "convertOracleIntegerToNumeric": false,
      "enableOgBlobClob": false,
      "enableConvertSrid": false,
      "defaultSrid": "4326",
      "seqLastNumAddNum": 0,
      "skipColumnType": {},
      "skipColumnName": {},
      "columnTypeData": {},
      "columnNameData": {},
      "templateSeqName": "",
      "charAppendEmptyString": false,
      "tableOptions": {},
      "indexOptions": {},
      "enableGlobalIndexToLocal": false,
      "convertPackageMethod": "",
      "enableAutoAddParenthesesForFunc": false,
      "largeSequence": "",
      "enableConvEmptyStringToSpace": false,
      "customColMap": null,
      "compatibleIlLegaLChars": false
    }
  },
  "object": {
    "tables": [
      "MTK.TAB1",
      "MTK.TAB111%",
      "MTK1.*",
      "MTK1.TAB_PART:P1,P2"
    ],
    "schemas": [
      "SCHEMA1",
      "SCHEMA2"
    ],
    "excludeTable": {
      "SCHEMA1": [
        "TABLE_SKIP1",
        "TABLE_DUTY_LOG*",
        "^TABLE_DUTY_LOG*",
        "^TABLE_DUTY_LOG.*$"
      ],
      "SCHEMA2": [
        "TABLE_SKIP1"
      ]
    },
    "tableSplit": {
      "SCHEMA1": {
        "TAB_1": [
          "ID < 10000",
          "ID < 90000 AND ID >=10000",
          "ID >= 90000"
        ]
      }
    }
  },
  "limit": {
    "parallel": 2,
    "fetchSize": 1000,
    "batchSize": 1000,
    "bufferSize": 8,
    "cpBufferSize": 8,
    "oracleSelectParallel": 2,
    "channelCacheNum": 2000,
    "limit": 0,
    "splitTabSize": 5120,
    "splitTabMethod": "",
    "splitTabTaskNum": 0,
    "splitTabSamplePercentage": 0.1
  },
  "dataOnly": false,
  "schemaOnly": false,
  "disableTableDataComp": false,
  "disableCollStatistics": false,
  "reportFile": "./report/",
  "debug": false,
  "disableIgnoreCase": false,
  "disableSelectPart": false,
  "disableFKCons": false,
  "disableSyncIdxAfterData": false,
  "disableSequence": false
}

source

类型: Option

描述: 源数据库配置信息。

示例:

Source Database Config Example

{
  "source": {
    "type": "oracle",
    "connect": {
      "version": "",
      "host": "127.0.0.1",
      "user": "system",
      "port": 1521,
      "password": "******",
      "dbName": "orcl",
      "clientCharset": "",
      "pureDriverClientCharset": ""
    }
  }
}

target

类型: Option

描述: 目标数据库配置信息。

示例:

Target Database Config Example

{
  "target": {
    "type": "opengauss",
    "connect": {
      "version": "3.0.0",
      "host": "127.0.0.1",
      "user": "gaussdb",
      "port": 26000,
      "password": "******",
      "dbName": "postgres",
      "clientCharset": "",
      "pureDriverClientCharset": ""
    },
    "parameter": {
      "parallelInsert": 1,
      "dropSchema": false,
      "dropExistingObject": false,
      "skipExistPLSQL": false,
      "truncTable": false,
      "colKeyWords": {},
      "objKeyWords": {},
      "caseSensitive": 0,
      "quoteMark": false,
      "path": "./data",
      "schemaPath": "",
      "dataPath": "",
      "errDataPath": "",
      "fileType": "",
      "fileSize": "",
      "csvHeader": false,
      "csvNullValue": "",
      "csvFieldDelimiter": ",",
      "csvOptionallyEnclosed": "\"",
      "excludeSysTable": [],
      "remapSchema": {},
      "remapTable": {},
      "remapTablespace": {},
      "enableSyncTabTbsPro": false,
      "enableSyncCompTabPro": false,
      "timeFormat": "HH:MI:SS",
      "dateFormat": "YYYY-MM-DD",
      "dateTimeFormat": "YYYY-MM-DD HH24:MI:SS",
      "timeStampFormat": "YYYY-MM-DD HH24:MI:SSXFFFFFF",
      "timeStampZoneFormat": "YYYY-MM-DD HH24:MI:SSXFFFFFF TZR",
      "noSupportPartTabToNormalTab": false,
      "ignoreDB2PartInclusive": false,
      "igNotSupportIntervalPart": false,
      "igErrorData": false,
      "enableBatchCommit": false,
      "ignoreTabPartition": false,
      "ignoreTabPartitionTabList": [],
      "autoAddMaxvaluePart": false,
      "autoAddMySQLAutoIncr": false,
      "autoAddMySQLAutoIncrTabList": [],
      "ignoreNotSupportDefault": false,
      "replaceZeroDate": "",
      "replaceBCDate": "",
      "virtualColToNormalCol": false,
      "virtualColConv": {},
      "convertOracleIntegerToNumeric": false,
      "enableOgBlobClob": false,
      "enableConvertSrid": false,
      "defaultSrid": "4326",
      "seqLastNumAddNum": 0,
      "skipColumnType": {},
      "skipColumnName": {},
      "columnTypeData": {},
      "columnNameData": {},
      "templateSeqName": "",
      "charAppendEmptyString": false,
      "tableOptions": {},
      "indexOptions": {},
      "enableGlobalIndexToLocal": false,
      "convertPackageMethod": "",
      "enableAutoAddParenthesesForFunc": false,
      "largeSequence": "",
      "enableConvEmptyStringToSpace": false,
      "customColMap": null,
      "compatibleIlLegaLChars": false
    }
  }
}

object

类型: Object

描述: 迁移对象定义。

示例:

Object Example

{
  "object": {
    "tables": [
      "MTK.TAB1",
      "MTK.TAB111%",
      "MTK1.*",
      "MTK1.TAB_PART:P1,P2"
    ],
    "schemas": [
      "SCHEMA1",
      "SCHEMA2"
    ],
    "excludeTable": {
      "SCHEMA1": [
        "TABLE_SKIP1",
        "TABLE_DUTY_LOG*",
        "^TABLE_DUTY_LOG*",
        "^TABLE_DUTY_LOG.*$"
      ],
      "SCHEMA2": [
        "TABLE_SKIP1"
      ]
    },
    "tableSplit": {
      "SCHEMA1": {
        "TAB_1": [
          "ID < 10000",
          "ID < 90000 AND ID >=10000",
          "ID >= 90000"
        ]
      }
    }
  }
}

limit

类型: Limit

描述: 迁移并发配置。

示例:

Limit Example

{
  "limit": {
    "parallel": 2,
    "fetchSize": 1000,
    "batchSize": 1000,
    "bufferSize": 8,
    "cpBufferSize": 8,
    "oracleSelectParallel": 2,
    "channelCacheNum": 2000,
    "limit": 0,
    "splitTabSize": 5120,
    "splitTabMethod": "",
    "splitTabTaskNum": 0,
    "splitTabSamplePercentage": 0.1
  }
}

dataOnly

类型: bool

描述: 是否只迁移数据。

默认值: false

可选值:

  • true
  • false

schemaOnly

类型: bool

描述: 是否只迁移数据库结构.

默认值: false

可选值:

  • true
  • false

disableTableDataComp

类型: bool

描述: 当数据迁移完成后,MTK会统计两边的行数进行对比. 此参数可以禁用表数据select对比。

默认值: false

可选值:

  • true
  • false

disableCollStatistics

类型: bool

描述: 当数据迁移完成后,MTK会收集目标端统计信息. 此参数可以禁用收集统计信息。

默认值: false

可选值:

  • true
  • false

reportFile

类型: string

描述: 迁移报告目录. v0.0.18之前为单个html报告 v0.0.18后是一个目录。

debug

类型: bool

描述: 是否开启日志debug模式。

默认值: false

可选值:

  • true
  • false

preRun

类型: bool

描述: 预运行.

默认值: false

可选值:

  • true
  • false

test

类型: bool

描述: 试迁移. 迁移参数limit.limit行数据. 此模式下数据不就行提交,会自动回退数据. 只是测试是否正常插入数据。

默认值: false

可选值:

  • true
  • false

disableIgnoreCase

类型: bool

描述: 关闭在源库查询忽略大小写功能.

默认值: false

可选值:

  • true
  • false

disableSelectPart

类型: bool

描述: 关闭分区查询功能。

默认值: false

可选值:

  • true
  • false

disableFKCons

类型: bool

描述: 禁用外键同步.

默认值: false

可选值:

  • true
  • false

disableSyncIdxAfterData

类型: bool

描述: 在一次性迁移模式下禁用在同步完单个表数据后立即创建这个表的索引. 改为全部完全部迁移表数据后,在进行同步索引。

默认值: false

可选值:

  • true
  • false

disableSequence

类型: bool

描述: 禁用序列同步.

默认值: false

可选值:

  • true
  • false

新增于: v2.9.3

Connect

Field Type Group Description
version string 数据库版本.
vendor string 数据库发行厂家.
host string 数据库主机
user string 数据库用户
port int 数据库端口
password Password 数据库用户密码
dbName string 数据库名称
dsn string 用户指定连接字符串.
timeout int64 连接超时时间. 最大600s,超过600s则为默认值
charset string 数据库字符集.
datCompatibility string 针对openGauss 数据库兼容模式.
sqlMode string 针对 MySQL 数据库 sql_mode.
clientCharset string 针对数据库编码转换场景使用,一般情况下不需要设置.

Appears in:

version

类型: string

描述: 数据库版本.

无需指定. 连接数据库时自动查询

迁移成文件是需要手工指定版本

示例:

Version Example

{
  "version": "2.1.0"
}

vendor

类型: string

描述: 数据库发行厂家.

无需指定. 连接数据库时自动查询。

示例:

Vendor Example

{
  "vendor": "MySQL"
}

host

类型: string

描述: 数据库主机

可选值:

  • ip
  • 域名

示例:

Host Example

{
  "host": "127.0.0.1"
}

user

类型: string

描述: 数据库用户

示例:

User Example

{
  "user": "system"
}

port

类型: int

描述: 数据库端口

示例:

Port Example

{
  "port": 1521
}

password

类型: Password

描述: 数据库用户密码

dbName

类型: string

描述: 数据库名称

示例:

DBName Example

{
  "dbName": "orcl"
}

dsn

类型: string

描述: 用户指定连接字符串.

默认情况下无需指定.针对特殊场景预留功能。

timeout

类型: int64

描述: 连接超时时间. 最大600s,超过600s则为默认值

无需配置

默认值: 30s

charset

类型: string

描述: 数据库字符集.

默认不用配置,连接数据库查询.

可选值:

  • gbk
  • utf8

示例:

Charset Example

{
  "charset": "gbk"
}

datCompatibility

类型: string

描述: 针对openGauss 数据库兼容模式.

默认不用配置,连接数据库查询.

迁移成文件需要配置。

可选值:

  • A
  • B
  • PG

示例:

DatCompatibility Example

{
  "datCompatibility": "A"
}

sqlMode

类型: string

描述: 针对 MySQL 数据库 sql_mode.

默认不用配置,连接数据库查询.

迁移成文件需要配置.

clientCharset

类型: string

描述: 针对数据库编码转换场景使用,一般情况下不需要设置.

  1. 主动配置下会检查源和目标是否一致,不一致则同步源设置,一致不处理
  2. 默认根据源字符集进行设置,尽量减少转码次数。 如源Oracle是ZHS16GBK则以GBK读取,目标端以GBK插入,如果目标端是GBK则不需要转码,是UTF8则在数据库内核层转码不在驱动层转码

如 Oracle ZHS16GBK 编码迁移到 openGauss UTF8. 遇到ORA-29275: partial multibyte character.

Option

数据库配置信息

Field Type Group Description
type string 数据库类型
connect Connect 数据库连接信息
parameter Parameter 参数配置

Appears in:

示例:

Source Database Config Example

{
  "type": "oracle",
  "connect": {
    "version": "",
    "host": "127.0.0.1",
    "user": "system",
    "port": 1521,
    "password": "******",
    "dbName": "orcl",
    "clientCharset": "",
    "pureDriverClientCharset": ""
  }
}

Target Database Config Example

{
  "type": "opengauss",
  "connect": {
    "version": "3.0.0",
    "host": "127.0.0.1",
    "user": "gaussdb",
    "port": 26000,
    "password": "******",
    "dbName": "postgres",
    "clientCharset": "",
    "pureDriverClientCharset": ""
  },
  "parameter": {
    "parallelInsert": 1,
    "dropSchema": false,
    "dropExistingObject": false,
    "skipExistPLSQL": false,
    "truncTable": false,
    "colKeyWords": {},
    "objKeyWords": {},
    "caseSensitive": 0,
    "quoteMark": false,
    "path": "./data",
    "schemaPath": "",
    "dataPath": "",
    "errDataPath": "",
    "fileType": "",
    "fileSize": "",
    "csvHeader": false,
    "csvNullValue": "",
    "csvFieldDelimiter": ",",
    "csvOptionallyEnclosed": "\"",
    "excludeSysTable": [],
    "remapSchema": {},
    "remapTable": {},
    "remapTablespace": {},
    "enableSyncTabTbsPro": false,
    "enableSyncCompTabPro": false,
    "timeFormat": "HH:MI:SS",
    "dateFormat": "YYYY-MM-DD",
    "dateTimeFormat": "YYYY-MM-DD HH24:MI:SS",
    "timeStampFormat": "YYYY-MM-DD HH24:MI:SSXFFFFFF",
    "timeStampZoneFormat": "YYYY-MM-DD HH24:MI:SSXFFFFFF TZR",
    "noSupportPartTabToNormalTab": false,
    "ignoreDB2PartInclusive": false,
    "igNotSupportIntervalPart": false,
    "igErrorData": false,
    "enableBatchCommit": false,
    "ignoreTabPartition": false,
    "ignoreTabPartitionTabList": [],
    "autoAddMaxvaluePart": false,
    "autoAddMySQLAutoIncr": false,
    "autoAddMySQLAutoIncrTabList": [],
    "ignoreNotSupportDefault": false,
    "replaceZeroDate": "",
    "replaceBCDate": "",
    "virtualColToNormalCol": false,
    "virtualColConv": {},
    "convertOracleIntegerToNumeric": false,
    "enableOgBlobClob": false,
    "enableConvertSrid": false,
    "defaultSrid": "4326",
    "seqLastNumAddNum": 0,
    "skipColumnType": {},
    "skipColumnName": {},
    "columnTypeData": {},
    "columnNameData": {},
    "templateSeqName": "",
    "charAppendEmptyString": false,
    "tableOptions": {},
    "indexOptions": {},
    "enableGlobalIndexToLocal": false,
    "convertPackageMethod": "",
    "enableAutoAddParenthesesForFunc": false,
    "largeSequence": "",
    "enableConvEmptyStringToSpace": false,
    "customColMap": null,
    "compatibleIlLegaLChars": false
  }
}

type

类型: string

描述: 数据库类型

可选值:

  • MySQL
  • Oracle
  • Postgres/PostgreSQL
  • openGauss
  • MogDB
  • DB2
  • SqlServer
  • file
  • Informix
  • DM

示例:

Type Example

{
  "type": "Oracle"
}

connect

类型: Connect

描述: 数据库连接信息

parameter

类型: Parameter

描述: 参数配置

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