Updated on 2025-08-20 GMT+08:00

Restoring a Database from a Read Replica to the Primary DB Instance

Function

This API is used to restore a database from a read replica to the primary DB instance.

Constraints

  • To use this function, contact customer service.
  • This API is available only to read replicas of RDS for PostgreSQL 12 or later.

URI

  • URI format

    POST /v3/{project_id}/instances/{instance_id}/log-replay/database

  • Parameter description
    Table 1 Parameters

    Parameter

    Mandatory

    Description

    project_id

    Yes

    Definition

    Project ID of a tenant in a region.

    To obtain the value, see Obtaining a Project ID.

    Constraints

    N/A

    Range

    N/A

    Default Value

    N/A

    instance_id

    Yes

    Definition

    ID of the instance to be queried.

    Constraints

    N/A

    Range

    N/A

    Default Value

    N/A

Request Parameters

Table 2 Parameters

Parameter

Mandatory

Type

Description

databases

Yes

Array of objects

Definition

Databases to be restored.

For details, see Table 3.

Constraints

N/A

Range

N/A

Default Value

N/A

Table 3 databases field data structure description

Parameter

Mandatory

Type

Description

old_name

Yes

String

Definition

Name of the original database to be restored.

Constraints

N/A

Range

N/A

Default Value

N/A

new_name

Yes

String

Definition

Name of the new database after the restoration.

Constraints

N/A

Range

N/A

Default Value

N/A

Example Request

Restore a database from a read replica to the primary DB instance.

POST https://rds.ap-southeast-1.myhuaweicloud.com/v3/0483b6b16e954cb88930a360d2c4e663/instances/794c38e5309344818f4b33b86ebce9b4in03/log-replay/database

{ 
  "databases" : [ { 
    "old_name" : "old", 
    "new_name" : "new" 
  } ] 
}

Response

  • Normal response
    Table 4 Parameters

    Parameter

    Type

    Description

    job_id

    String

    Definition

    Task flow ID.

    Range

    N/A

  • Example normal response
    { 
      "job_id" : "8465d1fb-20a8-48e6-9c9b-3d1958ecbb9e"
    }
  • Abnormal response

    For details, see Abnormal Request Results.

Status Code

Error Code

For details, see Error Codes.