Backup
Use pg_dumpall to backup all databases
$ pg\_dumpall -U postgres > all.sql
Use pg_dump to backup a database
$ pg\_dump -d mydb -f mydb\_backup.sql
- Â
-a Dump only the data, not the schema - Â
-s Dump only the schema, no data - Â
-c Drop database before recreating - Â
-CÂ Create database before restoring - Â
-t Dump the named table(s) only - Â
-FÂ Format (c: custom,d: directory,t: tar) Usepg_dump -?to get the full list of options
Comments





