This topic describes how to create a database link from a PolarDB for PostgreSQL (Compatible with Oracle) cluster to a self-managed PostgreSQL database hosted on an Elastic Compute Service (ECS) instance.
For more information about how to create a database link from a PolarDB for PostgreSQL (Compatible with Oracle) cluster to a PolarDB for PostgreSQL (Compatible with Oracle), see Create a database link from PolarDB for PostgreSQL (Compatible with Oracle) to PolarDB for PostgreSQL (Compatible with Oracle).
Prerequisites
The PolarDB for PostgreSQL (Compatible with Oracle) cluster and the self-managed PostgreSQL database hosted on the ECS instance belong to the same Alibaba Cloud account.
The ECS instance is deployed in a virtual private cloud (VPC).
The kernel version of PolarDB for PostgreSQL (Compatible with Oracle) is the latest kernel version. For more information about how to upgrade the kernel version, see Version management.
A database link is created from the PolarDB for PostgreSQL (compatible with Oracle) cluster to the self-managed PostgreSQL database hosted on the ECS instance.
Precautions
You can create a maximum of 10 database links for each PolarDB for PostgreSQL (Compatible with Oracle) cluster can create a maximum of 10 database links. Each database link consumes one database link quota of both the source cluster and the destination cluster.
Procedure
Log on to the PolarDB console. Click Clusters in the left-side navigation pane. Select a region in the upper-left corner and click the ID of the cluster in the list to go to the Basic Information page.
In the left-side navigation pane, choose .
On the Databases page, click the DBLinks tab.
NoteIf the DBLinks tab is not displayed on the Databases page of your PolarDB cluster, see the instructions in Network channels to enable it.
Click Create DBLink 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 (_).
The name must start with a lowercase letter and end with a lowercase letter or a digit.
The name can be up 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 for PostgreSQL (Compatible with Oracle) cluster. The value is fixed and cannot be modified.
Source Database Name
Select a database in the current PolarDB for PostgreSQL (Compatible with Oracle) cluster from the drop-down list.
VPC of Destination Instance
The VPC in which 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.
Region ID of Destination Instance
The region ID of the ECS instance, 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.
VPC Port of Destination Instance
The port number of the self-managed PostgreSQL database hosted on the ECS instance. Default value: 1521.
Destination Account
The account used to log on to the self-managed PostgreSQL database hosted on the ECS instance.
Destination Account Password
The password used to log on to the self-managed PostgreSQL database hosted on the ECS instance.
Destination Database Name
The name of the self-managed PostgreSQL database hosted on the ECS instance.
Click OK.
Related API operations
API | Description |
Creates a database link for a PolarDB for PostgreSQL (Compatible with Oracle) cluster. | |
Queries the database link information of a PolarDB for PostgreSQL (Compatible with Oracle) cluster. |