Backup and Restore Single Table in PostgreSQL

Backup and restore single table in PostgreSQL

Back up a single table from the specific database

pg_dump -d [sourcedatabase] -t [tablename]-f [dbtablebackup.sql]

Example:
pg_dump -U postgres -d testdb -t test -f C:\testwork\tablebackup.sql
Password:

Restore a single table in the database:

psql -d testdb -f C:\testwork\tablebackup.sql
Advertisement

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.