Revision: 46743
Initial Code
Initial URL
Initial Description
Initial Title
Initial Tags
Initial Language
at May 24, 2011 14:14 by arunpjohny
Initial Code
1. Create a file to store the connection password (Find the attached sample pgpass.conf)
Refer: http://www.postgresql.org/docs/9.0/static/libpq-pgpass.html
2. Create a bat file with the following contents
@echo off
SET PGPASSFILE=D:\PgBackup\pgpass.conf
for /f "tokens=1-4 delims=/ " %%i in ("%date%") do (
set dow=%%i
set month=%%j
set day=%%k
set year=%%l
)
set datestr=%month%_%day%_%year%
set BACKUP_FILE=%datestr%.backup
"D:\Program Files\PostgreSQL\9.0\bin\pg_dumpall.exe" --host=localhost --username=postgres --no-password --database=postgres --oids --file=D:\PgBackup\%BACKUP_FILE%
Make necessary changes in the parameters and paths
Refer: http://wiki.postgresql.org/wiki/Automated_Backup_on_Windows#Using_.pgpass_and_pgdumpall.2C_same_file
3. Schedule the bat file to execute at required time using windows task scheduler
Refer: http://windows.microsoft.com/en-US/windows7/schedule-a-task
Initial URL
http://www.postgresql.org/docs/9.0/static/libpq-pgpass.html
Initial Description
Initial Title
Scheduling automatic backup of postgres database in windows
Initial Tags
Initial Language
DOS Batch