All Products
Search
Document Center

PolarDB:Data migration

Last Updated:Nov 25, 2026

When you have completed the assessment and are ready to migrate data from a self-managed Oracle database to a PolarDB for PostgreSQL (Compatible with Oracle) cluster, Data Transmission Service (DTS) is the core tool for this purpose. Direct data migration may cause data inconsistency or even migration failure if compatibility differences between databases (such as sequences, case sensitivity, and character sets) are not handled properly. This document serves as your operation manual. It describes how to configure a DTS task and explains the key limits and precautions during migration in detail, helping you complete a smooth and reliable data migration.

Features

DTS supports migrating your self-managed Oracle database to a PolarDB for PostgreSQL (Compatible with Oracle). It provides three core migration capabilities that you can combine flexibly based on business requirements. We recommend that you configure schema migration, full migration, and incremental migration at the same time to migrate self-managed applications to the cloud without downtime.

  • Schema migration: Migrates database object definitions in the source database (such as tables, views, stored procedures, and functions) to the target database.

  • Full migration: Copies all existing data in the source database at the time of migration to the target database in a single operation.

  • Incremental migration: On the basis of full migration, continuously captures data changes in the source database (Redo Log and Archive Log) and synchronizes them to the target database in real time. This is the key to smooth migration without service downtime.

Common migration methods

Migration method

Business downtime

Data consistency

Cost

Use cases

Schema migration

None

/

Free

Only pre-creates the database schema. Suitable for setting up empty development or test environments.

Schema migration + full migration

Long (you must wait for the full migration to complete)

  • Data is written during migration: data inconsistency.

  • No data is written during migration: data consistency.

Free

Suitable for relocating non-core services that can tolerate long downtime, or for data initialization in development or test environments.

Schema migration + full migration + incremental migration

No downtime (no service interruption)

Regardless of whether data is written during migration, data is consistent after the migration is complete (when incremental migration has no latency).

Billed

Online smooth migration of core services. Suitable for production systems that are sensitive to downtime.

Billing

When you use DTS to migrate a self-managed Oracle database to a PolarDB for PostgreSQL (Compatible with Oracle), schema migration, full migration, and public network traffic are free, and the following items are billed:

  • Incremental migration: If incremental migration is selected when you configure the migration task, you are billed while incremental migration is running normally (no charge applies during schema migration and full migration, or while incremental migration is paused or fails).

  • Data validation: If data validation is selected when you configure the migration task, data validation fees may be incurred.

Prerequisites

Before you create a migration task, you must complete the following preparations and checks:

  • Source self-managed Oracle database version: 9i, 10g, 11g, 12c, 18c, and 19c.

  • The available storage space of the target PolarDB for PostgreSQL (Compatible with Oracle) cluster must be greater than the used storage space of the self-managed Oracle database.

Precautions

Due to kernel differences between Oracle and PolarDB for PostgreSQL (Compatible with Oracle), you must understand and follow the following limits to avoid data inconsistency or task failure.

  • Kernel compatibility and data behavior differences:

    • Sequence values are not synchronized: DTS synchronizes the current sequence values only once during schema migration and does not update them automatically in the incremental phase afterward. As a result, when services are switched over, the new application starts generating IDs from an older sequence value, causing primary key conflicts.

      Note

      At the last moment before the service switchover, on the DTS task management page, in the Incremental Write module, click Sync Sequence, and set the Offset. DTS generates sequence synchronization statements and executes the sequence value synchronization.

    • Character set compatibility: Make sure that the character sets of the source and target databases are compatible; otherwise, garbled characters or task failures may occur. We recommend that the target database use the UTF8 character set.

    • Database and table name case: By default, DTS maps uppercase object names in Oracle to lowercase names in PolarDB. Usually, applications do not need to be modified, but if your code forcibly uses quoted uppercase names, pay attention to compatibility.

    • CHAR/VARCHAR precision semantics: Pay attention to the difference between the byte precision of Oracle and the character precision of PolarDB. You can set the polar_default_char_length_semantics parameter to unify the behavior and avoid data truncation.

    • \0 character handling: PolarDB does not allow \0 (null character) in data. DTS automatically removes this character during migration. If \0 is part of a primary key or unique key, this may cause data conflicts and loss (for example, 'key\0' and 'key' become the same value on the target side).

    • Empty strings ('') and NULL: Oracle treats empty strings as NULL, whereas in standard SQL the two are different. PolarDB uses the polar_empty_string_is_null_enable parameter (enabled by default) to be compatible with this behavior. Make sure that this parameter meets your business expectations.

    • Time zone consistency: The time zone settings of the source and target databases must be consistent; otherwise, values of time-type fields will be incorrect.

    • INTEGER type range: Note that the range of INTEGER (NUMBER(38)) in Oracle is much larger than the range of INTEGER (32-bit) in PolarDB, which may cause "out of range" errors. Evaluate and adjust the target database types in advance.

  • DTS migration operations and process limits:

    • Source database resource impact: During full migration, some read and write resources (CPU or memory) of the source and target databases are consumed.

    • Primary key/unique key limits: Tables to be migrated should have a primary key or unique key. For tables without primary keys, DTS cannot guarantee data consistency (duplicate data may occur on the target side).

      Note

      If a table to be migrated has neither a primary key nor a unique key, DTS provides the Add a hidden primary key for a table without a primary key/a table without a unique key feature, which uses ROWID in Oracle as the hidden primary key (that is, a non-null unique key) of the target table to avoid duplicate data in the target database.

    • DDL limits: During schema migration and full migration, do not perform any DDL operations on the migration objects in the source database (such as changing table schemas). Otherwise, the migration task fails.

    • Oracle Data Pump limits: During incremental migration, importing data into the source database by using Oracle Data Pump is not supported. Otherwise, incremental data is lost.

    • External table limits: DTS does not support migrating external tables in Oracle.

    • Trigger limits: Triggers are not supported for now. During schema migration, triggers are also migrated to the target database, which causes data inconsistency between the source and target databases. We recommend that you delete the triggers in the source database or perform schema migration first and then delete the triggers in the target database.

    • Foreign keys and cascading operations: During full and incremental migration, DTS temporarily disables constraint checks and foreign key cascading operations on the target database at the session level. If cascading updates or deletes of foreign keys occur in the source database during this period, data inconsistency may occur in the target database.

Click to expand for detailed precautions

Type

Description

