Updated on 2024-03-29 GMT+08:00

Constructing Data Before Migration

Before the migration, you need to construct some data types in the source database for data verification after the migration.

The following table lists data types supported by DRS.

Table 1 Data type mapping

Source Data Type

Destination Data Type

Sync (Source Data Type as Primary Key)

Sync (Source Data Type as Non-Primary Key)

Comparison (Source Data Type as Primary Key)

Comparison (Source Data Type as Non-Primary Key)

Remarks

CHAR

character

Supported

Supported

Supported. The spaces before and after the character are ignored.

Supported. The spaces before and after the character are ignored.

-

VARCHAR

character varying

Supported

Supported

Supported

Supported

The precision ranges of the source and destination databases are different, causing precision loss.

VARCHAR2

character varying

Supported

Supported

Supported

Supported

-

NCHAR

character

Supported

Supported

Supported. The spaces before and after the character are ignored.

Supported. The spaces before and after the character are ignored.

-

NVARCHAR2

nvarchar2

Supported

Supported

Supported

Supported

-

NUMBER

numeric

Supported

Supported

Supported

Supported

-

NUMBER (6,3)

numeric(6,3)

Supported

Supported

Supported

Supported

-

NUMBER (6,0)

Integer

Supported

Supported

Supported

Supported

-

NUMBER (3)

smallint

Supported

Supported

Supported

Supported

-

NUMBER (6,-2)

integer

Supported

Supported

Supported

Supported

-

BINARY_FLOAT

real

Unsupported (The destination database does not support creating tables using the primary key.)

Supported

Unsupported

Supported

The precision ranges of the source and destination databases are different, causing precision loss.

BINARY_DOUBLE

double precision

Unsupported (The destination database does not support creating tables using the primary key.)

Supported

Unsupported

Supported

-

FLOAT

real

Unsupported (The destination database does not support creating tables using the primary key.)

Supported

Unsupported

Supported

The precision ranges of the source and destination databases are different, causing precision loss.

INT

numeric

Supported

Supported

Supported

Supported

-

INTEGER

numeric

Supported

Supported

Supported

Supported

-

DATE

date

Supported

Supported

Unsupported

Supported

If a table with date type is created in the destination database, the data type precision range in the source database is different from that in the destination database, causing precision loss. Therefore, comparison is not supported.

TIMESTAMP

timestamp(6) without time zone

Supported

Supported

Unsupported

The value is accurate to six decimal places.

The maximum precision supported by the source database is 6.

TIMESTAMP_TZ

timestamp(6) with time zone

Unsupported (The source database does not support creating tables using the primary key.)

Supported

Unsupported

Filter this column.

-

TIMESTAMP_LTZ

timestamp(6) with time zone

Unsupported (The destination database does not support creating tables using the primary key.)

Supported

Unsupported

Filter this column.

-

INTERVAL_YM

interval year to month

Supported

Supported

Unsupported

Unsupported

Incremental synchronization does not support this type.

INTERVAL_DS

interval day to second

Supported

Supported

Unsupported

Unsupported

Incremental synchronization does not support this type. The maximum precision supported by the source database is 6.

BLOB

bytea

Unsupported (The source database does not support creating tables using the primary key.)

Supported

Unsupported

Filter this column.

-

CLOB

text

Unsupported (The source database does not support creating tables using the primary key.)

Supported

Unsupported

Filter this column.

-

NCLOB

text

Unsupported (The source database does not support creating tables using the primary key.)

Supported

Unsupported

Filter this column.

-

LONG

text

Unsupported (The source database does not support creating tables using the primary key.)

Supported

Unsupported

Filter this column.

-

LONG_RAW

bytea

Unsupported (The source database does not support creating tables using the primary key.)

Supported

Unsupported

Filter this column.

-

RAW

bytea

Unsupported (The destination database does not support creating tables using the primary key.)

Supported

Unsupported

Supported

-

RowID

character varying(18)

Supported

Supported

Supported

Supported

-

BFILE

-

Unsupported

Unsupported

Unsupported

Unsupported

Restrictions on the source database: The bfile type is not supported.

