Postgres DBA · Lesson 10

Backup using pg_dump in Postgresql

To take the custom dump: Syntax: pgsql installation_directory type_of_dump database_name port location_of_file then use this cmd and then enter password for the user. cmd: /usr/local/pgsql/bin/pg_dump -Fc -d sandbox_db_nims -p 5435 > /DB/"DB backup"/sandbox_db_21_nov_17_custom To take the plain dump: cmd:/usr/local/pgsql/bin/pg_dump -d sandbox_db_nims_security_check -p…

connected · blinksql_demo

To take the custom dump:

Syntax: pgsql installation_directory type_of_dump database_name port location_of_file then use this cmd and then enter password for the user.
cmd:
/usr/local/pgsql/bin/pg_dump -Fc -d sandbox_db_nims -p 5435
> /DB/”DB backup”/sandbox_db_21_nov_17_custom

taking_dump_custom

To take the plain dump:

cmd:/usr/local/pgsql/bin/pg_dump -d sandbox_db_nims_security_check -p 5435 -f /DB/”DB backup”/sandbox_db_nims_security_check_21_nov_17_plain
or
cmd:/usr/local/pgsql/bin/pg_dump -d sandbox_db_nims_security_check -p 5435 > /DB/”DB backup”/sandbox_db_nims_security_check_21_nov_17_plain
taking_dump_plain

To take the backup of single table:

cmd:/usr/local/pgsql/bin/pg_dump -d sandbox_db_nims_security_check -t uixmldefinitions -p 5435 > /DB/”DB backup”/uixml_table_backup

-> By using the above cmd we can take a backup of single table.

Practice — AI-generated for this lesson

Write a query that shows each order status and how many orders have it — but only statuses with more than 1 order.