Source database limitations

  • The server that hosts the source database must have sufficient outbound bandwidth. Otherwise, the data migration speed is affected.

  • If the source database is connected over a leased line, you must configure one of the virtual IP addresses (VIPs) in the connection information. This allows the Oracle Real Application Clusters (RAC) to connect to the data migration task over the leased line.

  • If the self-managed Oracle database uses an RAC architecture and is connected over a leased line, VPN Gateway, Smart Access Gateway, Database Gateway (DG), or Cloud Enterprise Network (CEN), or from an ECS instance, you cannot configure a Single Client Access Name (SCAN) IP address. You can only configure one of the VIPs in the connection information. If you use this method, node switching for RAC is not supported.

  • If the data to be migrated contains empty strings of the `varchar2` type, which Oracle treats as null, and the corresponding destination database field has a NOT NULL constraint, the migration task fails.

  • If the FGA (Fine-Grained Audit) policy is enabled on the table to be migrated, DTS cannot recognize the ORA_ROWSCN pseudocolumn, which will cause the migration job to fail.

    Note

    You can disable the FGA policy for the tables to be migrated, or choose not to migrate data from these tables.

  • Requirements for migration objects:

    • The tables to be migrated must have a primary key or a unique constraint, and the fields must be unique. Otherwise, duplicate data may appear in the destination database.

      Note

      You can also use the Oracle ROWID as the primary key for tables that do not have a primary key or unique constraint.

    • For Oracle 12c and later, table names and column names must not exceed 30 characters, or incremental data synchronization will fail.

    • If you migrate objects at the table level and need to edit them, such as mapping table or column names, a single data migration task supports a maximum of 1,000 tables. If this limit is exceeded, an error is reported after you submit the task. In this case, split the tables into multiple batches and configure a separate task for each batch, or configure a task to migrate the entire database.

  • For incremental migration, Redo Logs and Archive Logs:

    • Must be enabled.

    • For an incremental data migration task, DTS requires that Redo Logs and Archive Logs in the source database are retained for more than 24 hours. For a task that includes both full and incremental data migration, DTS requires that Redo Logs and Archive Logs are retained for at least 7 days. After the full data migration is complete, you can change the retention period to more than 24 hours. If the retention period is shorter than required, the DTS task may fail because it cannot obtain the logs. In extreme cases, this may cause data inconsistency or loss. Issues caused by a log retention period shorter than the DTS requirement are not covered by the DTS Service-Level Agreement (SLA).

  • Limitations on source database operations:

    • During schema migration and full data migration, do not perform DDL operations that change the database or table schema. Otherwise, the data migration task fails.

    • If you perform only full data migration, do not write new data to the source instance. Otherwise, data inconsistency between the source and destination occurs. To maintain real-time data consistency, select schema migration, full data migration, and incremental data migration.

    • Updating large text fields separately is not supported and will cause the task to fail.

Other limitations

  • Evaluate the performance of the source and destination databases before migrating data, and perform migration during off-peak hours. During full data migration, DTS consumes some read and write resources from the source and destination databases, which may increase the database load.

  • Full data migration performs concurrent INSERT operations, which causes table fragmentation in the destination database. As a result, the table storage space in the destination database is larger than that in the source instance.

  • DTS attempts to resume failed migration tasks within seven days. Before you switch your business to the destination instance, stop or release the task. Alternatively, use the revoke command to revoke the write permissions of the account that DTS uses to access the destination instance. This prevents the source data from overwriting the data in the destination instance if the task is automatically resumed.

  • Migration of foreign tables is not supported.

  • The destination PolarDB for PostgreSQL (Compatible with Oracle) cluster generates unique indexes, such as pg_oid_1498503_index, to correspond to the ROWID of the source Oracle database. Therefore, the destination cluster has more indexes than the source Oracle database.

  • The destination PolarDB for PostgreSQL (Compatible with Oracle) cluster does not support writing the string terminator ('\0'). If the data to be migrated contains this terminator, DTS does not write it to the destination database. This causes data inconsistency.

  • When a CHECK constraint from the source Oracle database is migrated to the destination PolarDB for PostgreSQL (Compatible with Oracle) cluster, it is converted into a NOT NULL constraint.

  • Ensure that the character sets of the source and destination databases are compatible. Incompatible character sets may cause data inconsistency or task failure.

  • Use the schema migration feature of DTS. Otherwise, the task may fail due to incompatible data types.

  • The time zones of the source and destination databases must be the same.

  • During incremental migration, importing data into the source database by using Oracle Data Pump is not supported. This may cause data loss.

  • User-defined types can be migrated to the destination PolarDB for PostgreSQL (Compatible with Oracle) cluster. Type objects automatically generated by Oracle, which are built-in objects, are not migrated.

    Note

    PolarDB for PostgreSQL (Compatible with Oracle) clusters already support Oracle's built-in objects, so you do not need to migrate them.

  • DTS validates data content but does not validate metadata such as sequences. You must validate metadata yourself.

  • After you switch your workloads to the destination instance, newly written sequences do not increment from the maximum value of the corresponding sequences in the source database. Before you switch your workloads, you must update the sequence values in the destination database. For more information, see Update sequence values in the destination database.

  • This limit applies to full or incremental data migration tasks where the tables to be migrated from the source database contain foreign keys, triggers, or event triggers. DTS temporarily sets the session_replication_role parameter to replica at the session level during the migration. If the destination database account does not have the required permissions, you must manually set the parameter to replica in the destination database. During this period (while session_replication_role is set to replica), cascade update or delete operations in the source database may cause data inconsistency. After the migration task is released, you can set the parameter back to origin.

  • If a task fails, DTS support staff will attempt to restore it within eight hours. During restoration, they may restart the task or adjust its parameters.

    Note

    Only DTS task parameters are modified—not database parameters. Parameters that may be adjusted include those listed in Modify instance parameters.

Stage 1: Preparations

Authorize DTS to access cloud resources

  1. Log on to the Quick authorization page with your Alibaba Cloud account (primary account) and click Confirm Authorization.

  2. After you complete the authorization, if the page displays EntityAlreadyExists.Role and EntityAlreadyExists.Role.Policy, the current Alibaba Cloud account has granted DTS the permission to access cloud resources, and you can continue with the subsequent preparations.

Create a database account and grant permissions

When you use DTS for data migration, the source and target database accounts must have the following permissions:

Database

Schema migration

Full migration

Incremental migration

Self-managed Oracle database

Schema owner permission

Schema owner permission

Fine-grained authorization required

PolarDB for PostgreSQL (Compatible with Oracle)

Schema owner permission

You can use an existing database account (with the required permissions) to complete the migration task, or create and authorize database accounts for migration in the source and target databases by using the following methods:

Self-managed Oracle account

You must create an account for data collection and grant permissions to it. The account for data collection requires the following permissions:

Task type

Permission option

Schema and full tasks