XMLTYPE

-

Unsupported

Unsupported

Unsupported

Unsupported

Restrictions on the source database: The xmltype type is not supported.

UROWID

-

Unsupported

Unsupported

Unsupported

Unsupported

Full and incremental synchronizations are not supported.

sdo_geometry

-

Unsupported

Unsupported

Unsupported

Unsupported

Restrictions on the source database: The sdo_geometry type is not supported.

NUMBER(*, 0)

numeric

Supported

Supported

Supported

Supported

-

Perform the following steps to construct data in the source database:

  1. Use a database connection tool to connect to the source Oracle database based on its IP address.
  2. Construct data in the source database based on data types supported by DRS.

    1. Create a test user.

      create user test_info identified by xxx;

      test_info indicates the user created for the test, and xxx indicates the password of the user.

    2. Assign permissions to the user.

      grant dba to test_info;

    3. Create a data table under the user.

      CREATE TABLE test_info.DATATYPELIST(

      ID INT,

      COL_01_CHAR______E CHAR(100),

      COL_02_NCHAR_____E NCHAR(100),

      COL_03_VARCHAR___E VARCHAR(1000),

      COL_04_VARCHAR2__E VARCHAR2(1000),

      COL_05_NVARCHAR2_E NVARCHAR2(1000),

      COL_06_NUMBER____E NUMBER(38,0),

      COL_07_FLOAT_____E FLOAT(126),

      COL_08_BFLOAT____E BINARY_FLOAT,

      COL_09_BDOUBLE___E BINARY_DOUBLE,

      COL_10_DATE______E DATE DEFAULT SYSTIMESTAMP,

      COL_11_TS________E TIMESTAMP(6),

      COL_12_TSTZ______E TIMESTAMP(6) WITH TIME ZONE,

      COL_13_TSLTZ_____E TIMESTAMP(6) WITH LOCAL TIME ZONE,

      COL_14_CLOB______E CLOB DEFAULT EMPTY_CLOB(),

      COL_15_BLOB______E BLOB DEFAULT EMPTY_BLOB(),

      COL_16_NCLOB_____E NCLOB DEFAULT EMPTY_CLOB(),

      COL_17_RAW_______E RAW(1000),

      COL_19_LONGRAW___E LONG RAW,

      COL_24_ROWID_____E ROWID,

      PRIMARY KEY(ID)

      );

    4. Insert two rows of data.

      insert into test_info.DATATYPELIST values(4,'huawei','xian','shanxi','zhongguo','shijie', 666,12.321,1.123,2.123,sysdate,sysdate,sysdate,sysdate,'hw','cb','df','FF','FF','AAAYEVAAJAAAACrAAA');

      insert into test_info.DATATYPELIST values(2,'Migrate-test','test1','test2','test3','test4', 666,12.321,1.123,2.123,sysdate,sysdate,sysdate,sysdate,'hw','cb','df','FF','FF','AAAYEVAAJAAAACrAAA');

    5. Make the above statements take effect.

      commit;

  3. Create a database in the GaussDB instance.

    1. Log in to the Huawei Cloud console.
    2. Click in the upper left corner and select a region.
    3. Click in the upper left corner of the page and choose Databases > Data Admin Service.
    4. In the navigation pane on the left, click Development Tool to go to the login list page.
    5. Click Add Login.
    6. On the displayed page, select the DB engine, source database, and target DB instance, enter the login username, password, and description (optional), and enable Collect Metadata Periodically and Show Executed SQL Statements.

      If Collect Metadata Periodically is enabled, select Remember Password.

    1. Click Test Connection to check whether the connection is successful.

      If a message is displayed indicating connection successful, continue with the operation. If a message is displayed indicating connection failed and the failure cause is provided, make modifications according to the error message.

    2. Click OK.
    3. Locate the added instance, click Log In in the Operation column.

    4. Choose SQL Operations > SQL Window on the top menu bar.

    5. Run the following statement to create a database compatible with Oracle:
      test_database_info indicates the database name. Replace it based on the site requirements.
      CREATE DATABASE test_database_info DBCOMPATIBILITY 'ORA';