All Products
Search
Document Center

ApsaraDB for OceanBase:Migrate data from an Oracle tenant of OceanBase Database to an Oracle database

Last Updated:Dec 12, 2024

This topic describes how to use the data transmission service to migrate data from an Oracle tenant of OceanBase Database to an Oracle database.

Important

A data migration task remaining in an inactive state for a long time may fail to be resumed depending on the retention period of incremental logs. Inactive states are Failed, Stopped, and Completed. The data transmission service releases data migration tasks remaining in an inactive state for more than 3 days to reclaim related resources. We recommend that you configure alerting for data migration tasks and handle task exceptions in a timely manner.

Background information

In the ApsaraDB for OceanBase console, you can create a task to migrate data from an Oracle tenant of OceanBase Database to an Oracle database. You can seamlessly migrate existing and incremental business data from the source database to the destination Oracle database through schema migration, full migration, and incremental synchronization.

The data transmission service also allows you to aggregate data of multiple tables in the source database to the same table in the destination database through full migration and incremental synchronization without schema migration. The merging and synchronization feature has the following limitations:

  • For full migration and incremental synchronization, the target table must contain all columns that exist in the source table. Otherwise, the data transmission service returns an error.

  • The source table must contain a primary key column.

  • The target table can contain a column that does not exist in the source table.

Prerequisites

  • The data transmission service has the privilege to access cloud resources. For more information, see Grant privileges to roles for data transmission.

  • You have created the corresponding schema in the destination Oracle database.

  • You have created dedicated database users in the source Oracle tenant of OceanBase Database and the destination Oracle database for data migration, and granted the required privileges to the users. For more information, see Create a database user.

  • You have created the __OCEANBASE_INNER_DRC_USER user in the corresponding tenant and granted the required privileges to the user before migration, if you want to migrate a table without a primary key. For more information, see Create the __OCEANBASE_INNER_DRC_USER user.

Limitations

  • Limitations on the source database

    Do not perform DDL operations that modify database or table schemas during schema migration or full data migration. Otherwise, the data migration task may be interrupted.

  • The data transmission service supports Oracle 10g, 11g, 12c, 18c, and 19c. Version 12c and later provide container databases (CDBs) and pluggable databases (PDBs).

  • The data transmission service does not support the incremental synchronization of a table if all columns in the table are of the following three large object (LOB) types: BLOB, CLOB, and NCLOB.

  • The data transmission service does not support the migration of a non-template-based subpartitioned table in an Oracle tenant of OceanBase Database to an Oracle database.

  • The data transmission service does not support expression-based indexes.

  • The data transmission service supports the aggregation of only tables with a primary key.

  • The data transmission service supports the migration of an object only when the following conditions are met: the database name, table name, and column name of the object are ASCII-encoded without special characters. The special characters are line breaks, spaces, and the following characters: . | " ' ` ( ) = ; / & \.

  • The data transmission service does not support triggers in the destination database. If triggers exist in the destination database, the data migration may fail.

  • Data source identifiers and user accounts must be globally unique in the data transmission system. ​####

  • You cannot create a database object whose name exceeds 30 bytes in length in an Oracle database of version 11g or earlier. When you migrate data from an Oracle tenant of OceanBase Database to an Oracle database, do not create an object with a name exceeding 30 bytes in length in the source database.

  • The data transmission service does not support the migration of spatial indexes, including existing spatial indexes and new spatial indexes generated by the INSERT INTO USER_SDO_GEOM_METADATA operation during incremental synchronization.

  • Take note of the following limitations on GIS data supported in an Oracle database:

    • Data with the spatial reference identifiers (SRIDs) of 0, 4327, and 4328 is not supported.

    • Data that will be converted into the scientific notation format by the get_wkt operation, such as SDO_POINT_TYPE(0.00001, 0.00001, 0), is not supported.

    • Only data with the coordinates ranging from -2147483647 to 2147483647 is supported.

    • When you use EPSG:4326, make sure that the longitude value ranges from -180 to 180 and the latitude value ranges from -90 to 90. Otherwise, data inconsistency may occur during the data migration.

    • Data with the number of digits on the right of the decimal point exceeding the maximum number allowed is not supported. This is because the read data in the scientific notation format cannot be written to an Oracle database.

      The read data in the scientific notation format is defined by two concepts:

      • scale: indicates the number of digits on the right of the decimal point in the data. For example, 123.45 has a scale of 2, and 0.000001 has a scale of 6.

      • precision: indicates the precision of the data, which is the number of digits starting from the first non-zero digit in the data. For example, 123.45 has a precision of 5, and 0.000001 has a precision of 1.

      If -scale + (precision +1) is less than -2, the data is converted into data in the scientific notation format with the base of 10.

      For example, 0.00001 has a scale of 5 and a precision of 1, and is converted into 1e-5e because -5 + (1 + 1) is equal to -3, which is less than -2. The specific value is obtained by the sdo_geometry.get_wkt() or SDO_UTIL.TO_WKTGEOMETRY method.

    • Data with a value greater than the maximum 32-bit integer (2147483647) or less than the minimum 32-bit integer (-2147483647) is not supported.

