MVD Usage
MVD is command line tool can be run only in the Shell interface. You can query the command help information by running the -h command.
Introduction:
MVD is a data verification tool for Heterogeneous Databases.
Options:
-h, --help : Show help message
-v, --version : Show tool version [3.0.0]
-x, --debug : Run in debug mode, means more output logs
--debug-md5 : Debug for print data before calculator MD5
-c, --config-file : Using a config file with format json
--mtk-config : Using a config file from MTK tool with format json
-C, --catagory : Compare catagory: A=All, M=Metadata, D=Data
-d, --func-dimension : [Advanced Option] Functions used in data comparison
Default: avg:a,min:np,max:np,median:np
Format: <name>:<primary_type> -- Same function name among all database
<primary_type> := a|p|np, a = all, p = primary table, np = not [p]
can be ignored, then use default [a]
Format: <name>:<function_list>:<primary_type>
<function_list> := <db_type> = <function_name> | <db_type> = <function_name>
<db_type> := ORACLE|DB2|MYSQL|POSTGRESQL|MOGDB|OPENGAUSS|SQLSERVER|INFORMIX
Example 'testmin:oracle=min|mogdb=min|mysql=min|db2=min:p'
-s, --source-db : Source database to be verified
Format: <db_type>:<ip>:<port>:<name>:<user>:<password>
<db_type> := ORACLE|DB2|MYSQL|POSTGRESQL|MOGDB|OPENGAUSS|SQLSERVER|INFORMIX
-t, --target-db : Target database to be verified, format see also '-s'
-w, --workers : Parallel workers (1~32), default: 8
-T, --table : Check a single table (source table info)
Format: <owner>.<table_name>
Tips: 1. if this option was specified, then '-i' and '-e' will be ignored
2. Name with mixed-case means case sensitive
-i, --include : Source White list, patterns used for object filter, all patterns combined with comma
Format: <type>:<owner>.<object_name>,...
<type>:<object_name>
<owner>.<object_name>
<object_name>
Tips: 1. <type> can use: */%/TABLE/VIEW/SEQUENCE/PROCEDURE/FUNCTION/OTHERS
2. Can use */% in <owner> and <object_name> field, means to match all
3. Name with mixed-case means case sensitive
-e, --exclude : Source Black list, patterns used for object filter, format see also '-i'
-r, --remap-schema : Schema transformation in comparision
Format: <source_schema>:<target_schema>,<source_schema>:<target_schema>...
--column-list : Set valid column list for data comparion, combined with comma
Format: <colume_1>,<colume_2>,<colume_3>,...
Tips: name with mixed-case means case sensitive
-f, --result-file : Result file, used to save result, default to print result to screen
-F, --result-format : Result file data format: json (default), plain
-R, --row-dir : Row directory for differences data (MD5 & KEY)
--row-feedback : Query row data when differences found, otherwise just key condition listed
--ignore-float : Ignore float data type in comparison
--float-prec : Float precision in data comparison, Range: 0-6, Default: 4
--double-prec : Double precision in data comparison, Range: 0-12, Default: 10
--fraction-prec : Fraction precision in data comparison, Range: 0-6, Default: 6 (Informix is 5)
-z, --zero-char : Specify a char for chr(0) in comparason, Default is empty char
-Z, --time-zone : Specify timezone for DB client, set empty use local, default is UTC(+00:00)
-l, --logfile : Write output information to logfile
-L, --license : Specify license file, default is: ./license.json
--apply-license : Apply for a new license from server
Usage:
1. Verify a single table (Using Statistics Analysis)
./mvd_macos_x86_64 -s
'ORACLE:127.0.0.1:1521:orcl:scott:tiger' -t 'MOGDB:127.0.0.1:5432:postgres:hongye:pwd' -T 'HONGYE.TEST'
2. Verify a single schema (Using MD5 ROW-BY-ROW)
./mvd_macos_x86_64 -s 'ORACLE:127.0.0.1:1521:orcl:scott:tiger' -t 'MOGDB:127.0.0.1:5432:postgres:hongye:pwd' -i 'HONGYE.*' -R './diff'
Command Line Option Description
Command Option | Description |
---|---|
-h, --help | Shows the help information of the tool. |
-v, --version | Shows the current version of the tool. |
-x, --debug | Enables the debug mode and outputs more detailed log content. This option is used only in the debugging process. |
--debug-md5 | Outputs the original value of the Python MD5 computing result. This option will open all data of a DB2/Oracle table and therefore large disk log space will be occupied. Please use it with caution. |
-c, --config-file | Specifies configuration parameters (JSON format) used during program execution. Configuration parameters can replace the specific command line options. |
--mtk-config | Specifies the configuration file (JSON format) used during MTK execution. It is used for verifying objects and table data involved in MTK synchronization. |
-C, --catagory | Specifies the comparison category. A refers to comparison of all information. M refers to comparison of only object structure. D refers to comparison of only data. |
-d, --func-dimension | This is an advanced option. If you are not very clear about its meaning, do not use it. Specifies the dimension of the statistical function during data comparison. The input format is as follows: 1. <name>:<primary_type> 2. <name>:<function_list>:<primary_type> Where: The value of primary_type an be a (all tables), p (primary key tables), and np (non-key value tables).name indicates the function name. If the function name is the actual function used in a database, the name does not need to be specified. Otherwise, the name needs to be specified. function_list indicates the format of the function in different databases. The format is <db_type>=<function_name> | <db_type>=<function_name> | ... The value of db_type can be ORACLE, DB2, MYSQL, POSTGRESQL, MOGDB, OPENGAUSS, INFORMIX, and SQLSERVER. |
-s, --source-db | Specifies the source database. The input format is <db_type>:<ip>:<port>:<name>:<user>:<password>. The value of db_type can be ORACLE, DB2, MYSQL, POSTGRESQL, MOGDB, OPENGAUSS, INFORMIX, and SQLSERVER. |
-t, --target-db | Specifies the target database. The input format is the same as that of -s . |
-w, --workers | Specifies the number of concurrent processes during data comparison. The value ranges from 1 to 32. The default value is 8. |
-T, --table | Specifies a single table to be compared. The input format is <owner>.<table_name>. Wildcard characters are not allowed to be used because they will conflict with -i and -e . |
-i, --include | Specifies a list of objects to be included for comparison. You can specify multiple matching modes and separate them with commas. The matching format includes <type>:<owner> .<object_name>, <owner>.<object_name>, <object_name>, .... * or % can be used in OWNER and OBJECT_NAME to mark wildcard characters.TYPE includes */%/TABLE/VIEW/SEQUENCE/PROCEDURE/FUNCTION/OTHERS. |
-e, --exclude | Specifies the list of objects to be excluded. The format is the same as that of -i . |
-r, --remap-schema | Specifies the mapping of schemas in the source and target databases during comparison. The schemas in the source and target databases have the same name but do not have the mapping relation by default. |
--column-list | Specify to compare only the data in the fields listed within this option |
-f, --result-file | Specifies the comparison result file. By default, no file will be generated, and the result is shown in the command line window. |
-F, --result-format | Specifies the comparison result format, including json and plain. The default value is plain, indicating the text format which is convenient for the user to read. |
-R, --row-dir | Specifies the folder where the row difference result is generated upon the execution of the MD5 row-by-row comparison mode. For each table with a difference, a difference file is created in that directory. |
--row-feedback | Specifies whether to show the full data of a difference row. Only KEY of a difference row is shown by default. (The KEY indicates ROWID in Oracle and CTID in PostgreSQL.) |
--ignore-float | Specifies whether to ignore the floating-point type (float, double, real, and other non-precise types) during data comparison. The floating-point type is not ignored by default. |
-z, --zero-char | Specifies the replacing character of the chr(0) character during comparison. The default value is null, which is to remove the chr(0) invisible characters. |
-Z, --time-zone | Specifies the time zone of the client data query, set the empty string to use the local OS time zone, if not set, use UTC (+00:00) time zone |
-l, --logfile | Specifies the log file for tool running. |
-L, --license | Specify the location of the license file, if license.json is not in the current directory, you need to specify it manually with this option |
--apply-license | Apply for a license |
Examples of Common Commands
The following lists command examples in common scenarios (using the MacOS 2.0 as an example).
Note: The method of comparing statistical eigenvalues is inefficient. It is recommended to use the MD5 row-by-row comparison method.
-
Apply for a license
./mvd_macos_x86_64 --apply-license
You need to enter the email address for receive the license during execution.
-
Compare the structures and data between Oracle and MogDB.
./mvd_macos_x86_64 -s 'ORACLE:127.0.0.1:1521:orcl:hongye:pwd' -t 'MOGDB:127.0.0.1:5432:omm:hongye:pwd' -i 'mtk.*' -R './diff'
-
Compare the structures and data between DB2 to MogDB.
./mvd_macos_x86_64 -s 'DB2:127.0.0.1:50000:HONGYE:db2inst1:pwd' -t 'MOGDB:127.0.0.1:5432:db2_mtk1:hongye:pwd' -i 'mtk.*' -R './diff'
-
Compare the structures and data between MySQL to MogDB.
./mvd_macos_x86_64 -s 'MYSQL:127.0.0.1:3306:hongye:root:pwd' -t 'MOGDB:127.0.0.1:5432:mysql_mtk:hongye:pwd' -i 'mtk.*' -R './diff'
-
Compare data in a table (eigenvalue comparison).
./mvd_macos_x86_64 -s 'ORACLE:127.0.0.1:1521:orcl:scott:tiger' -t 'MOGDB:127.0.0.1:5432:postgres:hongye:pwd' -T 'HONGYE.TEST'
-
Compare data and structures and precisely recognize rows that involve difference.
./mvd_macos_x86_64 -s 'ORACLE:127.0.0.1:1521:orcl:scott:tiger' -t 'MOGDB:127.0.0.1:5432:postgres:hongye:pwd' -i 'mtk.*' -R './diff'
-
Perform data verification after migration according to the MTK configuration file.
./mvd_macos_x86_64 --mtk-config oracle2opengauss.json