DBA role or fine-grained permissions

Incremental tasks

Fine-grained permissions required

Important

For incremental tasks from a non-CDB Oracle source, you can also grant the DBA role instead of fine-grained permissions.

Grant the DBA role

-- Create the account and grant permissions
create user rdsdt_dtsacct identified by rdsdt_dtsacct;
grant create session to rdsdt_dtsacct;
grant connect to rdsdt_dtsacct;
grant dba to rdsdt_dtsacct;

-- Verify the permissions
select * from user_tab_privs;
select granted_role from user_role_privs;

Fine-grained permissions for schema and full tasks

-- Create the account and grant permissions
create user rdsdt_dtsacct identified by rdsdt_dtsacct;
grant create session to rdsdt_dtsacct;
grant connect to rdsdt_dtsacct;
grant select_catalog_role to rdsdt_dtsacct;
grant select any table to rdsdt_dtsacct;

-- Verify the permissions
select * from user_role_privs;
select * from user_sys_privs;

Incremental tasks Fine-grained authorization

Oracle 10g and 11g

-- Create the account and grant permissions
create user rdsdt_dtsacct identified by rdsdt_dtsacct;
grant create session to rdsdt_dtsacct;
grant connect to rdsdt_dtsacct;
grant select_catalog_role to rdsdt_dtsacct;
grant select any table to rdsdt_dtsacct;
grant select any transaction to rdsdt_dtsacct;
grant select on all_objects to rdsdt_dtsacct;
grant select on all_tab_cols to rdsdt_dtsacct;
grant select on dba_registry to rdsdt_dtsacct;
grant execute on sys.dbms_logmnr to rdsdt_dtsacct;
grant select on v_$log to rdsdt_dtsacct;
grant select on v_$logfile to rdsdt_dtsacct;
grant select on v_$standby_log to rdsdt_dtsacct;
-- Grant v_$standby_log if the Oracle database is an ADG secondary database
grant select on v_$archived_log to rdsdt_dtsacct;
grant select on v_$parameter to rdsdt_dtsacct;
grant select on v_$database to rdsdt_dtsacct;
grant select on v_$active_instances to rdsdt_dtsacct;
grant select on v_$instance to rdsdt_dtsacct;
grant select on v_$logmnr_contents to rdsdt_dtsacct;
grant select on sys.USER$ to rdsdt_dtsacct;
grant select on sys.OBJ$ to rdsdt_dtsacct;
grant select on sys.COL$ to rdsdt_dtsacct;
grant select on sys.IND$ to rdsdt_dtsacct;
grant select on sys.ICOL$ to rdsdt_dtsacct;
grant select on sys.CDEF$ to rdsdt_dtsacct;
grant select on sys.CCOL$ to rdsdt_dtsacct;
grant select on sys.TABPART$ to rdsdt_dtsacct;
grant select on sys.TABSUBPART$ to rdsdt_dtsacct;
grant select on sys.TABCOMPART$ to rdsdt_dtsacct;

-- Verify the permissions
select * from user_role_privs;
select * from user_sys_privs;
select * from user_tab_privs;

Oracle 12c to 19c (non-CDB)

-- Create the account and grant permissions
create user rdsdt_dtsacct IDENTIFIED BY rdsdt_dtsacct;
grant create session to rdsdt_dtsacct;
grant connect to rdsdt_dtsacct;
grant select_catalog_role to rdsdt_dtsacct;
grant logmining to rdsdt_dtsacct;
grant execute_catalog_role to rdsdt_dtsacct;
grant select any table to rdsdt_dtsacct;
grant select any transaction to rdsdt_dtsacct;
grant select on all_objects to rdsdt_dtsacct;
grant select on all_tab_cols to rdsdt_dtsacct;
grant select on dba_registry to rdsdt_dtsacct;
grant execute on sys.dbms_logmnr to rdsdt_dtsacct;
grant select on v_$log to rdsdt_dtsacct;
grant select on v_$logfile to rdsdt_dtsacct;
grant select on v_$standby_log to rdsdt_dtsacct;
-- Grant v_$standby_log if the Oracle database is an ADG secondary database
grant select on v_$archived_log to rdsdt_dtsacct;
grant select on v_$parameter to rdsdt_dtsacct;
grant select on v_$database to rdsdt_dtsacct;
grant select on v_$active_instances to rdsdt_dtsacct;
grant select on v_$instance to rdsdt_dtsacct;
grant select on v_$logmnr_contents to rdsdt_dtsacct;
grant select on sys.USER$ to rdsdt_dtsacct;
grant select on sys.OBJ$ to rdsdt_dtsacct;
grant select on sys.COL$ to rdsdt_dtsacct;
grant select on sys.IND$ to rdsdt_dtsacct;
grant select on sys.ICOL$ to rdsdt_dtsacct;
grant select on sys.CDEF$ to rdsdt_dtsacct;
grant select on sys.CCOL$ to rdsdt_dtsacct;
grant select on sys.TABPART$ to rdsdt_dtsacct;
grant select on sys.TABSUBPART$ to rdsdt_dtsacct;
grant select on sys.TABCOMPART$ to rdsdt_dtsacct;

-- Verify the permissions
select * from user_role_privs;
select * from user_sys_privs;
select * from user_tab_privs;

Oracle 12c to 19c (CDB)

Important

The account name in the pluggable database (PDB) must match the account name in CDB$ROOT, excluding the C## prefix for common users.

-- Step 1: Switch to the PDB, create the account, and grant permissions
alter session set container = ORCLPDB1;

create user rdsdt_dtsacct identified by rdsdt_dtsacct;
grant create session to rdsdt_dtsacct;
grant connect to rdsdt_dtsacct;
grant select_catalog_role to rdsdt_dtsacct;
grant logmining TO rdsdt_dtsacct;
grant execute_catalog_role to rdsdt_dtsacct;
grant select any table to rdsdt_dtsacct;
grant select any transaction to rdsdt_dtsacct;
grant select on all_objects to rdsdt_dtsacct;
grant select on all_tab_cols to rdsdt_dtsacct;
grant select on dba_registry to rdsdt_dtsacct;
grant execute on sys.dbms_logmnr to rdsdt_dtsacct;
grant select on v_$pdbs to rdsdt_dtsacct;
grant select on v_$log to rdsdt_dtsacct;
grant select on v_$logfile to rdsdt_dtsacct;
grant select on v_$standby_log to rdsdt_dtsacct;
-- Grant v_$standby_log if the Oracle database is an ADG secondary database
grant select on v_$archived_log to rdsdt_dtsacct;
grant select on v_$parameter to rdsdt_dtsacct;
grant select on v_$database to rdsdt_dtsacct;
grant select on v_$active_instances to rdsdt_dtsacct;
grant select on v_$instance to rdsdt_dtsacct;
grant select on v_$logmnr_contents to rdsdt_dtsacct;
grant select on sys.USER$ to rdsdt_dtsacct;
grant select on sys.OBJ$ to rdsdt_dtsacct;
grant select on sys.COL$ to rdsdt_dtsacct;
grant select on sys.IND$ to rdsdt_dtsacct;
grant select on sys.ICOL$ to rdsdt_dtsacct;
grant select on sys.CDEF$ to rdsdt_dtsacct;
grant select on sys.CCOL$ to rdsdt_dtsacct;
grant select on sys.TABPART$ to rdsdt_dtsacct;
grant select on sys.TABSUBPART$ to rdsdt_dtsacct;
grant select on sys.TABCOMPART$ to rdsdt_dtsacct;

