文档中心MogDBMogDB StackUqbar

文档:v2.0

支持的版本:

MTK Object

Object

Object 迁移对象定义

  • 注意区分大小写
  • 迁移用户、database、schema
  • schema = Oracle user
  • schema = MySQL database
  • schema = PostgreSQL schema
  • schema = DB2 schema
  • schema = Informix schema
  • schema = SQLServer schema

schemas和tables参数互斥 如果两个参数都填入了值,在执行MTK时会遇到"schema and table cannot exist together"错误

没有定义迁移对象,则会报错 "not define Migrate object"。

Field Type Group Description
tables []string 定义要迁移的表、视图、函数、存储过程、包等对象名.
schemas []string 定义要迁移的Schema。
excludeTable map[string][]string 定义排除哪些表。
tableSplit map[string]map[string][]string 定义表粒度并行.

Appears in:

示例:

Object Example

{
  "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"
      ]
    }
  }
}

tables

类型: []string

描述: 定义要迁移的表、视图、函数、存储过程、包等对象名.

当运行子命令迁移时,如 sync-function 并且配置了 tables( MTK.XXX ) 就是迁移 Schema MTK 下的 XXX 函数. 序列除外.

Desc
schema_name.* is equivalent to configuring schema under schemas
schema_name.table_name
schema_name.table_name:P01,P02
schema_name.object_name%
schema_name.view_name ./mtk sync-view Migrates the view with the specified name under the schema
schema_name.function_name ./mtk sync-function Migrates the function with the specified name under the schema
schema_name.procedure_name ./mtk sync-procedure Migrates the stored procedure with the specified name under the schema

示例:

Tables Example

{
  "tables": [
    "MTK.TAB1",
    "MTK.TAB111%",
    "MTK1.*",
    "MTK1.TAB_PART:P1,P2"
  ]
}

schemas

类型: []string

描述: 定义要迁移的Schema。

示例:

Schemas Example

{
  "schemas": [
    "SCHEMA1",
    "SCHEMA2"
  ]
}

excludeTable

类型: map[string][]string

描述: 定义排除哪些表。

示例:

Exclude Table Example

{
  "excludeTable": {
    "SCHEMA1": [
      "TABLE_SKIP1",
      "TABLE_DUTY_LOG*",
      "^TABLE_DUTY_LOG*",
      "^TABLE_DUTY_LOG.*$"
    ],
    "SCHEMA2": [
      "TABLE_SKIP1"
    ]
  }
}

tableSplit

类型: map[string]map[string][]string

描述: 定义表粒度并行. 可使用mtk show-table-split自动生成.

示例:

Table Split Example

{
  "tableSplit": {
    "SCHEMA1": {
      "TAB_1": [
        "ID < 10000",
        "ID < 90000 AND ID >=10000",
        "ID >= 90000"
      ]
    }
  }
}
Copyright © 2011-2024 www.enmotech.com All rights reserved.