Considerations

  • Take note of the following considerations for reverse incremental migration from an Oracle tenant of OceanBase Database to an Oracle database:

    • When you perform incremental synchronization for an Oracle database, we recommend that you make sure that each archive file in the Oracle database is less than 2 GB in size.

    • Archive files must be stored for more than two days in the Oracle database. Otherwise, in the case of a sharp increase in the number of archive files, restore may fail due to the lack of required archive files.

    • The data transmission service can parse up to 5 TB of incremental logs of Oracle databases per day.

    • By default, the data transmission service does not support the reverse incremental migration of database objects, such as schemas, tables, and columns, with a name exceeding 30 bytes in length from an Oracle tenant of OceanBase Database to an Oracle database of version 12c or later. To migrate database objects with a name exceeding 30 bytes in length, contact OceanBase Technical Support.

    • The data transmission service does not support the execution of certain UPDATE statements in the Oracle database. The following example shows an unsupported UPDATE statement:

      UPDATE TABLE_NAME SET KEY=KEY+1;

      In the preceding statement, TABLE_NAME specifies the table name and KEY is a column of the NUMERIC type that is defined as the primary key column.

    • If a table does not have a primary key but contains data of the large object (LOB) type, the reverse incremental migration of the table can suffer poor data quality.

  • If you use OceanBase Database V4.x, we recommend that you enable log archiving. After log archiving is enabled, if clogs are recycled, the data transmission service can still implement incremental synchronization by consuming archive logs.

  • If the UTF-8 character set is used in the source database, we recommend that you use a compatible character set, such as UTF-8 or UTF-16, in the destination database to avoid garbled characters.

  • If the clocks between nodes or between the client and the server are out of synchronization, the latency may be inaccurate during incremental synchronization or reverse incremental migration.

    For example, if the clock is earlier than the standard time, the latency can be negative. If the clock is later than the standard time, the latency can be positive.

  • When the Oracle database and the Oracle tenant of OceanBase Database use different character sets, the field length varies based on the type of the data migration task.

  • To migrate data from a table without a primary key, you must add a hidden column to the destination table. However, if the destination is an Oracle database of a version earlier than 12c, you must add a non-hidden column to the destination table.

  • If the source table contains the OMS_PK_INCRMT field, the incremental synchronization task will be interrupted and cannot be resumed.

  • If you modify a unique index at the destination when DDL synchronization is disabled, you must restart the data migration task to avoid data inconsistency.

  • If forward switchover is disabled for a data migration task, drop the unique indexes and pseudocolumns from the destination database. If you do not drop the unique indexes and pseudocolumns, data cannot be written, and pseudocolumns will be generated again when data is imported to the downstream system, causing conflicts with the pseudocolumns in the source database.

    If forward switchover is enabled for the data migration task, the data transmission service will automatically drop the hidden columns and unique indexes based on the type of the migration task. For more information, see Mechanisms for handling hidden columns.

  • Take note of the following considerations if you want to aggregate multiple tables:

    • We recommend that you configure the mappings between the source and destination databases by specifying matching rules.

    • We recommend that you manually create schemas at the destination. If you create a schema by using the data transmission service, skip the failed objects in the schema migration step.

  • Check the objects in the recycle bin of the Oracle tenant of OceanBase Database. If the recycle bin contains more than 100 objects, internal table queries may time out. You must clear the objects in the recycle bin.

    • Query whether the recycle bin is enabled.

      SELECT Value FROM V$parameter WHERE Name = 'recyclebin';
    • Query the number of objects in the recycle bin.

      SELECT count(*) FROM RECYCLEBIN;
  • If you skip the database ROW_MOVEMENT check for the source primary database during migration, data inconsistency may occur when you synchronize tables with the ROW_MOVEMENT value set to enable.

  • In a data migration task where the source is an OceanBase database and DDL synchronization is enabled, if a RENAME operation is performed on a table in the source database, we recommend that you restart the task to avoid data loss during incremental synchronization.

  • If you selected only Incremental Synchronization when you created the data migration task, the data transmission service requires that the local incremental logs of the source database be retained for at least 48 hours.

    If you selected Full Migration and Incremental Synchronization when you created the data migration task, the data transmission service requires that the local incremental logs of the source database be retained for at least 7 days. If the data transmission service cannot obtain incremental logs, the data migration task may fail or even the data between the source and destination databases may be inconsistent after migration.

  • If the source or destination database contains table objects that differ only in letter cases, the data migration results may not be as expected due to case insensitivity in the source or destination database.

