Export a remote database
1. Export the threshold table structure and data to the file Threshold.sql from the database monitor on the remote database IP:
Pg_dump-t threshold-h 135.32.94.142 monitor-u monitor-p 5432- F Threshold.sql
-t specifies the name of the table to export;
-h specifies the database address;
-u Specifies the database user;
-p Specifies the access port;
-f specifies export to file;
2. Export all table structures and data to file Monitor.sql from the database monitor on the remote database IP:
Pg_dump-h 135.32.94.142 monitor-u monitor-p 5432- F Monitor.sql
3. From the database monitor on the remote database IP, simply export all the table structures to the file Monitor.sql:
Pg_dump-s-H 135.32.94.142 monitor-u monitor-p 5432
-S export table structure only
Note: The general database data volume is large, if the remote export all the table structure and data will be very slow, all the only export table structure is a wise choice. You can then export the structure and data of a single important data table. Import Database 1. Import the table structure and data from the local file Threshold.sql to the database monitor on the remote IP:
Psql-h 135.32.9.99-d monitor-u monitor-f threshold.sql
-h specifies the database address;
-D Specify the database;
-U designated user;
-f Specifies the file to import (here is the file exported in step 1);
Note: The file here is the file exported from the remote database above.
2. Import to the local database:
Psql-h 0.0.0.0
-p Specifies the database service port, which varies according to the local condition and is 5432 port by default
PostgreSQL Database Import and Export