Backup methods of Postgresql

pg_dump — h 127.0.0.1 -p 5432 -U postgres -c -C — f dbname.sql dbnameUse the following command to back up all pg databases.pg_dumpall –h 127.0.0.1 –p 5432 -U postgres –c -C –f db_bak.sqlThe recovery method is simple. Just execute the restore command:psql –h 127.0.0.1 -p 5432 -U postgres –f db_bak.sql
wal_level =’replica’archive_mode =’on’archive_command =’copy /y “%p” “D:\\archive\\%f”’
Select pg_start_backup(‘backup_label’, false, false);
select * from pg_stop_backup(false);
(1) postmaster.pid; (required)(2) Files in pg_xlog; (required)(3) Temporary files at the beginning of pgsql_tmp; (optional)(4) postgresql.auto.conf.tmp; (optional)(5) Files in the pg_replslot directory; (optional)(6) Files in the pg_stat_tmp directory. (Optional)
restore_command =’copy /y D:\\archive \\%f\\%p’recovery_target_timeline =’latest’

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Pankaj kushwaha

Pankaj kushwaha

Database/System Administrator | DevOPS | Cloud Specialist | DevOPS