PostgreSQL Logical Backup & Restore
2.Logical Backup
- dump backup
- dumpall backup //full backup
1.Dump Backup use pg_dump Utility:
su - postgrescd /usr/pgsql-11/bin
pg_dump Options:
-h hostname
-p port number
-d database name
-t table name
-F format
p plain format (filename=filename.sql)
c custom format (filename=filename.dump or filename.dmp)
t tar format (filename=filename.tar)
d directory format (filename=filename)
./pg_dump -h localhost -p 5432 -d postgres -t emp -Fp -f /backup/emp.sql
Dump Restore:
Plain format Restore:
./psql -h localhost -p 5432 -d db2 -f /backup/emp.sql //plainCustom, tar, directory format Restore:
./pg_restore -h localhost -p 5432 -d db2 -f /backup/emp.dump //c,t,d2.Dump All Backup use pg_dumpall Utility:
su - postgrescd /usr/pgsql-11/bin
Comments
Post a Comment