automatic backup postgresql

untuk membuat automatic backup database posgresql pada linux berikut ini caranya

  1. saya memakai linux ubuntu
  2. saya memakai cron sebagai aplikasi penjadwalan pada linux

buat folder

mkdir /home/backup

rubah hak akses agar user postgres bisa membuat file

chown postgres /home/backup

buat penjadwalannya dengan cron

sudo crontab -e

buat backupnya dengan pgdump

* * * * * sudo su postgres -c 'pg_dump -Fc -f /home/backup/coba`date +"\%Y-\%m-\%d"`.sql namadatabase'

  • file saya simpan disini dan akan membuat file baru sesuai dengan nama file coba tahun bulan tanggal.sql  home/backup/coba`date +”\%Y-\%m-\%d”`.sql
  •  namadatabase adalah database postgresql yang mau di backup
  • ***** menandakan jadwal saya buat permenit (bisa anda rubah sendiri ,cari tutorial cron)

referensi :

  1. http://ithelpblog.com/os/linux/debian/best-way-to-backup-postgresql-database/
  2. http://wiki.postgresql.org/wiki/Automated_Backup_on_Linux
  3. https://www.digitalocean.com/community/articles/how-to-backup-postgresql-databases-on-an-ubuntu-vps
  4. http://www.cyberciti.biz/tips/howto-backup-postgresql-databases.html
  5. http://stackoverflow.com/questions/1221282/does-anyone-know-of-a-good-way-to-back-up-postgres-databases
  6. http://technobytz.com/automatic-sql-database-backup-postgres.html
  7. http://www.hbirddesigns.com/~launch/developer-tools/how-to-automate-postgresql-database-backups-from-linux-shell/
  8. http://www.hbirddesigns.com/~launch/developer-tools/how-to-automate-postgresql-database-backups-from-linux-shell/
  9. http://www.mkyong.com/database/backup-restore-database-in-postgresql-pg_dumppg_restore/
  10. http://wisha.wordpress.com/category/coding-holic/database/
  11. http://stackoverflow.com/questions/6341321/how-to-check-if-postgresql-backup-was-succesful
  12. http://openerp.co.id/forum/viewtopic.php?f=2&t=30
  13. http://www.docstoc.com/docs/123400096/cara-mudah-backup-postgresql
  14. http://linux3.arinet.org/index.php/linux-admin/124-script-utk-backup-otomatis-database-postgresql
  15. http://akangirul.wordpress.com/2012/04/16/backup-otomatis-scheduler-postgres-dengan-crontab/
  16. http://dodo.web.id/2011/05/backup-database-postgresql-secara-terjadwal-menggunakan-cron/
  17. http://dodo.web.id/2011/05/backup-dan-restore-database-postgresql/
  18. http://www.hbirddesigns.com/~launch/developer-tools/how-to-automate-postgresql-database-backups-from-linux-shell/
  19. http://catatan-ts.blogspot.com/2011/06/backup-dan-restore-database-postgresql.html
  20. http://dev.xbata.com/database/backup-dan-restore-database-postgresql-dengan-pg_dump-dan-pg_restore
  21. http://dodo.web.id/2012/12/menambahkan-hardisk-baru-untuk-data-direktory-postgresql-di-debian/
  22. http://ubuntuforums.org/showthread.php?t=1975093
  23. buku panduan backup admin ppe lpse
  24. http://unix.stackexchange.com/questions/8584/using-the-system-date-time-in-a-cron-script

semoga berguna 🙂