-- Step 2: Switch to CDB$ROOT and create the CDB-level account
alter session set container = CDB$ROOT;

-- This method requires modifying a default Oracle database parameter
alter session set "_ORACLE_SCRIPT"=true;
create user rdsdt_dtsacct identified by rdsdt_dtsacct;
grant create session to rdsdt_dtsacct;
grant connect to rdsdt_dtsacct;
grant logmining to rdsdt_dtsacct;
grant execute_catalog_role to rdsdt_dtsacct;
grant select on v_$logmnr_contents to rdsdt_dtsacct;
grant execute on sys.dbms_logmnr to rdsdt_dtsacct;

-- Verify the permissions
select * from user_role_privs;
select * from user_sys_privs;
select * from user_tab_privs;

PolarDB for PostgreSQL (Compatible with Oracle) Account

We recommend that you use a high-privilege account, which you can create as follows:

  1. Go to the PolarDB console, select the region where the cluster resides in the upper-left corner, and click the target cluster ID.

  2. In the left-side navigation pane, go to the Settings and Management > Accounts page and click Create Account.

  3. Account Type Select Privileged Account, and set other parameters (such as the account name and password) as required by the console.

Confirm the source database access method and add whitelists

Select an appropriate access method based on the type of the self-managed Oracle database. In addition, if your source or target database instance allows connections only from specific IP addresses, add the IP address ranges of DTS servers to the security settings (firewalls, whitelists, or security groups) of the corresponding databases to allow DTS servers to access them.

Self-managed database type

Recommended access method

Preparations

Local self-managed database

(with a public address)

Public IP Address

You must manually add DTS server IP address whitelists.

Local self-managed database

(without a public address)

  • Cloud Enterprise Network (CEN)

  • Database Gateway

  • Express Connect, VPN Gateway, or Smart Access Gateway

ECS self-managed database

Self-managed Database on ECS

The system automatically adds the DTS service IP address ranges.

PolarDB for PostgreSQL (Compatible with Oracle) (target database) instance uses the Cloud Instance access method, and the system automatically adds the DTS service IP address ranges to the RDS instance whitelist without manual configuration.

(Optional) Incremental migration: enable source database archiving and supplemental logging

If you need incremental migration, complete the following configurations on the source database and restart the Oracle database for the configurations to take effect:

  • Enable archiving mode: The source Oracle database must enable Archive Log.

  • Enable supplemental logging: Enable Supplemental Logging. DTS currently supports two modes: database-level supplemental logging and table-level supplemental logging only. You can choose either one based on business requirements.

  • Log retention policy:

    • Incremental migration: The retention period of Redo Log and Archive Log must be at least 24 hours.

    • Full migration + incremental migration: The retention period of Redo Log and Archive Log must be at least 7 days.

Enable ARCHIVELOG mode

  1. Check whether ARCHIVELOG mode is already enabled.

    The archived log retention period must be at least 3 days.
    archive log list;

    If Database log mode shows Archive Mode, ARCHIVELOG mode is already enabled. Skip to Enable supplemental logging.

  2. Restart the database.

    Important

    To avoid service disruptions, perform this step during off-peak hours.

    shutdown immediate;
    startup mount;
  3. Enable ARCHIVELOG mode.

    alter database archivelog;
    alter database open;
  4. Verify the configuration.

    archive log list;

Enable supplemental logging

DTS supports two supplemental logging modes. Choose based on your requirements:

Mode

Benefit

Limitation

Database-level

Improves DTS task stability

Uses more disk space

Table-level

Saves disk space on the source

Tables added via DDL without supplemental logging enabled are not migrated when migration granularity is at the database level

Enable database-level supplemental logging
  1. Check whether database-level supplemental logging is already enabled.

    SELECT supplemental_log_data_min, supplemental_log_data_pk, supplemental_log_data_ui FROM v$database;

    If the output is as follows, supplemental logging is already enabled and no further steps are needed.

    SUPPLEME SUP SUP
    -------- --- ---
    IMPLICIT YES YES
  2. Enable minimal supplemental logging.

    alter database add supplemental log data;
  3. Enable supplemental logging for primary keys and unique keys.

    alter database add supplemental log data (primary key,unique index) columns;
  4. Verify the configuration.

    SELECT supplemental_log_data_min, supplemental_log_data_pk, supplemental_log_data_ui FROM v$database;
Enable table-level supplemental logging
  1. Enable minimal supplemental logging.

    alter database add supplemental log data;
  2. Enable table-level supplemental logging. Choose one of the following based on the table structure: For tables with a primary key: Enable primary key supplemental logging.

    alter table <table_name> add supplemental log data (primary key) columns;

    For tables without a primary key: Enable all-column supplemental logging.

    alter table <table_name> add supplemental log data (all) columns;

Specify whether to set an alarm and receive alarm notifications based on business requirements.

  • Do not set: No alarm is set.

  • Set: Set an alarm. You also need to set the alarm threshold and alarm notifications. When the migration fails or the latency exceeds the threshold, the system sends an alarm notification.

Stage 2: Configure the migration task