Supported source and destination instance types

In the following table, OB_Oracle stands for an Oracle tenant of OceanBase Database.

Source

Destination

OB_Oracle (OceanBase cluster instance)

Oracle (self-managed database in a VPC)

Data type mappings

Oracle tenant of OceanBase Database

Oracle database

CHAR(n CHAR)

CHAR(n CHAR)

CHAR(n BYTE)

CHAR(n BYTE)

NCHAR(n)

NCHAR(n)

NCHAR(n BYTE)

NCHAR(n)

VARCHAR2(n)

VARCHAR2(n)

NVARCHAR2(n)

NVARCHAR2(n)

NVARCHAR2(n BYTE)

NVARCHAR2(n)

NUMBER(n)

NUMBER(n)

NUMBER(p, s)

NUMBER(p,s)

RAW

RAW

CLOB

CLOB

BLOB

BLOB

FLOAT(n)

FLOAT (n)

BINARY_FLOAT

BINARY_FLOAT

BINARY_DOUBLE

BINARY_DOUBLE

DATE

DATE

TIMESTAMP

TIMESTAMP

TIMESTAMP WITH TIME ZONE

TIMESTAMP WITH TIME ZONE

TIMESTAMP WITH LOCAL TIME ZONE

TIMESTAMP WITH LOCAL TIME ZONE

INTERVAL YEAR(p) TO MONTH

INTERVAL YEAR(p) TO MONTH

INTERVAL DAY(p) TO SECOND

INTERVAL DAY(p) TO SECOND

ROWID

ROWID

UROWID

UROWID

SDO_GEOMETRY

SDO_GEOMETRY

