Linux Postgres for export and import

Source: Internet
Author: User
Tags psql strong password

 Postgres can be used to export data from the Pg_dump database.   
[1] Export only the database structure of all objects
C:\>pg_dump-f dddddd.sql-i-c-e utf8-n public-s-u portal-h localhost-w Portal
-I is for a compatible database version
-C includes statements to create a database
-e Setting the encoding of the exported data
-N is the name of the scheme
-U is the user name
-H is the name of the database server
-W is a strong Password Validation

-s only exports the database structure

The last parameter, of course, is the database name

[2] Export database structure and data for all objects
C:\>pg_dump-f dddddd.sql-i- C-E utf8-n public-u portal-h localhost-w Portal
No-s parameter
[3] Exports only all table data
C:\>pg_dump-f dddddd.sql-i- A-c-E utf8-n public-u portal-h localhost-w Portal
-A export data only
data import
[1]c:\psql-f dddddd.sql-h 192.168.1.2 33-u myuser-w myportal
Execution can be implemented by importing.
If the database myportal does not exist, create a database
Createdb-u postgres-h 192.168.1.233 myportal
and then execute the above import statement.
[2]psql-hlocalhost-u myuser-d myportal < Dddddd.sql
Executes the statement to import the data.

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.