This document uses a local self-managed database (with a public address) as an example to show you how to configure a DTS migration task.

  1. Go to the PolarDB console and choose Oracle Online Migration in the left-side navigation pane.

  2. In the Data Migration step, click Create Migration Task.

  3. Configure source and target database information:

    Source database configuration

    Configuration item

    Description

    Database Type

    Select Oracle.

    Access Method

    Select the source database access method confirmed in the preparations. For example, for a local self-managed database (with a public address), the access method is Public IP Address.

    Instance Region

    Select the region where the source Oracle database resides. If the source database region is not in the available region list, select the nearest one.

    Domain Name or IP

    Enter the public address or IP address of the source database. If the source database address has a domain name that can be resolved by public DNS, we recommend that you use the domain name.

    Port Number

    Enter the service port of the source database (which must be open to the Internet). The default value is 1521.

    Oracle Type

    Select the type of the source Oracle database.

    • Non-RAC Instance: After you select this option, you also need to enter the SID information.

    • RAC or PDB Instance: After you select this option, you also need to enter the Service Name information.

    Database Account

    Enter the account created in the preparations or an existing account that meets the permission requirements.

    Database Password

    Enter the password for the database account.

    Target database configuration

    Configuration item

    Description

    Database Type

    Fixed to PolarDB (Compatible with Oracle).

    Access Method

    Fixed to Alibaba Cloud Instance.

    Instance Region

    Select the region where the PolarDB for PostgreSQL (Compatible with Oracle) cluster resides.

    Instance ID

    Select the target PolarDB for PostgreSQL (Compatible with Oracle) cluster ID.

    Database Name

    Enter the name of the database to which the migration objects belong in the target PolarDB for PostgreSQL (Compatible with Oracle) cluster.

    Database Account

    Enter the database account of the PolarDB for PostgreSQL (Compatible with Oracle) cluster. We recommend that you use a high-privilege account.

    Database Password

    Enter the password for the database account.

  4. Test the connection between the source and target databases:

    Click Test Connectivity and Proceed at the bottom of the page, and in the CIDR Blocks of DTS Servers dialog box that appears, click Test Connectivity. If the test fails, check the network, account, or permission configuration based on the error message.

  5. Configure task objects:

    You need to complete the Configure Objects, Advanced Settings, and Data Verification Settings in sequence.

    Object configuration

    On the object configuration page, refer to the following table and configure the migration types, databases and tables to be migrated, the case policy of the target database, and the handling mode for existing tables based on your business situation.

    Configuration

    Description

    Migration Types

    • If you only need full migration, we recommend that you select both Schema Migration and Full Data Migration.

    • If you need migration without downtime, we recommend that you select Schema Migration, Full Data Migration, and Incremental Data Migration.

    Note
    • If Schema Migration is not selected, make sure that the database and tables that receive data exist in the target database, and use the database, table, and column name mapping feature in the Selected Objects box as needed.

    • If Incremental Data Migration is not selected, to ensure data consistency, do not write new data to the source instance during data migration.

    Add a hidden primary key for a table without a primary key/a table without a unique key

    If the objects to be migrated include tables that have neither a primary key nor a unique key, you must select Yes. DTS uses the ROWID in Oracle as the hidden primary key (non-null unique key) of the target table to avoid duplicate data in the target database.

    Note

    This parameter can be configured only when Migration Types is set to Schema Migration, and at least one of Full Data Migration and Incremental Data Migration is selected.

    Processing Mode of Conflicting Tables

    • Precheck and Report Errors: Checks whether a table with the same name exists in the target database. If no table with the same name exists, the check passes. If a table with the same name exists, an error is reported in the precheck phase, and the data migration task is not started.

      Note

      If a table with the same name in the target database cannot be deleted or renamed, you can change the table name in the target database. For more information, see Database, table, and column name mapping.

    • Ignore Errors and Proceed: Skips the check for tables with the same name in the target database.

      Warning

      If you choose Ignore Errors and Proceed, data inconsistency may occur and bring risks to your business, for example:

      • If the table schemas are the same and a record in the target database has the same primary key value as a record in the source database:

        • During full migration, DTS retains the record in the target cluster, that is, the record in the source database is not migrated to the target database.

        • During incremental migration, DTS does not retain the record in the target cluster, that is, the record in the source database overwrites the record in the target database.

      • If the table schemas are different, only part of the column data may be migrated or the migration may fail. Proceed with caution.

    Source Objects

    In the Source Objects box, click the object to be migrated, and then click the image button to move it to the Selected Objects box.

    Selected Objects

    Note
    • If you use the object name mapping feature, other objects that depend on the object may fail to migrate.

    • To set WHERE conditions to filter data, right-click the table to be migrated in Selected Objects, and set the filter conditions in the dialog box that appears. For the configuration method, see Set filter conditions.

    • To select the SQL operations for incremental migration at the database or table level, right-click the object to be migrated in Selected Objects, and select the required SQL operations in the dialog box that appears.

    Advanced configuration (optional)

    Advanced configuration provides fine-tuning based on a normal DTS migration task (such as the retry time after disconnection, migration rate limits, and monitoring and alarms) and handling of special cases (such as DTS dedicated clusters and configuring ETL for data processing). If you do not need the following advanced configurations, you can keep the default values on this page.

    Configuration

    Description

    Dedicated Cluster for Task Scheduling

    By default, DTS schedules tasks on shared clusters, and you do not need to select one. You can purchase a dedicated cluster of a specified specification to run DTS migration tasks. For more information, see What is a DTS dedicated cluster.

    Retry Time for Failed Connections

    After the migration task starts, if the source or target database fails to connect, DTS reports an error and immediately retries repeatedly. The default retry duration is 720 minutes. You can set a custom retry time within the range of 10 to 1440 minutes; we recommend that you set it to 30 minutes or more. If DTS reconnects to the source and target databases within the specified time, the migration task automatically resumes. Otherwise, the migration task fails.

    Note
    • For multiple DTS instances with the same source or target, the network retry time of the most recently created task takes effect.

    • Because DTS charges task running fees during connection retries, we recommend that you set a custom retry time based on your business needs, or release the DTS instance as soon as possible after the source and target database instances are released.

    Retry Time for Other Issues

    After the migration task starts, if other non-connectivity issues occur on the source or target database (such as DDL or DML execution exceptions), DTS reports an error and immediately retries repeatedly. The default retry duration is 10 minutes. You can set a custom retry time within the range of 1 to 1440 minutes; we recommend that you set it to 10 minutes or more. If the relevant operation succeeds within the specified retry time, the migration task automatically resumes. Otherwise, the migration task fails.

    Important

    Retry Time for Other Issues value must be less than the Retry Time for Failed Connections value.

    Enable Throttling for Full Data Migration

    During full migration, DTS consumes certain read and write resources of the source and target databases, which may increase the database load. You can specify whether to limit the full migration rate based on your actual situation (by setting the Queries per second (QPS) to the source database, RPS of Full Data Migration and Data migration speed for full migration (MB/s)) to relieve the pressure on the target database.

    Note
    • This configuration item is available only when Migration Types is set to Full Data Migration.

    • You can also, after the migration instance starts, adjust the full migration rate.

    Enable Throttling for Incremental Data Migration

    You can also specify whether to limit the incremental migration rate based on your actual situation (by setting the RPS of Incremental Data Migration and Data migration speed for incremental migration (MB/s)) to relieve the pressure on the target database.

    Note
    • This configuration item is available only when Migration Types is set to Incremental Data Migration.

    • You can also, after the migration instance starts, adjust the incremental migration rate.

    Actual Write Code

    You can select the encoding type for writing data to the target side based on your actual situation.

    Environment Tag

    You can select an environment label to identify the instance based on your actual situation.

    Scene Label

    You can select an environment label to identify the instance based on your actual situation.

    Monitoring and Alerting

    Specifies whether to set an alarm. When synchronization fails or the latency exceeds the threshold, the alarm contacts are notified.

    Data validation (optional)

    Data validation monitors data differences between the source and target databases. It supports validation while services keep running, helping you identify data and structure inconsistency in a timely manner. To use data validation, you can configure it when you configure the migration task, or configure a separate data validation task after the migration task is complete. If data validation is not required, proceed to the subsequent steps.

    1. Select Data Verification Mode:

      Note
      • Full Data Verification: Validates the data that needs to be validated in full tasks. If the instance does not include incremental tasks, validation starts when the instance is created and full data writing is complete. If the instance includes incremental tasks, validation starts when the instance is created and incremental data writing has no latency for the first time.

      • Incremental Data Verification: Validates the data of incremental tasks. Validation starts when the instance is created and incremental data writing has no latency for the first time.

      • Schema Verification (not supported): Performs structure validation on the objects to be validated. If the instance does not include incremental tasks, validation starts when the instance is created and schema and full data writing are complete. If the instance includes incremental tasks, validation starts when the instance is created and incremental data writing has no latency for the first time.

      Full validation

      If you select Full Data Verification, you also need to set the parameters in the following table.

      Parameter

      Description

      Full Data Verification

      • Full field validation by row sampling: Configure the sampling percentage to perform full-field validation on the sampled data. The value must be an integer from 10 to 100.

      • Verify based on the number of table rows: Validates the number of rows of full task data without validating the specific data content.

      Note

      Verify based on the number of table rows full validation mode is free of charge; Full field validation by row sampling full validation mode is billed based on the actual amount of validated data.

      Timeout Settings for Full Data Verification

      • No: The full validation task is not forcibly terminated on timeout.

      • Yes: Set the delay time for ending the full validation task. The timer starts when the full validation task starts. If the validation task is not completed within the specified time, it is forcibly ended. The value must be an integer from 1 to 72.

      Full calibration reference

      • Default: Uses the union of the source and target databases as the basis to validate data consistency between the source and target databases.

      • Source Database: Uses the source database as the basis to validate data consistency between the target and source databases (data that exists only in the target database is not validated).

      • Destination Database: Uses the target database as the basis to validate data consistency between the source and target databases (data that exists only in the source database is not validated).

      Maximum number of rows of data read per second by full verification (RPS)

      Full data validation consumes certain read resources of the database. You can limit the rate of the full validation task (the number of data rows and the data volume read per second) based on your actual situation to relieve the pressure on the database.

      Note

      A value of 0 indicates no limit. When both Maximum number of rows of data read per second by full verification (RPS) and Maximum amount of data read per second by full verification (MBps) are 0, no rate limit is applied.

      Maximum amount of data read per second by full verification (MBps)

      Incremental validation

      If you select Incremental Data Verification, you also need to set the parameters in the following table.

      Parameter

      Description

      Incremental Verification Benchmark

      You can filter the DML operations to be validated based on your actual situation. The following operations are supported: Source INSERT Operation, Source UPDATE Operation and Source DELETE Operation.

    2. Set the Verification Objects: All objects are selected by default. You can remove the objects on the right that do not need to be verified..

    3. Configure validation alarms: Based on business requirements, choose to configure the parameters in the following table.

      Note

      You can also, after the DTS instance starts, set or modify data validation alarms.

      Parameter

      Description

      Full Data Verification Alert

      • No: No alarm is set.

      • Yes: Set an alarm. You also need to select and configure alarm rules. The alarm rules are as follows:

        • Triggers an alarm when the full validation task fails.

        • Set the threshold for data inconsistency. An alarm is triggered when the amount of inconsistent data in the full validation task is greater than or equal to the threshold.

      Incremental Data Verification Alert

      • No: No alarm is set.

      • Yes: Set an alarm. You also need to select and configure alarm rules. The alarm rules are as follows:

        • Triggers an alarm when the incremental validation task fails.

        • Set the number of periods, the statistical period, and the threshold for the number of inconsistent records. An alarm is triggered when the number of inconsistent records in the incremental validation task is greater than or equal to the threshold in the specified number of consecutive periods.

        • Set the number of periods, the statistical period, and the latency threshold. An alarm is triggered when the latency in the incremental validation task is greater than or equal to the threshold in the specified number of consecutive periods.

      Note

      If you set validation alarms and need to receive alarm notifications when the validation task triggers an alarm, you also need to subscribe to alarm messages on the CloudMonitor platform. For more information, see Set alarm rules for DTS tasks on the CloudMonitor platform.

