All Products
Search
Document Center

ApsaraDB RDS:Migrate MyBase for PostgreSQL to ApsaraDB RDS for PostgreSQL

Last Updated:Jun 21, 2026

This document describes how to migrate a MyBase for PostgreSQL instance to an ApsaraDB RDS for PostgreSQL instance by using Cloud Migration.

Prerequisites

  1. Create an ApsaraDB RDS for PostgreSQL instance that meets the following requirements:

    • The version and category must match those of the source MyBase for PostgreSQL instance.

    • The disk space must be larger than the space used by the source MyBase for PostgreSQL instance.

    • The instance family must be dedicated.

    For more information about how to create an instance, see Quickly create an ApsaraDB RDS for PostgreSQL instance.

    Note
  2. Configure an IP whitelist to ensure that the ApsaraDB RDS for PostgreSQL and MyBase for PostgreSQL instances can access each other. For more information, see Configure an IP whitelist for an ApsaraDB RDS for PostgreSQL instance and Configure an IP whitelist for a MyBase for PostgreSQL instance.

    You can log on to the ApsaraDB RDS or ApsaraDB for MyBase console to view the internal CIDR block of your instance. In the navigation pane on the left, click Database Connection. On this page, find the Network Type row to view the instance's internal CIDR block, such as 172.x.x.x. The internal port is 5432.

  3. Create a high-privilege account for the MyBase for PostgreSQL instance. For more information, see Create a database account.

Precautions

  • During the Cloud Migration task, you can read from and write to the source MyBase for PostgreSQL database. However, do not perform operations such as another migration, a restart, or specification changes.

  • If you set the MyBase for PostgreSQL instance to read-only, your applications can only read from the instance.

  • Instances of the new general-purpose instance family do not support migration over the public network.

Step 1: Feasibility assessment

  1. Go to the Instances page. In the top navigation bar, select the region in which the RDS instance resides. Then, find the RDS instance and click the ID of the instance.

  2. In the navigation pane on the left, click Cloud Migration/Disaster Recovery. Then, click the Feasibility Assessment tab.

  3. In the Select Scenario and Source Type step of the configuration wizard, select Cloud Migration for the scenario and select Alibaba Cloud RDS Instance for the source type. Then, click Next.

  4. On the Configure Destination Instance page, click Next.

  5. In the Source Instance Configuration step, select all completed prerequisite checks and click Next.

  6. In the Start Feasibility Assessment step, configure the source database information.

    Parameter

    Description

    Migration Task Name

    The system automatically generates a name. You do not need to change it.

    Source VPC IP/DNS

    The endpoint of the MyBase for PostgreSQL instance. For more information about how to view the public and internal endpoints of an instance, see View or change the internal and public endpoints and ports.

    Source Instance Port

    The port number of the MyBase for PostgreSQL instance. For more information about how to view the port number of an instance, see View or change the internal and public endpoints and ports.

    Username

    The high-privilege account of the MyBase for PostgreSQL instance. For more information about how to view the instance account, see View a database account.

    Password

    The password for the high-privilege account.

  7. Click Create Feasibility Assessment Task.

    Note

    During the feasibility assessment task, the instance status changes to Maintaining Instance.

    After the feasibility assessment is complete, you can view the status of the assessment task in the Cloud Migration list on the Feasibility Assessment page.

    After you resolve the error, you can click Re-assess in the Actions column to run the assessment again.

Step 2: Cloud Migration

Note

You can perform this step only after the feasibility evaluation is successful.

  1. On the Cloud Migration tab, click Create Cloud Migration Task.

  2. In the dialog box that appears, select the successful feasibility assessment task from Step 1: Feasibility assessment in the Associated Assessment Task drop-down list.

    Note

    After you select an Associated Assessment Task, the Migration Source Type, Source IP/ DNS, Port of Source Instance, and Username parameters are automatically populated.

  3. Click Start Cloud Migration to start the migration task.

    Important

    During the migration task, the instance status changes to Migrating Data. You can read from and write to the source MyBase for PostgreSQL database, but do not perform operations such as another migration, a restart, or specification changes.

  4. Perform a cloud cutover.

    1. In the migration task list, click the link in the Cloud Migration Phase column to view the progress of the current task.

    2. When the cloud migration phase is incremental synchronization, you can click Cloud Switchover in the Actions column to make the ApsaraDB RDS for PostgreSQL instance the primary instance.

    3. In the Switch to Cloud dialog box, follow the on-screen instructions to set the MyBase for PostgreSQL instance to read-only or stop application writes.

      Note

      To set the MyBase for PostgreSQL instance to read-only:

      Log on to the MyBase for PostgreSQL database and run the following command to check whether a superuser exists.

      SELECT CASE WHEN(count(rolname)<= 3) THEN 'superuser check ok' ELSE 'exists superuser created by user' END AS result
        FROM pg_roles
       where rolsuper= 't'
         and rolname in ('aurora', 'replicator')
          or rolname like 'pg%'
       GROUP BY rolname
       limit 1;
      • If a superuser exists, contact an Alibaba Cloud engineer to modify the settings.

      • If no superuser exists, perform the following steps to modify the settings:

        1. Log on to the ApsaraDB for MyBase console.

        2. Use the Parameter Settings feature to set the rds_force_trans_ro_non_sup parameter to on. In the navigation pane on the left, click Parameter Settings. On the Modifiable Parameters tab, find the rds_force_trans_ro_non_sup parameter, change its running value to on, and then click Submit Parameters.

        3. After the modification is complete, log on to the MyBase for PostgreSQL database and run the following command to terminate all active sessions.

          SELECT pg_terminate_backend(pid) FROM pg_stat_activity
          WHERE usename not in ('replicator', 'monitor', 'pgsql', 'aurora') AND pid != pg_backend_pid();
    4. Select all checkboxes and click Switch Now. Wait for the migration to complete.

Step 3: Connect to your application

Option 1: Swap endpoints (recommended)

Change the endpoint of the MyBase for PostgreSQL instance. Then, assign its original endpoint to the ApsaraDB RDS for PostgreSQL instance.

For example, assume that the endpoint of your MyBase for PostgreSQL instance is pgm-aaa.pg.rds.aliyuncs.com and the endpoint of your ApsaraDB RDS for PostgreSQL instance is pgm-bbb.pg.rds.aliyuncs.com. You can change the endpoint of the MyBase for PostgreSQL instance to pgm-ccc.pg.rds.aliyuncs.com and then change the endpoint of the ApsaraDB RDS for PostgreSQL instance to pgm-aaa.pg.rds.aliyuncs.com.

Option 2: Update the application endpoint

Obtain the endpoint of the ApsaraDB RDS for PostgreSQL instance, and then update it in your application's configuration.