File tree Expand file tree Collapse file tree 2 files changed +42
-0
lines changed Expand file tree Collapse file tree 2 files changed +42
-0
lines changed Original file line number Diff line number Diff line change 1+ # pg_dump
2+
3+ > Extract a PostgreSQL database into a script file or other archive file
4+
5+ - Dump database into a SQL-script file:
6+
7+ ` pg_dump {{db_name}} > {{output_file.sql}} `
8+
9+ - Same as above, customize username:
10+
11+ ` pg_dump -U {{username}} {{db_name}} > {{output_file.sql}} `
12+
13+ - Same as above, customize host and port:
14+
15+ ` pg_dump -h {{host}} -p {{port}} {{db_name}} > {{output_file.sql}} `
16+
17+ - Dump a database into a custom-format archive file:
18+
19+ ` pg_dump -Fc {{db_name}} > {{output_file.dump}} `
Original file line number Diff line number Diff line change 1+ # pg_restore
2+
3+ > Restore a PostgreSQL database from an archive file created by pg_dump.
4+
5+ - Restore an archive into an existing database:
6+
7+ ` pg_restore -d {{db_name}} {{archive_file.dump}} `
8+
9+ - Same as above, customize username:
10+
11+ ` pg_restore -U {{username}} -d {{db_name}} {{archive_file.dump}} `
12+
13+ - Same as above, customize host and port:
14+
15+ ` pg_restore -h {{host}} -p {{port}} -d {{db_name}} {{archive_file.dump}} `
16+
17+ - Clean database objects before creating them:
18+
19+ ` pg_restore --clean -d {{db_name}} {{archive_file.dump}} `
20+
21+ - Use multiple jobs to do the restoring:
22+
23+ ` pg_restore -j {{2}} -d {{db_name}} {{archive_file.dump}} `
You can’t perform that action at this time.
0 commit comments