Create a data migration task

  1. Log on to the ApsaraDB for OceanBase console and purchase a data migration task.

    For more information, see Purchase a data migration task.

  2. Choose Data Transmission > Data Migration. On the page that appears, click Configuration for the data migration task.

    image.png

    If you want to reference the configurations of an existing task, click Reference Configuration. For more information, see Reference the configuration of a data migration task.

  3. On the Select Source and Destination page, configure the parameters.

    Parameter

    Description

    Migration Task Name

    We recommend that you set it to a combination of digits and letters. It must not contain any spaces and cannot exceed 64 characters in length.

    Tag (Optional)

    Select a target tag from the drop-down list. You can also click Manage Tags to create, modify, and delete tags. For more information, see Use tags to manage data migration tasks.

    Source

    If you have created an Oracle tenant in OceanBase Database as a data source, select it from the drop-down list. Otherwise, click New Data Source in the drop-down list and create one in the dialog box that appears on the right. For more information about the parameters, see Create an OceanBase data source.

    Important

    For an Oracle tenant of OceanBase Database, Instance Type must be set to OceanBase Cluster Instance.

    Destination

    If you have created an Oracle data source, select it from the drop-down list. Otherwise, click New Data Source in the drop-down list and create one in the dialog box that appears on the right. For more information about the parameters, see Create an Oracle data source.

  4. Click Next. On the Select Migration Type page, specify migration types for the current data migration task.

    Valid values of Migration Type are Schema Migration, Full Migration, Incremental Synchronization, Full Verification, and Reverse Incremental Migration.

    image

    Migration type

    Description

    Schema migration

    After a schema migration task is started, the data transmission service migrates the definitions of database objects (such as tables, indexes, constraints, comments, and views) from the source database to the destination database and automatically filters out temporary tables.

    Full migration

    After a full migration task is started, the data transmission service migrates existing data of tables in the source database to corresponding tables in the destination database. If you select Full Migration, we recommend that you collect the statistics of the Oracle tenant of OceanBase Database before the data migration.

    Incremental synchronization

    After an incremental synchronization task is started, the data transmission service synchronizes changed data (data that is added, modified, or removed) from the source database to corresponding tables in the destination database.

    Options for Incremental Synchronization are DML Synchronization and DDL Synchronization. You can select operations as needed. For more information, see Configure DDL/DML synchronization. Incremental Synchronization has the following limitations:

    • If you select DDL Synchronization, when you perform a DDL operation for synchronization that is not supported by the data transmission service in the source database, the data migration may be interrupted.

    • If the DDL operation is ADD COLUMN, we recommend that you set the column to a NULL column. Otherwise, data migration may be interrupted.

    Full verification

    After the full migration and incremental synchronization tasks are completed, the data transmission service automatically initiates a full verification task to verify the tables in the source and destination databases.

    • If you select Full Verification, we recommend that you collect the statistics of the Oracle tenant of OceanBase Database and use the GATHER_SCHEMA_STATS or GATHER_TABLE_STATS statement to collect the statistics of the Oracle database before full verification.

    • If you selected Incremental Synchronization but did not select all DML operations in the DML Synchronization section, you cannot select Full Verification.

    Reverse incremental migration

    Data changes made in the destination database after the business database switchover are synchronized to the source database in real time through reverse incremental migration.

    Generally, incremental synchronization configurations are reused for reverse incremental migration. You can also customize the configurations for reverse incremental migration as needed.

  5. Click Next. On the Select Migration Objects page, specify the migration objects for the migration task.

    You can select Specify Objects or Match Rules to specify the migration objects.

    Important
    • The names of tables to be migrated, as well as the names of columns in the tables, must not contain Chinese characters.

    • If a database or table name contains double dollar signs ($$), you cannot create the migration task.

    • If you selected DDL Synchronization in the Select Synchronization Type step, we recommend that you select migration objects by using the Match Rules option. This ensures that all new objects meeting the matching rules are synchronized. If you select migration objects by using the Specify Objects option, new or renamed objects will not be synchronized.

    • If you select Specify Objects, select the objects to be migrated on the left and click > to add them to the list on the right. You can select tables and views of one or more databases as the migration objects.

      The data transmission service allows you to import objects from text files, rename destination objects, set row filters, view column information, and remove a single or all migration objects.

      Note

      When you select Match Rules to specify migration objects, object renaming is implemented based on the syntax of the specified matching rules. In the operation area, you can only set filter conditions. For more information, see Configure matching rules.

      image.png

      Operation

      Description

      Import objects

      1. In the list on the right, click Import Objects in the upper-right corner.

      2. In the dialog box that appears, click OK.

        Important

        This operation will overwrite previous selections. Proceed with caution.

      3. In the Import Objects dialog box, import the objects to be migrated.

        You can import CSV files to rename databases or tables and set row filtering conditions. For more information, see Download and import the settings of migration objects.

      4. Click Validate.

        After you import the migration objects, check their validity. Column field mapping is not supported at present.

      5. After the validation succeeds, click OK.

      Rename objects

      The data transmission service allows you to rename migration objects. For more information, see Rename a database table.

      Configure settings

      The data transmission service allows you to filter rows by using WHERE conditions. For more information, see Use SQL conditions to filter data.

      You can also view column information of the migration objects in the View Columns section.

      Remove one or all objects

      The data transmission service allows you to remove a single object or all migration objects that are added to the right-side list during data mapping.

      • Remove a single migration object

        In the list on the right, move the pointer over the object that you want to remove, and click Remove to remove the migration object.

      • Remove all migration objects

        In the list on the right, click Remove All in the upper-right corner. In the dialog box that appears, click OK to remove all migration objects.

    • Select Match Rules. For more information, see Configure matching rules.

  6. Click Next. On the Migration Options page, configure the parameters.

    • Full migration

      The following table describes the parameters for full migration, which are displayed only if you have selected Full Data Migration on the Select Migration Type page.

      image

      Parameter

      Description

      Read Concurrency Configuration

      The concurrency for reading data from the source during full migration. The maximum value is 512. A high read concurrency may incur excessive stress on the source, affecting the business.

      Write Concurrency Configuration

      The concurrency for writing data to the destination during full migration. The maximum value is 512. A high write concurrency may incur excessive stress on the destination, affecting the business.

      Full Data Migration Rate Limit

      You can choose whether to limit the full migration rate as needed. If you choose to limit the full migration rate, you must specify the records per second (RPS) and bytes per second (BPS). The RPS specifies the maximum number of data rows migrated to the destination per second during full migration, and the BPS specifies the maximum amount of data in bytes migrated to the destination per second during full migration.

      Note

      The RPS and BPS values specified here are only for throttling. The actual full migration performance is subject to factors such as the settings of the source and destination and the instance specifications.

      Processing Strategy When Destination Table Has Records

      Valid values include Ignore and Stop Migration.

      • If you select Ignore, when the data to be inserted conflicts with existing data of a destination table, the data transmission service logs the conflicting data while retaining the existing data.

        Important

        If you select Ignore, data is pulled in IN mode during full verification. In this case, verification is inapplicable if the destination contains data that does not exist in the source, and the verification performance is downgraded.

      • If you select Stop Migration and a destination table contains records, an error prompting migration unsupported is reported during full migration. In this case, you must process the data in the destination table before continuing with the migration.

        Important

        If you click Resume in the dialog box prompting the error, the data transmission service ignores this error and continues to migrate data. Proceed with caution.

      Whether to Allow Post-indexing

      Specifies whether to create indexes after the full data migration is completed. Post-indexing can shorten the time required for full data migration. For more information about the considerations on post-indexing, see the description below.

      Important
      • This parameter is displayed only if you have selected both Schema Migration and Full Data Migration on the Select Migration Type page.

      • Only non-unique key indexes can be created after the migration is completed.

      If you select Allow, set the following parameters:

      • Single Index DDL Concurrency Configuration: the maximum number of concurrent DDL operations allowed for a single index. A larger value indicates higher resource consumption and faster data migration.

      • Maximum concurrent index DDL quantity configuration: the maximum number of post-indexing DDL operations that the system can call at a time.

      If post-indexing is allowed, we recommend that you adjust the parameter settings based on the hardware conditions of OceanBase Database and the business traffic.

      • If you use OceanBase Database V4.x, adjust the settings of the following parameters of the sys tenant and business tenants by using a command-line interface (CLI) client.

        • Adjust the parameter settings of the sys tenant

          // parallel_servers_target specifies the queue condition for parallel queries on each server. 
          // To maximize performance, we recommend that you set this parameter to a value greater than, for example, 1.5 times, the number of physical CPU cores. In addition, make sure that the value does not exceed 64, to prevent database kernels from contending for locks. 
          set global parallel_servers_target = 64; 
        • Adjust the parameter settings of a business tenant

          // Specify the limit on the file memory buffer size.
          alter system set _temporary_file_io_area_size = '10' tenant = 'xxx'; 
          // Disable throttling in V4.x.
          alter system set sys_bkgd_net_percentage = 100;
      • If you use OceanBase Database V3.x, adjust the settings of the following parameters of the sys tenant by using a CLI client.

        // parallel_servers_target specifies the queue condition for parallel queries on each server. 
        // To maximize performance, we recommend that you set this parameter to a value greater than, for example, 1.5 times, the number of physical CPU cores. In addition, make sure that the value does not exceed 64, to prevent database kernels from contending for locks. 
        set global parallel_servers_target = 64; 
        // data_copy_concurrency specifies the maximum number of concurrent data migration and replication tasks allowed in the system. 
        alter system set data_copy_concurrency = 200;
    • Incremental synchronization

      The following table describes the parameters for incremental synchronization, which are displayed only if you have selected Incremental Synchronization on the Select Migration Type page.

      image

      Parameter

      Description

      Write Concurrency Configuration

      The concurrency for writing data to the destination during incremental synchronization. The maximum value is 512. A high write concurrency may incur excessive stress on the destination, affecting the business.

      Incremental Synchronization Rate Limit

      You can choose whether to limit the incremental synchronization rate as needed. If you choose to limit the incremental synchronization rate, you must specify the the records per second (RPS) and bytes per second (BPS). The RPS specifies the maximum number of data rows synchronized to the destination per second during incremental synchronization, and the BPS specifies the maximum amount of data in bytes synchronized to the destination per second during incremental synchronization.

      Note

      The RPS and BPS values specified here are only for throttling. The actual incremental synchronization performance is subject to factors such as the settings of the source and destination and the instance specifications.

      Incremental Synchronization Start Timestamp

      • If you have set the migration type to Full Data Migration, this parameter is not displayed.

      • If you have selected Incremental Synchronization but not Full Data Migration, specify a point in time after which the data is to be synchronized. The default value is the current system time. For more information, see Set an incremental synchronization timestamp.

    • Reverse incremental migration

      The following table describes the parameters for reverse incremental migration, which are displayed only if you have selected Reverse Increment on the Select Migration Type page. By default, incremental synchronization configurations are reused for reverse incremental migration.

      image

      You can choose not to reuse the incremental synchronization configurations and configure reverse incremental migration as needed.

      Parameter

      Description

      Write Concurrency Configuration

      The concurrency for writing data to the source during reverse incremental migration. The maximum value is 512. A high concurrency may incur excessive stress on the source, thereby affecting the business.

      Incremental Synchronization Rate Limit

      You can choose whether to limit the incremental synchronization rate as needed. If you choose to limit the reverse incremental migration rate, you must specify the the RPS and BPS. The RPS specifies the maximum number of data rows synchronized to the source per second during reverse incremental migration, and the BPS specifies the maximum amount of data in bytes synchronized to the source per second during reverse incremental migration.

      Note

      The RPS and BPS values specified here are only for throttling. The actual reverse incremental migration performance is subject to factors such as the settings of the source and destination and the instance specifications.

      Incremental Synchronization Start Timestamp

      By default, the forward switchover start timestamp (if any) prevails. This parameter cannot be modified.

    • Advanced migration configuration

      This section is displayed only if the source is of OceanBase Database V4.3.0 or later and you have selected Reverse Incremental Migration > DDL Synchronization on the Select Migration Type page.

      image

      This parameter specifies the storage type for source table objects during reverse incremental migration. The storage types supported for source table objects are Default, Row storage, Column storage, and Hybrid columnar storage. For more information, see default_table_store_format.

      Note

      The value Default means that other parameters are automatically set based on the parameter configurations of the destination. For new table objects in reverse incremental DDL synchronization, the schemas are subject to the specified storage type.

  7. Click Precheck to start a precheck on the data migration task.

    During the precheck, the data transmission service checks the read and write privileges of the database users and the network connections of the databases. A data migration task can be started only after it passes all check items. If an error is returned during the precheck, you can perform the following operations:

    • Identify and troubleshoot the problem and then perform the precheck again.

    • Click Skip in the Actions column of the failed precheck item. In the dialog box that prompts the consequences of the operation, click OK.

  8. After the precheck succeeds, click Start Task.

    If you do not need to start the task now, click Save. You can start the task later on the Migration Tasks page or by performing batch operations. For more information about batch operations, see Perform batch operations on data migration tasks.

    The data transmission service allows you to modify the migration objects when a migration task is running. For more information, see View and modify migration objects and their filter conditions. After the data migration task is started, it is executed based on the selected migration types. For more information, see View migration details.

References