Migration and backup of PostgreSQL databases in Windows

Source: Internet
Author: User
Tags psql postgresql version

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.

 

 

 

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.