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.

No comments:
Post a Comment
Leave your thoughts ...
---
If you are having trouble with copy/pasting in comments, you need to sign in or click 'Preview'.
For more information about this Firefox bug, see here.