You can use logical backup files to migrate data from an ApsaraDB RDS PPAS instance to an on-premises PPAS database.
Procedure
- Connect the PostgreSQL client to ApsaraDB RDS PPAS.
- Run the following command to back up data:
The parameters are described as follows:pg_dump -U username -h hostname -p port databasename -f filename
- username: the username that is used to log on to the ApsaraDB RDS PPAS database.
- hostname: the hostname of the ApsaraDB RDS PPAS database.
- port: the port number of the ApsaraDB RDS PPAS database.
- databasename: the name of the ApsaraDB RDS PPAS database that you want to back up.
- filename: the name of the backup file to be generated. Example:
pg_dump -U ppas_user -h rdsv07z563m7o25cj550public.ppas.rds.aliyuncs.com -p 3433 edb -f ppas.sql
- Save the ppas.sql backup file to the destination server.
- Run the following command to restore data to the on-premises database:
The parameters are described as follows:psql -U username -h hostname -d desintationdb -p port -f dumpfilename.sql
- username: the username that is used to log on to the on-premises database.
- hostname: the hostname of the on-premises database.
- port: the port number of the on-premises database.
- databasename: the name of the on-premises database.
- filename: the name of the backup file. Example:
Permission settings of the ApsaraDB RDS PPAS database are different from those of the on-premises database. Therefore, some permission-related warnings or errors may occur during data import. Examples of warnings or errors that can be ignored are as follows:psql -U ppas_user -h localhost -d edb -p 5444 -f ppas.sql
WARNING: no privileges could be revoked for "xxxxx" ERROR: role "xxxxx" does not exist