Creates a database link.
Operation description
A database link can be used to connect two PolarDB for PostgreSQL(Compatible with Oracle) clusters, or connect a PolarDB for PostgreSQL(Compatible with Oracle) cluster to a user-created PostgreSQL database that is hosted on an Elastic Compute Service (ECS) instance. You can use database links to query data across clusters.
Debugging
Authorization information
The following table shows the authorization information corresponding to the API. The authorization information can be used in the Action
policy element to grant a RAM user or RAM role the permissions to call this API operation. Description:
- Operation: the value that you can use in the Action element to specify the operation on a resource.
- Access level: the access level of each operation. The levels are read, write, and list.
- Resource type: the type of the resource on which you can authorize the RAM user or the RAM role to perform the operation. Take note of the following items:
- The required resource types are displayed in bold characters.
- If the permissions cannot be granted at the resource level,
All Resources
is used in the Resource type column of the operation.
- Condition Key: the condition key that is defined by the cloud service.
- Associated operation: other operations that the RAM user or the RAM role must have permissions to perform to complete the operation. To complete the operation, the RAM user or the RAM role must have the permissions to perform the associated operations.
Operation | Access level | Resource type | Condition key | Associated operation |
---|---|---|---|---|
polardb:CreateDBLink | Write |
|
| none |
Request parameters
Parameter | Type | Required | Description | Example |
---|---|---|---|---|
ResourceGroupId | string | No | The ID of the resource group. | rg-************ |
DBClusterId | string | Yes | The ID of the source cluster that the database link connects. Note
You can call the DescribeDBClusters operation to query PolarDB clusters.
| pc-a************ |
DBLinkName | string | Yes | The name of the database link.
| dblink_test |
TargetDBInstanceName | string | Yes | The ID of the destination cluster that the database link connects. Note
null . | pc-b************ |
TargetDBAccount | string | Yes | The account of the destination database. Note
You can call the DescribeAccounts operation to query the account of a PolarDB cluster.
| testacc |
TargetDBPasswd | string | Yes | The account password of the destination database. | Test1111 |
TargetDBName | string | Yes | The name of the destination database. Note
You can call the DescribeDatabases operation to query information about databases in a PolarDB cluster.
| testdb2 |
SourceDBName | string | Yes | The name of the source database. Note
You can call the DescribeDatabases operation to query information about databases in a PolarDB cluster.
| testdb1 |
TargetIp | string | No | The IP address of the user-created Oracle database on an ECS instance. | 192.**.**.46 |
TargetPort | string | No | The port number of the user-created Oracle database on an ECS instance. | 1521 |
VpcId | string | No | The ID of the virtual private cloud (VPC). Note
You can call the DescribeVpcs operation to query information about VPCs.
| vpc-bp1qpo0kug3a20qqe**** |
RegionId | string | No | The ID of the region. Note
You can call the DescribeRegions operation to query information about regions.
| cn-hangzhou |
ClientToken | string | No | The client token that is used to ensure the idempotence of the request. You can use the client to generate the value, but you must make sure that it is unique among different requests. The token can only contain ASCII characters and cannot exceed 64 characters in length. The token is case-sensitive. | 6000170000591aed949d0f54a343f1a4233c1e7d1c5c****** |
Response parameters
Examples
Sample success responses
JSON
format
{
"RequestId": "F9F1CB1A-B1D5-4EF5-A53A-************"
}
Error codes
HTTP status code | Error code | Error message | Description |
---|---|---|---|
400 | InvalidDBLinkName.Malformed | The specified parameter DBLinkName is not valid. | The specified DBLinkName parameter is invalid. |
404 | InvalidDBClusterId.NotFound | The DBClusterId provided does not exist in our records. | The specified DBClusterId parameter does not exist in the current record. |
404 | DBLinkSourceDBNotFound | Specified source db does not exist. | The specified source database does not exist. |
For a list of error codes, visit the Service error codes.
Change history
Change time | Summary of changes | Operation | ||||||
---|---|---|---|---|---|---|---|---|
2023-09-12 | The Error code has changed | see changesets | ||||||
|