PDA

View Full Version : Can I use a backup software to backup PostgreSQL?



agc1976
09-13-2008, 11:44 PM
So, I'm setting up my "Disaster Recovery Plan" on my computer. I want to automate the backup of my PGSQL database. Can I just set up my backup software to backup the PGSQL folder? If I ever need to restore, re-install PGSQL and copy the files over? Or am I looking at a much more complicated task?

fabio
09-14-2008, 07:36 AM
Backup:


get to the command prompt and go to the c:\program files\postgresql\8.x\bin folder and run pg_dumpall -U postgres > c:\dbbackup.sql

This may take a while but the end result will be that your entire postgres database will be backed up to a file. If you want it saved to a different folder just change that c:\dbbackup.sql to something more fitting.

Restore:


on the new postgres folder get to the same folder in cmd and type

psql -U postgres -f c:\dbbackup.sql postgres (or change the filename to whatever makes sense)