Pg dump
Jump to navigation
Jump to search
pg_dump -h localhost -p 5432 -U
Script wrapper example
#!/bin/bash set -eu current_time=$(date "+%Y.%m.%d-%H.%M.%S") excludeTables(){ file=${current_time}.${PGHOST}.${PGDATABASE}.dump.excludetables.sql.gz echo $file pg_dump \ -d ${PGDATABASE} \ --file=${file} \ --compress=6 \ --verbose \ --exclude-table-data '*.trends*' \ --exclude-table-data '*.history*' } # Other options # --exclude-table-data '*.auditlog*' \ # --exclude-table-data '*.trends*' \ # --format=custom \ # --blobs \ # --compress=6 \ allTables(){ file=${current_time}.${PGHOST}.${PGDATABASE}.dump.alltables.sql.c6.gz pg_dump \ -d ${PGDATABASE} \ --file=$file \ --format=custom \ --blobs \ --verbose \ --compress=6 } excludeTables # allTables