- What's New
- Function Overview
- Product Bulletin
- Service Overview
- Billing
-
Getting Started
- Getting Started with RDS for MySQL
- Getting Started with RDS for MariaDB
- Getting Started with RDS for PostgreSQL
- Change History
- Huawei Cloud MySQL Kernel
-
User Guide
-
Working with RDS for MySQL
- Suggestions on Using RDS for MySQL
- Database Migration
- Performance Tuning
- Instance Lifecycle
-
Instance Modifications
- Upgrading a Minor Version
- Changing a DB Instance Name
- Changing a DB Instance Description
- Changing the Replication Mode
- Changing the Failover Priority
- Changing a DB Instance Class
- Scaling Up Storage Space
- Configuring Storage Autoscaling
- Changing the Maintenance Window
- Changing a DB Instance Type from Single to Primary/Standby
- Promoting a Read Replica to Primary
- Manually Switching Between Primary and Standby DB Instances
- Changing the AZ of a Standby DB Instance
- Read Replicas
- Data Backups
- Data Restorations
-
Parameter Templates
- Creating a Parameter Template
- Modifying Parameters of an RDS for MySQL Instance
- Exporting a Parameter Template
- Comparing Parameter Templates
- Viewing Parameter Change History
- Replicating a Parameter Template
- Resetting a Parameter Template
- Applying a Parameter Template
- Viewing Application Records of a Parameter Template
- Modifying a Parameter Template Description
- Deleting a Parameter Template
- Connection Management
-
Database Proxy (Read/Write Splitting)
- Introducing Read/Write Splitting
- Suggestions on Using Database Proxy
- Kernel Versions
- Best Practices for Database Proxy
- Enabling Read/Write Splitting
- Configuring Transaction Splitting
- Configuring Connection Pools
- Configuring Multi-Statement Processing Modes
- Changing a Proxy from Pay-per-Use to Yearly/Monthly
- Configuring the Delay Threshold and Routing Policy
- Changing the Read/Write Splitting Address
- Changing the Read/Write Splitting Port
- Changing the Instance Class of a DB Proxy Instance
- Changing the Number of Proxy Nodes
- Upgrading the Kernel Version of Database Proxy
- Enabling or Disabling Access Control
- Restarting a Database Proxy
- Modifying Read/Write Splitting Parameters
- Disabling Read/Write Splitting
- Testing Read/Write Splitting Performance
- Database Management
- Account Management (Non-Administrator)
- Account and Network Security
- Metrics
- Interconnection with CTS
- Log Management
- Task Center
- Billing Management
- Managing Tags
-
Working with RDS for MariaDB
- Suggestions on Using RDS for MariaDB
- Instance Connection
- Parameter Tuning
- Instance Lifecycle
- Instance Modifications
- Read Replicas
- Data Backups
- Data Restorations
-
Parameter Templates
- Creating a Parameter Template
- Modifying RDS for MariaDB Instance Parameters
- Exporting a Parameter Template
- Importing a Parameter Template
- Comparing Parameter Templates
- Viewing Parameter Change History
- Replicating a Parameter Template
- Resetting a Parameter Template
- Applying a Parameter Template
- Viewing Application Records of a Parameter Template
- Modifying a Parameter Template Description
- Deleting a Parameter Template
- Connection Management
- Database Management
- Account Management (Non-Administrator)
- Account and Network Security
- Metrics
- Interconnection with CTS
- Log Management
- Task Center
- Managing Tags
-
Working with RDS for PostgreSQL
- Suggestions on Using RDS for PostgreSQL
- Database Migration
- Performance Tuning
- Instance Lifecycle
-
Instance Modifications
- Upgrading a Minor Version
- Changing a DB Instance Name
- Changing a DB Instance Description
- Changing the Replication Mode
- Changing the Failover Priority
- Changing a DB Instance Class
- Scaling Storage Space
- Changing the Maintenance Window
- Changing a DB Instance Type from Single to Primary/Standby
- Manually Switching Between Primary and Standby DB Instances
- Changing the AZ of a Standby DB Instance
- Read Replicas
- Data Backups
- Data Restorations
-
Parameter Templates
- Creating a Parameter Template
- Modifying Parameters of an RDS for PostgreSQL Instance
- Exporting a Parameter Template
- Comparing Parameter Templates
- Viewing Parameter Change History
- Replicating a Parameter Template
- Resetting a Parameter Template
- Applying a Parameter Template
- Viewing Application Records of a Parameter Template
- Modifying a Parameter Template Description
- Deleting a Parameter Template
- Connection Management
- Extension Management
- Tablespace Management
- Account and Network Security
- Metrics
- Interconnection with CTS
- Log Management
- Task Center
- Billing Management
- Major Version Upgrade
- Managing Tags
-
Working with RDS for MySQL
- Best Practices
- Performance White Paper
-
API Reference
- Before You Start
- API Overview
- Calling APIs
- API v3.1 (Recommended)
-
API v3 (Recommended)
- Querying Version Information About APIs
- Querying Version Information About a DB Engine
- Querying Database Specifications
- Querying the Storage Type of a Database
-
DB Instance Management
- Creating a DB Instance
- Stopping an Instance
- Changing a DB Instance Name
- Changing the Description of a DB Instance
- Changing DB Instance Specifications
- Scaling Up Storage Space of a DB Instance
- Changing a Single DB Instance to Primary/Standby DB Instances
- Rebooting a DB Instance
- Deleting a DB Instance
- Querying DB Instances
- Binding and Unbinding an EIP
- Changing the Failover Priority
- Manually Switching Primary/Standby DB Instances
- Changing the Data Replication Mode of Primary/Standby DB Instances
- Configuring the Maintenance Window
- Database Security
- Backup and Restoration
- Log Information Queries
-
Database and Account Management (MySQL)
- Creating a Database
- Querying Details About a Database
- Querying Databases
- Querying Authorized Databases of a Specified User
- Deleting a Database
- Creating a Database Account
- Querying Database Users
- Querying Authorized Users of a Specified Database
- Deleting a Database Account
- Configuring a Password for a Database Account
- Authorizing a Database Account
- Revoking Permissions of a Database Account
- Resetting the Password for User root
- Database and Account Management (PostgreSQL)
-
Parameter Management
- Obtaining a Parameter Template List
- Creating a Parameter Template
- Modifying a Parameter Template
- Applying a Parameter Template
- Modifying Parameters of a Specified DB Instance
- Obtaining the Parameter Template of a Specified DB Instance
- Obtaining Parameters in a Specified Parameter Template
- Deleting a Parameter Template
- Recycling a DB Instance
- Tag Management
- Obtaining Task Information
- Appendix
- Change History
- SDK Reference
-
FAQs
- Product Consulting
- Resource and Disk Management
-
Database Connection
- What Should I Do If I Can't Connect to My RDS DB Instance?
- Can an External Server Access the RDS Database?
- What Do I Do If the Number of RDS Database Connections Reaches the Upper Limit?
- What Is the Maximum Number of Connections to an RDS DB Instance?
- How Can I Create and Connect to an ECS?
- What Should I Do If an ECS Cannot Connect to an RDS DB Instance Through a Private Network?
- What Should I Do If a Database Client Problem Causes a Connection Failure?
- What Should I Do If an RDS Database Problem Causes a Connection Failure?
- How Do My Applications Access an RDS DB Instance in a VPC?
- Do Applications Need to Support Reconnecting to the RDS DB Instance Automatically?
- Why Cannot I Ping My EIP After It Is Bound to a DB Instance?
- How Can I Obtain the IP Address of an Application?
- Can I Access an RDS DB Instance Over an Intranet Connection Across Regions?
- Is an SSL Connection to a DB Instance Interrupted After a Primary/Standby Switchover or Failover?
- Database Migration
- Database Permission
- Database Storage
- Client Installation
- Backup and Restoration
- Database Monitoring
- Capacity Expansion and Specification Change
- Database Parameter Modification
- Network Security
- Change History
- Troubleshooting
- Videos
Upgrading the Major Version of a DB Instance Using SQL Commands
Scenarios
You can upgrade the RDS for PostgreSQL major version to enjoy more functions and higher performance and security. Major version upgrades may introduce changes that are backward incompatible with existing versions and affect service running. Therefore, you need to test services on the target version before the upgrade.
In this section, the source instance indicates the DB instance that runs the source version, and the target instance indicates the DB instance that runs the target version.
RDS for PostgreSQL Version Description
- RDS for PostgreSQL v10 and later versions consist of a major version and a minor version. A major version upgrade refers to the upgrade of the major version, such as from 11.x to 12.x.
- Versions earlier than RDS for PostgreSQL v10 consist of two major versions and a minor version. A major version upgrade refers to the upgrade of the major versions, such as from 9.5.x to 9.6.x or from 9.x.x to 10.x.
Preparations
- View information about the RDS for PostgreSQL DB instance to be upgraded.
- On the Instances page, click the DB instance to be upgraded.
- On the Basic Information page, view the region, AZ, VPC, subnet, and security group of the DB instance.
- Prepare an ECS.
To connect to a DB instance through an ECS, you must first create an ECS.
The region, AZ, VPC, subnet, and security group of the ECS are the same as those of the RDS for PostgreSQL DB instance to be upgraded.
- Install a PostgreSQL client on the ECS created in 2.
NOTE:
The version of the RDS for PostgreSQL client must be the same as that of the RDS for PostgreSQL instance. The RDS for PostgreSQL instance or client provides pg_dump, pg_restore, and psql.
- Select a target version that contains all extensions based on the used extension list.
For details about the extensions supported by different RDS for PostgreSQL versions, see Supported Extensions.
- Create a parameter template that is compatible with the source version by referring to Creating a Parameter Template.
- Create an RDS for PostgreSQL instance running the target version.
- The region, AZ, VPC, subnet, and security group of the target instance are the same as those of the source instance.
Procedure
Perform the following operations on the prepared ECS.
- Use psql to connect to the source instance and run the following SQL statement to obtain the database list:
postgres=# \l
- Use psql to connect to the target instance and run the following SQL statement to check whether all databases obtained in 1 exist on the target instance:
postgres=# \l
- If yes, go to 3.
- If no, run the following SQL statement to create databases that does not exist on the target instance and go to 3.
postgres=# create database my_target_db;
NOTE:
- The template databases template0 and template1 do not need to be migrated.
- The postgres database is created by default and does not need to be migrated unless it stores service data.
- Use pg_dump to dump the source instance and use pg_restore to restore data to the target instance. Repeat 3 to 4 on each service database.
- For versions other than RDS for PostgreSQL 11, run the following dump command:
pg_dump -Fc -v --host=source_IP --port=source_port --username=my_user --dbname=my_source_db | pg_restore -v --no-owner --host=target_IP --port=target_port --username=my_user --dbname=my_target_db
- For RDS for PostgreSQL 11, run the following dump command:
pg_dump -Fc -v --host=source_IP --port=source_port -Ndbms_lob -Ndbms_output -Ndbms_random -Nsys -Nutl_raw -Npg_catalog --username=my_user --dbname=my_source_db | pg_restore -v --no-owner --host=target_IP --port=target_port --username=my_user --dbname=my_target_db
NOTE:
- The login user using pg_dump must have the permission to access all objects in the database.
- The login user using pg_restore must have all operation permissions on the database.
- For details about how to grant permissions, see GRANT.
- If the pg_dump command uses the -N parameter, blobs will not be exported.
- If the pg_dump command uses the -Fc parameter, the exported file is in binary format. To export SQL files, use the -Fp parameter.
- For versions other than RDS for PostgreSQL 11, run the following dump command:
- After a database is migrated, test services on the target database to ensure that the services are running properly on it.
- Check that services are running properly on the target databases. Then, switch services to the target instance and delete the source instance.
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.