@echo off
set pgsql_path=d:\"Program Files"\PostgreSQL\9.3\bin\   //安装目录
set database=postgres  //数据库名
set server=localhost  //服务器地址
set post=5432  //端口号
set username=postgres  //用户名
set date_string=%date:~0,4%_%date:~5,2%_%date:~8,2%   //日期
set time_string=%time:~0,2%_%time:~3,2%_%time:~6,2%  //时间
set back_path=d:\pgsqldatabackup   //备份文件存放路径
if not exist %back_path% md %back_path%
set file_string=%back_path%\data_%date_string%_%time_string%
set file=%file_string%.sql  //文件名
%pgsql_path%pg_dump.exe -h%server% -p%post% -U%username% %database%>%file%  //备份(注:pg_dump.exe 后面可追加很多参数,如果要用到可在dos命令中输入 pg_dump --help 查找,前提是配置好postgresql的环境变量)
pause

 

(注:如果要定时,压缩和上传ftp,可参照我前面写的oracle数据库的备份)

相关文章:

  • 2022-02-20
  • 2022-12-23
  • 2021-08-08
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-11-30
  • 2021-10-15
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2021-10-12
  • 2021-07-20
  • 2022-12-23
  • 2021-11-30
相关资源
相似解决方案