Stage 3: Precheck and start

  1. After you complete the configuration in stage 2, click Next: Save Task Settings and Precheck. DTS checks whether the environment, permissions, and configurations of the source and target databases meet the migration requirements. Wait for the precheck to complete.

    • Success Rate is 100%: The environment is ready, and you can purchase and start the task.

    • Precheck fails or a non-ignorable warning appears: Click View Details after the failed check item, fix the issue based on the prompt, and run the precheck again.

    • An ignorable warning appears: Read the warning carefully. After confirming that there is no related risk (such as data inconsistency), you can ignore the warning and run the precheck again.

  2. After the precheck is fully passed, click Next: Purchase Instance.

    1. Select the Resource Group Settings and an appropriate link specification (a higher specification means faster migration).

    2. Read and select Data Transmission Service (Pay-as-you-go) Service Terms, click Buy and Start, and in the OK dialog box that appears, click OK. After you click purchase, the task starts automatically.

Stage 4: Data verification

  1. Wait for the DTS migration task to complete:

    1. Tasks that do not include incremental migration: The task automatically ends after full migration is complete, and the task Status changes to Completed.

    2. Tasks that include incremental migration: The task does not end automatically, and incremental migration continues (the task Status is Running). When incremental migration shows no latency (low latency), the source and target databases are consistent, and you can perform data verification.

  2. Data verification:

    When the migration task ends or incremental migration has no latency (low latency), you can verify the data in the source and target databases:

    1. Automatic validation: In DTS, configure a data validation task to automatically compare the data in the source and target databases.

    2. Manual sampling verification: You can manually verify data from multiple dimensions (for example, compare the number of table rows and core business data between the source and target databases) to verify data consistency by sampling. The following is sample code:

      -- Example 1: Run on the source and target databases separately to compare table row counts
      SELECT COUNT(*) FROM your_table;
      
      -- Example 2: Run on the source and target databases separately to compare key business metrics, such as the total order amount in a period
      SELECT SUM(amount) FROM orders WHERE create_time >= DATE '2024-01-01';

