Skip to content

Instantly share code, notes, and snippets.

@gusdewa
Last active August 9, 2021 08:15
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gusdewa/42fc5932cc649a4f5d3b5a28e471bfd9 to your computer and use it in GitHub Desktop.
Save gusdewa/42fc5932cc649a4f5d3b5a28e471bfd9 to your computer and use it in GitHub Desktop.
pg_dump -h hostname -p 5432 -U username -Fc dbname > dbname_$(date +"%Y-%m-%d").dump
-- WITH CERT
pg_dump "port=<port> host=<host> user=<user> dbname=<db> sslcert=<cert> sslkey=<key> sslrootcert=<ca.crt> sslmode=verify-ca" -Fc > dbname_$(date +"%Y-%m-%d").dump
pg_restore -U username -d dbname_target -h hostname -p 5432 --disable-triggers filebackup.dump
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment