mirror of https://github.com/CrimsonTome/tldr.git
Merge pull request #630 from mz026/add-pg_restore-page
pg_restore/pg_dump: add pagewaldyrious/alt-syntax
commit
efbceaf80c
|
@ -0,0 +1,19 @@
|
|||
# pg_dump
|
||||
|
||||
> Extract a PostgreSQL database into a script file or other archive file
|
||||
|
||||
- Dump database into a SQL-script file:
|
||||
|
||||
`pg_dump {{db_name}} > {{output_file.sql}}`
|
||||
|
||||
- Same as above, customize username:
|
||||
|
||||
`pg_dump -U {{username}} {{db_name}} > {{output_file.sql}}`
|
||||
|
||||
- Same as above, customize host and port:
|
||||
|
||||
`pg_dump -h {{host}} -p {{port}} {{db_name}} > {{output_file.sql}}`
|
||||
|
||||
- Dump a database into a custom-format archive file:
|
||||
|
||||
`pg_dump -Fc {{db_name}} > {{output_file.dump}}`
|
|
@ -0,0 +1,23 @@
|
|||
# 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}}`
|
Loading…
Reference in New Issue