Next steps

  1. Test verification: Before the service switchover, you also need to perform comprehensive business function and performance regression testing on the PolarDB test instance and confirm that all functions meet expectations with no compatibility issues.

  2. Migration cutover: After test verification is complete, PolarDB provides two mainstream cutover methods. You can choose one based on your project specifics and requirements for data consistency.

Appendix

SQL operations supported for incremental migration

Operation type

SQL statement

DML

INSERT, UPDATE, and DELETE

DDL

  • CREATE TABLE

    Note

    DTS does not support CREATE TABLE AS SELECT statements, or CREATE TABLE for tables with partitions, subpartitions, or definitions that contain a function.

  • ALTER TABLE, including ADD COLUMN, ADD INDEX, DROP COLUMN, DROP INDEX, MODIFY COLUMN, and RENAME COLUMN

  • DROP TABLE

  • RENAME TABLE, TRUNCATE TABLE, and CREATE INDEX

Data type mappings between heterogeneous databases

Note

If the range of data to be migrated in Oracle exceeds the range supported by DTS, the precision of the migrated data in PolarDB for PostgreSQL (Compatible with Oracle) is reduced.

Type

Oracle data type

Value range

PolarDB for PostgreSQL (Compatible with Oracle) data type

Numeric types

NUMBER(p,s)

1 to 22 bytes.

p represents the precision, with a value range of 1 to 38.

s represents the scale, with a value range of -84 to 127.

NUMBER(p,s)

FLOAT(p)

1 to 22 bytes.

p represents the pointer variable, with a value range of 1 to 126 bits.

DOUBLE PRECISION

BINARY_FLOAT

32-bit floating point number, that is, 4 bytes.

REAL

BINARY_DOUBLE

64-bit floating point number, that is, 8 bytes.

DOUBLE PRECISION

Date types

DATE

None

DATE

TIMESTAMP [(fractional_seconds_precision)]

None

TIMESTAMP [(fractional_seconds_precision)]

TIMESTAMP [(fractional_seconds_precision)] WITH TIME ZONE

None

TIMESTAMP [(fractional_seconds_precision)] WITH TIME ZONE

TIMESTAMP [(fractional_seconds_precision)] WITH LOCAL TIME ZONE

None

TIMESTAMP [(fractional_seconds_precision)] WITH TIME ZONE

INTERVAL YEAR [(year_precision)] TO MONTH

None

INTERVAL

INTERVAL DAY [(day_precision)] TO SECOND [(fractional_seconds_precision)]

None

INTERVAL

String types

CHAR [(size [BYTE | CHAR])]

2000 bytes.

CHAR [(size [BYTE | CHAR])]

NCHAR[(size)]

2000 bytes.

NCHAR[(size)]

VARCHAR(size [BYTE | CHAR])

When MAX_STRING_SIZE = EXTENDED, the maximum length is 32767 bytes.

When MAX_STRING_SIZE = STANDARD, the maximum length is 4000 bytes.

VARCHAR(n)

VARCHAR2(size [BYTE | CHAR])

When MAX_STRING_SIZE = EXTENDED, the maximum length is 32767 bytes.

When MAX_STRING_SIZE = STANDARD, the maximum length is 4000 bytes.

VARCHAR2(size [BYTE | CHAR])

NVARCHAR2(size)

When MAX_STRING_SIZE = EXTENDED, the maximum length is 32767 bytes.

When MAX_STRING_SIZE = STANDARD, the maximum length is 4000 bytes.

NVARCHAR2(size)

LONG

The maximum length is 2 GB (2^31-1).

LONG

RAW(size)

The maximum length is 32767 bytes or 2000 bytes.

RAW(size)

LONG RAW

The maximum length is 2 GB.

LONG RAW

CLOB

The maximum length is (4 GB - 1) * DB_BLOCK_SIZE.

CLOB

NCLOB

The maximum length is (4 GB - 1) * DB_BLOCK_SIZE.

CLOB

BLOB

The maximum length is (4 GB - 1) * DB_BLOCK_SIZE.

BLOB

BFILE

4 GB.

Not supported

JSON type

JSON

The maximum length is 32 MB.

JSON

ROWID type

ROWID

64 characters.

VARCHAR

UROWID

64 characters.

Not supported

Spatial types

Custom required

Not supported

FAQ

Are sequence values in Oracle automatically synchronized toPolarDB? How are they synchronized?

PolarDB Sequence values cannot be synchronized automatically. PolarDB logical replication is fully compatible with the PostgreSQL protocol, but sequence values are not currently included in the scope of logical replication in the PostgreSQL protocol.

  1. During schema migration, the database synchronizes the sequence values at the current moment once, denoted as Q1. During the subsequent full data and incremental data synchronization, sequence values in the source database may continue to grow, for example, to Q2, while sequence values in the target database remain unchanged at Q1. However, table data is synchronized between the two databases in real time.

  2. During incremental synchronization before the database switchover, the sequence value of the source database is Q2, and the sequence value of the target database is Q1, which may cause conflicts. For example, if a value is extracted from the Q1 sequence of the target database and written to a table, because the table data is synchronized from the source database, Q1 may have already been used, causing a primary key unique constraint conflict.

Solution

Update sequence values in the destination database: On the DTS task management page, in the Incremental Write module, click Sync Sequence, and set the Offset. DTS generates sequence synchronization statements and executes the sequence value synchronization.

Oracle may use GBK or UTF8 encoding. How do I choose the encoding forPolarDB?

In Oracle, Chinese character sets usually use GBK or UTF8. However, when migrating to PolarDB, we recommend that you choose UTF8 because it provides better compatibility. The specific reasons are as follows:

  • Avoid encoding conflict risks:PolarDB does not recommend GBK as the server character set. Because the encoding range of some characters in the GBK character set conflicts with ASCII codes, encoding errors may occur during data migration.

  • Prevent garbled character insertion: When Oracle uses the GBK character set, invalid GBK encodings can be inserted, which may cause garbled characters when data is read. However, PolarDB does not support this feature, so when the GBK character set is used, data may fail to be inserted.

In summary, we recommend that you choose UTF8 encoding during migration to ensure data compatibility and a smooth migration.

