In the console, type
pg_dump -h db.domain.com -U username database_name -a -i -f output_filename.txt -t table_name_1 -t table_name_2 -t table_name_3
The switches used are:
Switch | Description |
---|---|
-h | Hostname of database. |
-U | Username. |
-a | Data only. |
-i | Ignore version difference between pg_dump and running database server. |
-d | Use INSERT instead of COPY. |
-f | Output filename. |
-t | Table name (can use more than once). |
To restore the data back into the database, connect to it and then type:
\i output_filename.txt
This will execute the commands in the output file, inserting all the data into the database you're connected to.