To back up the database:
pg_dump-h localhost-u root demo02 >/home/arno/dumps/demo02.bak
To recover a database:
psql-h localhost-u root-d Demo < Demo.bak
Backup table:
pg_dump-h localhost-u root demo02-t books >/home/arno/dumps/books.bak
Recovery table:
psql-h localhost-u root-d demo-t Books
Psql Copy to/from usage:
1. Need to log in to the database using Postgres Super User
psql-u postgres-d demo02
2. Saved/Read folders need to give Postgres user permission to read and write
3. Exporting data to a file in a table
copy books to '/opt/postgresql/9.5/data/xxx.csv ' with CSV;
4. Import the file contents to the database (increase not overwrite, data retention in the previous table)
Copy Books (id,title) from '/opt/postgresql/9.5/data/xxx.csv ' delimiter as ', ' csv quote as ' ";
PostgreSQL Backup Recovery database and bulk Import Export data to file method