1
0
Fork 0
mirror of https://github.com/tldr-pages/tldr.git synced 2024-10-31 16:18:00 +01:00
tldr/pages/common/pg_restore.md

24 lines
619 B
Markdown
Raw Normal View History

2016-01-07 07:45:17 +01:00
# pg_restore
> Restore a PostgreSQL database from an archive file created by pg_dump.
- Restore an archive into an existing database:
`pg_restore -d {{db_name}} {{archive_file.dump}}`
- Same as above, customize username:
`pg_restore -U {{username}} -d {{db_name}} {{archive_file.dump}}`
- Same as above, customize host and port:
`pg_restore -h {{host}} -p {{port}} -d {{db_name}} {{archive_file.dump}}`
- Clean database objects before creating them:
`pg_restore --clean -d {{db_name}} {{archive_file.dump}}`
- Use multiple jobs to do the restoring:
`pg_restore -j {{2}} -d {{db_name}} {{archive_file.dump}}`