This topic describes how to create a database link from PolarDB-O to a user-created Oracle database hosted on an Elastic Compute Service (ECS) instance.

For more information about how to create a database link from a PolarDB-O cluster to a PolarDB-O cluster, see Create a database link from PolarDB-O to PolarDB-O.

Prerequisites

  • The PolarDB-O cluster and the user-created Oracle database hosted on ECS belong to the same Alibaba Cloud account.
  • The ECS instance is deployed in a virtual private cloud (VPC).
  • The kernel version of the PolarDB-O cluster is the latest kernel version. For information about how to upgrade the kernel version, see Upgrade the minor version.
  • Submit a ticket to apply for creating database links from PolarDB-O clusters to user-created Oracle databases hosted on ECS in the console.
    Note You can call the CreateDBLink operation to create a database link from a PolarDB-O cluster to a user-created Oracle database. This way, you do not need to submit a ticket.

Notes

You can create a maximum of 10 database links for each PolarDB-O cluster. Each database link consumes one database link quota of both the source cluster and the destination cluster.

Procedure

  1. Log on to the PolarDB console.
  2. In the upper-left corner of the console, select the region where the cluster resides.
  3. Find the cluster, and then click the cluster ID.
  4. In the left-side navigation pane, choose Settings and Management > Databases.
  5. On the Databases page, click the DBLinks tab in the upper part.
  6. Click Create DBLink to User-create Database and configure the following parameters.
    Parameter Description
    DBLink Name You can enter a custom name of the database link. The name must meet the following requirements:
    • The name must contain lowercase letters and can contain digits and underscores (_).
    • It must start with a lowercase letter and end with a letter or a digit.
    • It must be 1 to 64 characters in length.

    This name is required when you use the database link for cross-database queries.

    Source Instance Name The name of the current PolarDB-O cluster is used as the fixed value. You cannot modify this parameter.
    Source Database Name Select a database in the current PolarDB-O cluster from the drop-down list.
    VPC of Destination Instance The VPC where the ECS instance resides.

    You can view the VPC ID of the destination ECS instance in the Network Information section on the Basic Information page in the ECS console.

    dblink-vpcid
    Region ID of Destination Instance The ID of the region where the ECS instance resides, such as cn-hangzhou.

    You can call the DescribeInstances operation to query the region ID of the destination ECS instance.

    VPC ID of Destination Instance The IP address of the ECS instance.

    You can view the primary private IP address of the destination ECS instance in the Network Information section on the Basic Information page in the ECS console.

    dblink-vpc-ip
    VPC Port of Destination Instance The port number of the user-created Oracle database hosted on ECS. The default port number is 1521.
    Destination Account The account of the user-created Oracle database hosted on ECS.
    Destination Account Password The account password of the user-created Oracle database hosted on ECS.
    Destination Database Name The name of the user-created Oracle database hosted on ECS.
  7. Click OK.

Related operations

API Description
CreateDBLink Creates a database link for a PolarDB-O cluster.
DescribeDBLinks Queries the database link information of a PolarDB-O cluster.