PostgreSQL database backup and recovery (scripting)

Source: Internet
Author: User

Database backup:

D:\Program files\postgresql\9.2\bin> pg_dump-h localhost-u postgres-c--column-inserts-f E:/dbname.sql dbname

Database recovery:

D:\Program files\postgresql\9.2\bin> psql-h localhost-u postgres-f e:/dbname.sql

Note:D:\Program files\postgresql\9.2\bin> is the installation path for Pg_dump.exe

Pg_dump: is a tool for backing up the PostgreSQL database.

- h:P ostgresql Server Host name

- u: Login user name for this operation

C: output the command to create the database before reconnecting to the newly created database.

--column-inserts : Export data with INSERT INTO table_name (columns_list) VALUES (values_list) command

- F: Specify File

PostgreSQL database backup and recovery (scripting)

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.