Database Reference
In-Depth Information
APPENDIX B
PostgreSQL Packaged Command-Line Tools
This appendix summarizes indispensable command-line tools packaged with Post‐
greSQL server. We discussed them at length in the topic. Here we list their help messages.
We hope to save you a bit of time with their inclusion and perhaps make this topic a
not-so-strange bedfellow.
Database Backup Using pg_dump
Use pg_dump to back up all or part of a database. Backup file formats available are TAR,
compressed (PostgreSQL custom format), plain text, and plain-text SQL. Plain-text
backup can copy psql-specific commands; therefore, restore by running the file within
psql. Plain-text SQL backup is merely a file with standard SQL CREATE and INSERT
commands. To restore, you can run the file using psql or pgAdmin. Example B-1 shows
the pg_dump help output. For full covereage of pg_dump usage, see “Selective Backup
Using pg_dump” on page 38 .
Example B-1. pg_dump help
pg_dump --help
pg_dump dumps a database as a text file or to other formats.
Usage:
pg_dump [OPTION]... [DBNAME]
General options:
-f, --file=FILENAME output file or directory name
-F, --format=c|d|t|p output file format (custom, directory, tar, plain
text)
-j, --jobs=NUM use this many parallel jobs to dump
-v, --verbose verbose mode
-Z, --compress=0-9 compression level for compressed formats
--lock-wait-timeout=TIMEOUT fail after waiting TIMEOUT for a table lock
--help show this help, then exit
 
Search WWH ::




Custom Search