notes/pg_restore.md

12 lines
544 B
Markdown
Raw Permalink Normal View History

2022-04-20 23:57:19 -04:00
[postgresql.org](https://www.postgresql.org/docs/current/app-pgrestore.html)
pg_restore has 2 modes. if you just feed it a backup file it produces sql that you woudl have to pipe to psql or a file to run.
If you specify -d it will actually connect and execute the restore commands.
-C combined with -c will drop and create a new database to restore into
-O will not assign ownership to the original owner, but whoever is connecting instead
sample restore command:
`pg_restore -O -C -c -U ptrowbridge -p 5433 -d ubm -h localhost ubm.backup`