Help Center/ Cloud Data Migration/ User Guide/ Tutorials/ Migrating Data from Oracle to DWS
Updated on 2022-09-22 GMT+08:00

Migrating Data from Oracle to DWS

Scenario

CDM supports table-to-table migration. This section describes how to use CDM to migrate data from Oracle to Data Warehouse Service (DWS). The procedure is as follows:

  1. Creating a CDM Cluster and Binding an EIP to the Cluster
  2. Creating an Oracle Link
  3. Creating a DWS Link
  4. Creating a Migration Job

Prerequisites

  • You have obtained a DWS cluster and the IP address, port number, database name, username, and password for connecting to the DWS database. In addition, you must have the read, write, and delete permissions on the DWS database.
  • You have obtained the IP address, name, username, and password of the Oracle database.
  • If the Oracle database is deployed on an on-premises data center or a third-party cloud, ensure that an IP address that can be accessed from the public network has been configured for the Oracle database, or the VPN or Direct Connect between the on-premises data center and has been established.
  • You have uploaded an Oracle database driver by following the instructions provided in Managing Drivers.

Creating a CDM Cluster and Binding an EIP to the Cluster

  1. If is an independent CDM service, create a CDM cluster by following the instructions provided in Creating a Cluster. If is used as a CDM component of DataArts Studio, create a CDM cluster by following the instructions provided in Creating a Cluster.

    The key configurations are as follows:

    • The flavor of the CDM cluster is selected based on the amount of data to be migrated. Generally, cdm.medium meets the requirements for most migration scenarios.
    • The VPC, subnet, and security group of the CDM cluster must be the same as those of the DWS cluster.
    • If the same subnet and security group cannot be used, for security reasons, ensure that a security group rule has been configured to allow the CDM cluster to access the CSS cluster.

  2. After the CDM cluster is created, locate the row that contains the cluster and click Bind EIP in the Operation column. (CDM uses an EIP to access the Oracle data source.)

    If SSL encryption is configured for the access channel of a local data source, CDM cannot connect to the data source using the EIP.

Creating an Oracle Link

  1. Click Job Management in the Operation column of the CDM cluster. On the displayed page, click the Links tab and then Create Link. The Select Connector page is displayed.

    Figure 1 Selecting a connector type

  2. Select Oracle and click Next to configure parameters for the link.

    Figure 2 Creating an Oracle link
    Table 1 Oracle link parameters

    Parameter

    Description

    Example Value

    Name

    Enter a unique link name.

    oracle_link

    Database Server

    Database server domain name or IP address

    192.168.0.1

    Port

    Oracle database port

    3306

    Connection Type

    Type of the Oracle database link

    Service Name

    Database Name

    Name of the database to be connected

    db_user

    Username

    User who has the read permission of the Oracle database

    admin

    Password

    Password used for logging in to the Oracle database

    -

    Use Agent

    Whether to extract data from the data source through an agent

    Yes

    Agent

    Click Select and select the agent created in Connecting to an Agent.

    -

    Oracle Version

    The latest version is used by default. If the version is incompatible, select another version.

    Later than 12.1

    Driver Version

    A driver version that adapts to the Oracle database

    -

    Fetch Size

    Number of rows obtained by each request

    1000

    Link Attributes

    Custom attributes of the link

    useCompression=true

    Reference Sign

    Delimiter used to separate referenced table names or column names This parameter is left blank by default.

    '

  3. Click Save. The Links page is displayed.

Creating a DWS Link

  1. Click Job Management in the Operation column of the CDM cluster. On the displayed page, click the Links tab and then Create Link. The Select Connector page is displayed.

    Figure 3 Selecting a connector type

  2. Select Data Warehouse Service and click Next to configure the DWS link parameters. Set the mandatory parameters listed in Table 2 and retain the default values for the optional parameters.

    Table 2 DWS link parameters

    Parameter

    Description

    Example Value

    Name

    Enter a unique link name.

    dwslink

    Database Server

    IP address or domain name of the DWS database

    192.168.0.3

    Port

    DWS database port

    8000

    Database Name

    Name of the DWS database

    db_demo

    Username

    User who has the read, write, and delete permissions on the DWS database

    dbadmin

    Password

    Password of the user

    -

    Use Agent

    Whether to extract data from the data source through an agent

    Yes

    Agent

    Click Select and select the agent created in Connecting to an Agent.

    -

    Import Mode

    COPY: Migrate the source data to the DWS management node and then copy the data to DataNodes. To access DWS through the Internet, select COPY.

    COPY

  3. Click Save.

Creating a Migration Job

  1. Choose Table/File Migration > Create Job to create a job for exporting data from the Oracle database to DWS.

    Figure 4 Creating a job for migrating data from Oracle to DWS
    • Job Name: Enter a unique name.
    • Source Job Configuration
      • Source Link Name: Select the oracle_link created in Creating an Oracle Link.
      • Schema/Tablespace: Enter the name of the database whose data is to be migrated.
      • Table Name: Enter the name of the table whose data is to be migrated.
      • Retain the default values of the optional parameters in Show Advanced Attributes. For details, see From a Common Relational Database.
    • Destination Job Configuration
      • Destination Link Name: Select the dwslink created in Creating a DWS Link.
      • Schema/Tablespace: Select the DWS database to which data is to be written.
      • Auto Table Creation: This parameter is displayed only when both the migration source and destination are relational databases.
      • Table Name: Name of the table to which data is to be written. You can enter a table name that does not exist. CDM automatically creates the table in DWS.
      • Orientation: You can create row- or column-store tables as needed. Generally, if a table contains many columns (called a wide table) and its query involves only a few columns, column storage is recommended. If a table contains only a few columns and a query includes most of the fields, row storage is recommended.
      • Extend char length: If the data encoding formats of the migration source and destination are different, the character length of the automatic table creation may be insufficient. If you select Yes for this parameter, the character length will be increased by three times during automatic table creation.
      • Clear Data Before Import: whether to clear data in the destination table before the migration task starts.

  2. Click Next. The Map Field page is displayed. CDM automatically matches the source and destination fields, as shown in Figure 5.

    • If the field mapping is incorrect, you can drag the fields to adjust the mapping.
    • You can map fields in batches.
    • The expressions in CDM support field conversion of common character strings, dates, and values. For details, see Converting Fields.
    Figure 5 Table-to-table field mapping

  3. Click Next and set task parameters. Generally, retain the default values of all parameters.

    In this step, you can configure the following optional functions:
    • Retry Upon Failure: If the job fails to be executed, you can determine whether to automatically retry. Retain the default value Never.
    • Group: Select the group to which the job belongs. The default group is DEFAULT. On the Job Management page, jobs can be displayed, started, or exported by group.
    • Schedule Execution: To configure scheduled jobs, see Scheduling Job Execution. Retain the default value No.
    • Concurrent Extractors: Enter the number of extractors to be concurrently executed. You can increase the value of this parameter to improve migration efficiency.
    • Write Dirty Data: Dirty data may be generated during data migration between tables. You are advised to select Yes.
    • Delete Job After Completion: Retain the default value Do not delete.

  4. Click Save and Run. The Job Management page is displayed, on which you can view the job execution progress and result.
  5. After the job is successfully executed, in the Operation column of the job, click Historical Record to view the job's historical execution records and read/write statistics.

    On the Historical Record page, click Log to view the job logs.

If the migration times out because writing data to the destination costs a long time, reduce the value of the Fetch Size parameter.