About pg_upgrade v16
The pg_upgrade
executable is distributed with EDB Postgres Advanced Server and is installed as part of the Database Server component. You don't need to further install or configure it.
The pg_upgrade
utility performs an in-place transfer of existing data between EDB Postgres Advanced Server and any later version.
Before performing a version upgrade, pg_upgrade
verifies that the old cluster and the new cluster are compatible.
When pg_upgrade
starts, it performs a compatibility check to ensure that all required executables are present and contain the expected version numbers. The verification process also checks the old and new $PGDATA
directories to ensure that the expected files and subdirectories are in place. If the verification process succeeds, pg_upgrade
starts the old postmaster
and runs pg_dumpall --schema-only
to capture the metadata contained in the old cluster. The script produced by pg_dumpall
is used in later to re-create all user-defined objects in the new cluster.
The script produced by pg_dumpall
re-creates only user-defined objects and not system-defined objects. The new cluster already contains the system-defined objects created by the latest version of EDB Postgres Advanced Server.
After extracting the metadata from the old cluster, pg_upgrade
performs the bookkeeping tasks required to sync the new cluster with the existing data.
pg_upgrade
runs the pg_dumpall
script against the new cluster to create empty database objects of the same shape and type as those found in the old cluster. Then, pg_upgrade
links or copies each table and index from the old cluster to the new cluster.
If you're upgrading to EDB Postgres Advanced Server and installed the edb_dblink_oci
or edb_dblink_libpq
extension, drop the extension before performing an upgrade. To drop the extension, connect to the server with the psql or PEM client, and invoke the commands:
When you finish upgrading, you can use the CREATE EXTENSION
command to add the current versions of the extensions to your installation.
Note
If the upgrade involves a change in the on-disk representation of database objects or data, or if it involves a change in the binary representation of data types, pg_upgrade
can't perform the upgrade. To upgrade, you have to pg_dump
the old data and then import that data to the new cluster.