Last active
November 18, 2019 11:27
-
-
Save avkosme/36e5d7ce197f0d100b47b9aae2158f31 to your computer and use it in GitHub Desktop.
Postgres backup-restore
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| pg_dump -U postgres -O -Fc dbname > dumpfile | |
| Here we used the following options: | |
| -U to specify which user will connect to the PostgreSQL database server. | |
| -W or --password will force pg_dump to prompt for a password before connecting to the server. | |
| -F is used to specify the format of the output file, which can be one of the following: | |
| p – plain-text SQL script | |
| c – custom-format archive | |
| d – directory-format archive | |
| t – tar-format archive | |
| pg_restore -U postgres -h localhost -d dbname dumpfile |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment