The extra work needed here is to back up to a file name that differs each day so that you can have a folder of back ups per day. It would be handy for pg_dump to generate a file name based on date but it doesn’t. So I created a batch file to do the job in one go including a file name based on the date.
@echo off set date=%date:/=_% set BACKUP_FILE=D:\PostgreSQL_Backups\DBName\DBName_%date%.backup pg_dump -h localhost -p 5432 -U postgres -F p -b -v -f %BACKUP_FILE% DBNameThen I created a Windows task scheduled to run daily which just runs the above batch file.
No comments:
Post a Comment