In Oracle, table and column names are uppercase by default, while inPolarDB, table and column names are lowercase by default. How doesPolarDBhandle name conflicts in this case?

Oracle converts attribute names (such as Schema, TABLE, and Column) to uppercase by default, while PolarDB converts attribute names to lowercase by default. When migrating from Oracle to PolarDB, DTS adopts the corresponding default solution based on the actual business situation. The specific solutions are as follows:

  • Uppercase to lowercase by default (no quotation marks used)

    • Use case: Double quotation marks are not used (that is, case-insensitive), and uppercase names are used by default in Oracle.

    • Solution: DTS converts all attribute names to lowercase when migrating them to PolarDB. After switching to PolarDB, you also do not need to use double quotation marks. The database uses lowercase names by default, and no business modification or special configuration is required, which supports a seamless switch.

  • Keep the original case (quotation marks used)

    • Use case: Mixed-case attribute names are used in Oracle, and double quotation marks are used to prevent automatic conversion.

    • Solution: DTS keeps the original case of attribute names by default (you must disable specific mapping). After switching to PolarDB, continue to use double quotation marks. No business modification or special configuration is required, which supports a seamless switch.

  • Query retry

    PolarDB provides an automatic uppercase retry feature by default. That is, if a table name is uppercase, you can query the table by using only uppercase or only lowercase letters.

Are the default meanings ofPolarDBin Oracle and VARCHAR(20) the same?

The default meanings of PolarDB in Oracle and VARCHAR(20) are different.

  • Oracle: The precision of CHAR and VARCHAR types is expressed in bytes.

  • PolarDB: The precision of CHAR and VARCHAR types is expressed in characters by default.

    Note

    PolarDB provides the polar_default_char_length_semantics parameter, which affects the precision of CHAR and VARCHAR types. The default value is off, that is, the character type. If it is set to on, the type is converted to the byte type. You can modify the current cluster parameters in the console.

Solution

  • polar_default_char_length_semantics parameter is set to on, the possible problems are as follows:

    • Business environment: CHAR(10) uses the GBK character set, and PolarDB uses CHAR(10) with the UTF8 character set.

    • Problem: In the forward synchronization from Oracle to PolarDB, Oracle writes a Chinese string of 5 characters, which actually occupies 2 × 5, that is, 10 bytes, which exactly reaches the maximum number of bytes defined by Oracle. If exceeded, an error is reported.

    • Solution:

      Solution 1: Set the polar_default_char_length_semantics parameter to off, which ensures that no problems occur during forward migration.

      Solution 2: Enlarge the table definition length in PolarDB.

  • polar_default_char_length_semantics parameter is set to off, the possible problems are as follows:

    • Business environment: CHAR(10) uses the GBK character set, and PolarDB uses CHAR(10) with the UTF8 character set.

    • Problem: In the reverse synchronization from PolarDB to Oracle, PolarDB writes a Chinese string of 2 characters, which actually occupies 2 + 8 characters, totaling 10 characters. After conversion to bytes, it becomes 2 × 3 + 8, that is, 14 bytes, which exceeds the 10 bytes defined by Oracle, causing a data truncation error.

    • Solution:

      Solution 1: Enlarge the byte length in the source Oracle database to accommodate a larger string length.

      Solution 2: In DTS, use ETL task configuration to truncate characters and remove extra characters. For more information, see.

In Oracle, how do I handle tables without a primary key or unique key? Does it affect data validation?

For tables without a primary key or unique key, DTS cannot ensure data consistency, and multiple records may appear on the target side. The following two solutions are provided based on different business requirements.

  • If data consistency of tables without PKs/UKs is not strictly required, or you plan to deduplicate data in your business, migrate the data normally.

  • If data consistency is required, you can use ROWID in Oracle as the hidden primary key (non-null unique key) of the target side, and delete the added column before the service switchover. On the DTS console, set Add a hidden primary key for a table without a primary key/a table without a unique key to Yes. After the migration task ends, you can click the corresponding button to delete the hidden primary key, so that the data can be migrated and validated. Note that data validation is not supported for tables without primary keys.

If hidden \0 data exists in Oracle data, will it cause problems during migration?

PolarDB does not allow \0 characters, and the internal logic of DTS removes \0 characters.

  • For normal fields, this processing logic may cause the data to be non-equivalent before and after migration, so you need to confirm it in advance.

  • If \0 characters appear in primary key fields, this processing logic may cause data inconsistency. For example, primary key IDs dts\0 and dts will conflict, and only one record is retained when migrating to the target database, resulting in data loss.

In Oracle, the empty string''and NULL are treated as the same object. IsPolarDBcompatible with this?

As an early database, Oracle does not follow the SQL standard for VARCHAR/VARCHAR2 types and treats empty strings as NULL values.PolarDB uses the polar_empty_string_is_null_enable parameter to be compatible with Oracle's empty string behavior. This feature is enabled by default. If you confirm that this feature is no longer needed, you can disable it in the console.

How do I set thePolarDBtime zone? What are the impacts?

In PolarDB, the default time zone is UTC. As a result, all current times in the database are based on UTC.

Example

Take China Beijing time (18:13:34, December 3, 2024) as an example to query:

SELECT * FROM now();

The returned result is as follows:

              now               
--------------------------------
 2024-12-03 10:13:34.018557 +00
(1 row)

To change the time zone to China Beijing time, in the console, set the cluster parameter timezone to PRC, which indicates the China Beijing time zone, and query the current time again:

SELECT * FROM now();

After the time zone is set, the time is shifted by 8 hours. The returned result is as follows:

              now               
--------------------------------
 2024-12-03 18:14:34.841027 +08
(1 row)

In Oracle, the INTEGER type is NUMBER(38), while inPolarDB, the INTEGER type is a 32-bit integer. How doesPolarDBachieve compatibility?

In Oracle, if the following expression exists: CAST(val AS INTEGER) you need to rewrite it as CAST(val AS NUMBER(38)) to avoid the out of integer error.

Example

PolarDB in PolarDB, the following range causes the out of integer error, whereas Oracle can execute it normally.

SELECT CAST(99999999999 AS INTEGER) FROM dual;
  • The result returned by Oracle is as follows:

       CAST(99999999999ASINTEGER)
    _____________________________
                      99999999999
  • PolarDB The result returned by PolarDB is as follows:

    ERROR:  integer out of range

In PolarDB, modify the preceding statement to:

SELECT CAST(99999999999 AS NUMBER(38)) FROM dual;

PolarDB The result returned by PolarDB is as follows:

   numeric   
-------------
 99999999999
(1 row)