Postgresql Backup
How to backup and restore Postgresql databases using pg_dumpall and pg_dump.

- hpyYh
- 1 min read

all-dump
export PGPASSWORD='password'
pg_dumpall -h [host] -p [port] -U [id] > full_backup.sql --clean
psql -h [IP] -U [사용자] -f full_backup.sql postgres
each-dump
export PGPASSWORD='password'
pg_dump -h [host] -p [port] -U [id] -Fc [target_db_name] > [output_file].dump
pg_restore -h [host] -p [port] -U [id] -d [new_db_name] [output_file].dump
- tags :
- Postgresql