如何配置PostgreSQL 9.3自动备份

时间:2017-12-05 08:44:46

标签: database postgresql backup

我正在尝试使用Windows任务调度程序为PostgreSQL 9.3设置数据库自动备份,这里是批处理代码,但它没有带回任何东西,我缺少什么?

   @echo off
   for /f "tokens=1-4 delims=/ " %%i in ("%date%") do (
     set dow=%%i
     set month=%%j
     set day=%%k
     set year=%%l
   )
   SET PGPATH=C:\Program Files\PostgreSQL\9.3\bin\
   SET SVPATH=C:\Users\......\Documents\PostgresqlBack\backup\
   set datestr=%month%_%day%_%year%
   echo datestr is %datestr%

   set BACKUP_FILE=<NameOfTheFile>_%datestr%.backup
   echo backup file name is %BACKUP_FILE%
   SET PGPASSWORD=<test_user>
   echo on
  %PGPATH% -i -h <localhost> -p 5432 -U <test123> -F c -b -v -f    %SVPATH%%BACKUP_FILE% <test>

0 个答案:

没有答案