This topic describes how to restore data from an AnalyticDB for PostgreSQL instance backup to a new instance.
Usage notes
The availability of a restore point depends on whether any node in the instance has proactively discarded archive logs. For more information about proactively discarded archive logs, see the log backup description in How it works.
Before you restore data, ensure that no node in the source instance has proactively discarded archive logs between the last full backup and your desired restore point.
You can Submit a ticket to confirm the availability of a specific restore point.
The source and new instances must use Elastic Storage Mode.
The source and new instances must be in the same region.
The storage capacity of the new instance must be greater than or equal to that of the source instance.
Rebuilding the instance can take several hours, depending on the data volume of the source instance.
Procedure
- Log on to the AnalyticDB for PostgreSQL console.
- In the upper-left corner of the console, select a region.
- Find the instance that you want to manage and click the instance ID.
- In the left-side navigation pane, click Backup and Restoration.
On the Data Backup or Restore Points tab, find the target backup set, and click Restore in the Actions column.
On the Clone Instance page, configure the following parameters.
Parameter
Description
Source Instance
This is fixed to the source instance.
Clone Source Type
This is fixed to Backup Set.
Source Backup Set
Select the point in time to which you want to restore data.
Region
Select the region for the new instance. By default, this parameter is set to the region of the source instance.
Zone
Select the zone for the new instance based on your business requirements.
Network Type
The network type of the target instance. This parameter is fixed to VPC.
VPC
Select the VPC ID.
VSwitch
Select the vSwitch in the specified VPC.
Instance Resource Type
Select the resource type for the instance. The backup and restoration feature supports only Elastic Storage Mode.
Instance Edition
Select High-performance (Basic Edition) or High-availability Edition based on your requirements.
The Basic Edition is available only in specific regions and zones. For more information, see Availability.
For more information about the Basic Edition, see High-performance Edition instances.
Engine Version
Select the engine version for the new instance. The new instance must have the same engine version as the source instance.
Coordinator Node Resources
Select the coordinator node resources for the new instance. The coordinator node specifications must be greater than or equal to the compute node specifications. For more information, see Manage coordinator node resources.
Compute Node Specifications
Select the compute node specifications for the new instance.
Number of Compute Nodes
Select the number of compute nodes for the new instance.
Single-node Storage Capacity
Select the storage capacity for each compute node of the new instance. The total storage capacity must be greater than or equal to the source instance's capacity.
Disk Storage Type
Select a disk type. The following types are supported:
PL1 ESSD (Recommended)
PL0 ESSD
PL2 ESSD (High-throughput)
For more information, see Change the disk storage type.
Encryption Type
Select an encryption type.
If you select Disk Encryption, you must also select a CMK.
Read and select Service Agreement.
Click Buy Now.
NoteThe system copies data from the source to the new instance. This process can take several hours, depending on the data volume.
FAQ
How to restore a single table
AnalyticDB for PostgreSQL does not directly support restoring a single table. However, the following steps provide a workaround.
Follow the steps in the Procedure section to restore the data of the source instance to a new instance in the same region and VPC.
On the External Data Source Management page of the original instance, add the newly restored instance as a remote AnalyticDB data source. For the detailed procedure, see Step 1 in Access a remote AnalyticDB data source.
On the source instance, create a foreign table that maps to the table in the new instance.
CREATE FOREIGN TABLE s01.t1(a int, b int) SERVER example_name OPTIONS(schema_name 's02', table_name 't1');On the source instance, rename the original table. For example, rename the testtable table to testtable_old.
On the source instance, create a new table named
testtableand import data from the foreign tables01.t1into the new table.ImportantAvoid writing data to the source table during the rename, create, and import operations. If new data is written, you must add the new data to the table after the import is complete.
CREATE TABLE testtable(a int, b int); INSERT INTO testtable SELECT * FROM s01.t1;After you verify the data import, release the new instance.