我想通过pgAdmin在pgAgent的特定时间设置批处理文件路径的步骤。但是,当我运行它失败,在步骤统计我得到这个输出pgAgent计划作业在Windows上失败
C:\ Windows \ System32下> C:\ PostgreSQL的\ run.bat中 “psql的”不被识别为一个内部或外部命令, 可操作的程序或批处理文件。
详情:
Postgresql 9.3.5 on local system account (Current User)
pgAdmin 1.18.1
pgAgent via stack builder with Administrator account (Current User)
在的run.bat我只有两个声明
@echo off
psql -h localhost -p 5433 -U postgres -d test -a -f "test.sql"
我PSQL在系统路径变量,并能够访问它CMD。当我手动运行该bat文件时,它正在执行而不会失败。但是当我在pgAgent作业中给出批处理文件路径(C:\postgresql\run.bat)
时,它在统计中给出了这个错误。
我的配置有什么问题吗?为什么它总是那么C:\Windows\system32>
?
编辑:
我的run.bat文件
@ECHO OFF
SET LBSDatabaseName=Test
SET dbHost=localhost
SET dbPort=5434
SET dbUser=postgres
SET logFile=DbInstall.log
SET sqlFolder="D:\SOURCECODE\archivescripts"
"C:\Program Files (x86)\PostgreSQL\9.3\bin\psql.exe" -h "%dbHost%" -p "%dbPort%" -d "%LBSDatabaseName%" -U "%dbUser%" -L "%logFile%" -q -f "%sqlFolder%\Archive.sql"
我Archive.sql
update "Archive".emp set "FirstName"='Srikanth Dyapa';
你需要给其中'psql'位于你的'run.bat' – 2014-09-22 04:35:00
路径上的所有
hosts
告诉我的绝对路径的'psql'(在我的例子中是'C:\ Program Files \ PostgreSQL \ 9.3 \ bin \ psql.exe') – 2014-09-22 04:38:09@WingedPanther我试过你的建议,现在我看到它的状态为Running,它没有更新表记录,可能是什么问题呢? – 2014-09-22 05:36:11