Updated on 2023-01-05 GMT+08:00

From Oracle to PostgreSQL

Supported Source and Destination Databases

Table 1 Supported databases

Source DB

Destination DB

  • On-premises Oracle databases
  • Oracle databases on an ECS
  • RDS for PostgreSQL

Suggestions

  • When a task is being started or in the full migration phase, do not perform DDL operations on the source database. Otherwise, the task may be abnormal.
  • To maintain data consistency before and after the migration, do not write data to the source and destination databases in the full migration mode. In the full+incremental migration mode, you can continue the migration while data is still being written to the source database.
  • The success of migration depends on environment and manual operations. You can run a migration test before you start the full-scale migration to help you detect and resolve problems in advance.
  • Start your migration task during off-peak hours. A less active database is easier to migrate successfully. If the data is fairly static, there is less likely to be any severe performance impacts during the migration.
    • If network bandwidth is not limited, the query rate of the source database increases by about 50 MB/s during full migration, and two to four CPUs are occupied.
    • To ensure data consistency, tables to be migrated without a primary key may be locked for 3s.
    • The data being migrated may be locked by other transactions for a long period of time, resulting in read timeout.
    • If DRS concurrently reads data from a database, it will use about 6 to 10 sessions. The impact of the connections on services must be considered.
    • If you read a table, especially a large table, during the full migration, the exclusive lock on that table may be blocked.
  • Data-level comparison

    To obtain accurate comparison results, compare data at a specified time point during off-peak hours. If it is needed, select Start at a specified time for Comparison Time. Due to slight time difference and continuous operations on data, inconsistent comparison results may be generated, reducing the reliability and validity of the results.

Precautions

Before creating a migration task, read the following notes:
Table 2 Precautions

Type

Restrictions

Database permissions

  • The source database must have the following minimum permissions:

    CREATE SESSION, SELECT ANY TRANSACTION, SELECT ANY TABLE, SELECT ANY DICTIONARY and SELECT ANY SEQUENCE.

  • The destination database must have the following minimum permissions:

    The permissions to create databases and tables in the destination database.

Migration objects

  • Tables, indexes, constraints, sequences, and data can be migrated. Other database objects, such as stored procedures, cannot be migrated.
  • Full synchronization does not support the following column types: bfile, xml, sdo_geometry, urowid, and self-defined types.
  • For the TIMESTAMP WITH TIME ZONE data type, the data cannot be greater than 9999-12-31 23:59:59.999999 after being converted based on the time zone of the destination database.
  • Tables whose default values contain expressions of functions cannot be migrated.
  • The default values of the source database can be to_date and sys_guid functions. To use a function as the default value, ensure that the destination database has the same function. For example, if the source database contains the sys_guid function, the uuid_generate_v1 function is required in the destination PostgreSQL database. If the sys_guid function fails to be migrated, run the following statement in the destination database to install the plug-in and retry the task:
    create extension if not exists "uuid-ossp";
  • Function indexes cannot be migrated.

    Example:

    create index idx_t on t(substr(dt, 1, 8));

Source database

  • PostgreSQL and Oracle database structures are different. The former has a schema. Therefore the statement for creating views cannot contain db.Table. Otherwise, the view migration fails.

    Example: Change the statement 1 to statement 2.

    Statement 1:

    create view v1 as select id from db1.t1;

    Statement 2:

    create view v1 as select id from t1;
  • The maximum precision supported by timestamp and interval day to second is 6.
  • The data type cannot be bfile, xmltype, sdo_geometry, or user-defined.
  • The source database cannot contain tables with same names but different letter cases.
  • The names of databases and tables cannot contain non-ASCII characters or special characters .><\`|,?'!"
  • If the destination database is PostgreSQL Enhanced Edition, the trigger name in the source database must be unique.
  • An empty source database cannot be migrated.
  • Only the following character sets are supported: ZHS16GBK, AL32UTF8, UTF8, US7ASCII, and WE8MSWIN1252.

Destination database

  • The destination instance must be the RDS PostgreSQL Enhanced Edition DB instance.
  • The destination database cannot contain objects whose names are lowercase version of the source database object names.

Precautions

  • Objects that have dependencies must be migrated at the same time to avoid migration failure. Common dependencies: tables referenced by primary or foreign keys
  • You can migrate one database (owner) at a time in a single migration task. To migrate multiple databases, you need to create multiple tasks.
  • After objects such as tables are migrated to the destination database, their names are converted into lowercase letters. For example, the name of object ABC is changed to abc after being migrated to the destination database.
  • The time zone settings of the source and destination database must be the same.
  • If there are special characters in the Oracle database, the code of the destination Oracle database must be the same as the code of the source Oracle database. Otherwise, garbled characters are displayed in the destination database.
  • The table without a primary key lacks a unique identifier for rows. When the network is unstable, you may need to retry the task several times, or data inconsistency may occur.
  • If the data types are incompatible, the migration may fail.
  • During the migration, writing data to the source and destination databases is not allowed. Otherwise, data inconsistency may occur.
  • During the migration, do not modify or delete the usernames, passwords, permissions, or ports of the source and destination databases.
  • During task startup or full migration, you are not advised to perform DDL operations on the source database, such as deleting the database or indexes. Otherwise, the migration may fail.
  • During a full migration, DRS writes large amount of data to the destination PostgreSQL database. As a result, the number of PostgreSQL WAL logs increases sharply, and the PostgreSQL disk space may be used up. You can disable the PostgreSQL log backup function before the full migration to reduce the number of WAL logs. After the migration is complete, enable the function.
    CAUTION:

    Disabling log backup will affect database disaster recovery. Exercise caution when performing this operation.