Backup:
Pg_dumpall-u Postgres> backup_file
Recovery:
Psql-u Postgres <backup_file
Upgrade (of course, migrate the previous data to the new system ):
The PostgreSQL version I used on Windows XP is 8.1. Now that the new version 8.3.4 is available, I want to upgrade it to this version.
Generally, minor version upgrades are available. For example, if you upgrade 8.3.1 to 8.3.4, you only need to upgrade the program and the original data is still available. However, to upgrade 8.1 to 8.3.x
Use pg_dump, pg_dumpall, Psql, or pg_restore commands.
If the two systems can coexist, run the following command:
Pg_dumpall-P 5432 | Psql-D template1-P 6543
When I use it, the system prompts that the administrator password is incorrect, so I use the command
Pg_dumpall-u Postgres-P 5432 | Psql-u Postgres-P 6543
If you want to migrate multiple databases, you need to enter the password multiple times, which is annoying.
You can edit pgpass. conf and add S and its password to it. You do not need to manually enter the password multiple times.
The PostgreSQL help documentation provides more detailed backup, recovery, upgrade, and other information.