Dump commands

Recommended: Dump database

pg_dump

pg_dump -h [IP] -U [User] -d [Database name] -option

what i use

pg_dump -h [IP] -U [User] -d [db-name] \
 -Fc -v \
 --include-extension \
 -f name_$(date +%Y%m%d).dump

in some case about postGis

pg_dump -h [IP] -U [User] -d [db-name] \
 -Fc -v \
 --exclude-table=spatial_ref_sys \
 --exclude-table=geography_columns \
 --exclude-table=geometry_columns \
 -f name_$(date +%Y%m%d).dump

Change here

Flag Objective
-Fc Custom format (compression)
-f Result file name
-v Verbose (show log)
--schema-only Dump only the schema, no data
--data-only Dump only the data, no schema
--exclude-table=[name] Skip table
--no-privileges Do not dump privileges (GRANT/REVOKE)
--no-owner Do not dump object ownership

.mymoonnote