- Overview
- Environment
- Quick Start
- Configuration
- Commands
- 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
- Graphical
- Faqs
- Release
MTK Usage
Show Version
./mtk version
Apply the license
./mtk license gen
Migrate Oracle To MogDB
Migrating Oracle to MogDB FAQ reference Oracle To MogDB
Install Oracle Client
init project
./mtk init-project -s oracle -t mogdb -n ora2mg
# will build a migration directory
ora2mg
├── config
│ └── mtk.json
├── data
├── report
└── schema
edit the configuration file
Edit the configuration file in advance. For details, see Configuration File
vi ora2mg/config/mtk.json
-
Edit
source
node to define the source database connection information. Configuration reference source -
Edit
target
node to define the target database connection information. Configuration reference targetModify the connect and type information, and the parameter is adjusted according to the operation
-
Edit
object
node to define the migration object. Configuration reference object
After editing, run config-check
./mtk config-check -c ora2mg/config/mtk.json
The configuration file will output type information normally
use config : ora2mg/config/mtk.json
There is no error in the configuration file
run
./mtk -c ora2mg/config/mtk.json
# debug
./mtk -c ora2mg/config/mtk.json --debug
# only Schema is migrated
./mtk -c ora2mg/config/mtk.json --schemaOnly
# Only Data is migrated
./mtk -c ora2mg/config/mtk.json --dataOnly
view Report
Reports and run logs are generated in the ora2og/report
directory. as follows
[2022-01-20 11:29:25.800978] INFO reportDir: ora2mg/report/report_20220120110125 function=GenReport line=412 file=mtk/cmd/mtk/services/cmd.go
[2022-01-20 11:29:26.426822] INFO the text report : ora2mg/report/report_20220120110125.txt function=PrintReport line=270 file=mtk/cmd/mtk/services/cmd.go
[2022-01-20 11:29:26.429545] INFO the warring report : ora2mg/report/report_20220120110125.warring function=PrintReport line=281 file=mtk/cmd/mtk/services/cmd.go
[2022-01-20 11:29:26.430118] INFO the error report : ora2mg/report/report_20220120110125.err file=mtk/cmd/mtk/services/cmd.go function=PrintReport line=292
file name | description |
---|---|
ora2mg/report/report_20220120110125 | html report |
ora2mg/report/report_20220120110125.txt | text report |
ora2mg/report/report_20220120110125.warring | A text report that contains only warning messages |
ora2mg/report/report_20220120110125.err | A text report that contains only error messages |
export as a file
./mtk -c ora2mg/config/mtk.json --file
# Only Schema is migrated
./mtk -c ora2mg/config/mtk.json --file --schemaOnly
# Only Data is migrated
./mtk -c ora2mg/config/mtk.json --file --dataOnly
The command line specifies the migration object
# specify the table
./mtk -c ora2mg/config/mtk.json --tables schema1.table1,schema2.table2
# specify the schema
./mtk -c ora2mg/config/mtk.json --schemas schema1,schema2
Migrate MySQL to MogDB
Migrating MySQL to MogDB FAQ reference MySQL To MogDB
init project
./mtk init-project -s mysql -t mogdb -n my2mg
edit the configuration file
vi my2mg/config/mtk.json
-
Edit
source
node to define the source database connection information. Configuration reference source -
Edit
target
node to define the target database connection information. Configuration reference targetModify the connect and type information, and the parameter is adjusted according to the operation
-
Edit
object
node to define the migration object. Configuration reference object
After editing, run config-check
./mtk config-check -c my2mg/config/mtk.json
The configuration file will output type information normally
use config : my2mg/config/mtk.json
There is no error in the configuration file
run
./mtk -c my2mg/config/mtk.json
Migrate DB2 to MogDB
Migrating DB2 to MogDB FAQ reference DB2 To MogDB
Install db2 Client
init project
./mtk init-project -s db2 -t mogdb -n db22mg
edit the configuration file
vi db22mg/config/mtk.json
-
Edit
source
node to define the source database connection information. Configuration reference source -
Edit
target
node to define the target database connection information. Configuration reference targetModify the connect and type information, and the parameter is adjusted according to the operation
-
Edit
object
node to define the migration object. Configuration reference object
After editing, run config-check
./mtk config-check -c db22mg/config/mtk.json
The configuration file will output type information normally
use config : db22mg/config/mtk.json
There is no error in the configuration file
run
./mtk -c db22mg/config/mtk.json
Migrate Informix to MogDB
Migrating Informix to MogDB FAQ reference Informix To MogDB
Install db2 Client
init project
./mtk init-project -s informix -t mogdb -n ifx2mg
edit the configuration file
vi ifx2mg/config/mtk.json
-
Edit
source
node to define the source database connection information. Configuration reference source -
Edit
target
node to define the target database connection information. Configuration reference targetModify the connect and type information, and the parameter is adjusted according to the operation
-
Edit
object
node to define the migration object. Configuration reference object
After editing, run config-check
./mtk config-check -c ifx2mg/config/mtk.json
The configuration file will output type information normally
use config : ifx2mg/config/mtk.json
There is no error in the configuration file
run
./mtk -c ifx2mg/config/mtk.json
Migration methods
MTK supports three migration methods.
Migrate all at once
./mtk -c mtk.json
Combined migration
Step | Command |
---|---|
./mtk mig-tab-pre -c mtk.json | mig-tab-pre |
./mtk mig-tab-data -c mtk.json | mig-tab-data |
./mtk mig-tab-post -c mtk.json | mig-tab-post |
./mtk mig-tab-other -c mtk.json | mig-tab-other |
Step-by-step migration
The user controls the overall migration logic.
Step | Command | Desc |
---|---|---|
./mtk sync-schema -c mtk.json | mtk sync-schema | Migrate schema |
./mtk sync-sequence -c mtk.json | mtk sync-sequence | Migrate Sequence |
./mtk sync-object-type -c mtk.json | mtk sync-object-type | Migrate Object Type |
./mtk sync-domain -c mtk.json | mtk sync-domain | Migrate Domain |
./mtk sync-wrapper -c mtk.json | mtk sync-wrapper | Migrate DB2 Wrapper |
./mtk sync-server -c mtk.json | mtk sync-server | Migrate DB2 Server |
./mtk sync-user-mapping -c mtk.json | mtk sync-user-mapping | Migrate DB2 User Mapping |
./mtk sync-queue -c mtk.json | mtk sync-queue | Migrate queue table |
./mtk sync-table -c mtk.json | mtk sync-table | Migrate Table |
./mtk sync-nickname -c mtk.json | mtk sync-nickname | Migrate DB2 Nickname |
./mtk sync-rule -c mtk.json | mtk sync-rule | Migrate Rule |
./mtk sync-table-data -c mtk.json | mtk sync-table-data | Migrate Table Data |
./mtk sync-table-data-estimate -c mtk.json | mtk sync-table-data-estimate | Estimated table data migration time |
./mtk sync-index -c mtk.json | mtk sync-index | Migrate Index |
./mtk sync-constraint -c mtk.json | mtk sync-constraint | Migrate Constraint |
./mtk sync-db-link -c mtk.json | mtk sync-db-link | Migrate Database Link |
./mtk sync-view -c mtk.json | mtk sync-view | Migrate View |
./mtk sync-mview -c mtk.json | mtk sync-mview | Migrate Materialized View |
./mtk sync-function -c mtk.json | mtk sync-function | Migrate Function |
./mtk sync-procedure -c mtk.json | mtk sync-procedure | Migrate Procedure |
./mtk sync-package -c mtk.json | mtk sync-package | Migrate Package |
./mtk sync-trigger -c mtk.json | mtk sync-trigger | Migrate Trigger |
./mtk sync-synonym -c mtk.json | mtk sync-synonym | Migrate Synonym |
./mtk sync-table-data-com -c mtk.json | mtk sync-table-data-com | table row count comparison |
./mtk sync-alter-sequence -c mtk.json | mtk sync-alter-sequence | Modify sequence start value |
./mtk sync-coll-statistics -c mtk.json | mtk sync-coll-statistics | Gather table statistics |
./mtk check-table-data -c mtk.json | mtk check-table-data | Check table data for abnormal data |