How to install pgAgent service on windows
Asked Answered
H

3

10

I am new in postgreSQL database , I recently found that postgreSQL support SQL Job by pgAgent. I am using windows XP operating system.

I searched lots about pgAgent on Google and trying to configure pgAgent on machine.

Download pgAgent package in which I found pgagent.sql file after executing this file JOB(0) icon is appear on my pgAdmin III object panel. like following image.

enter image description here

But I am facing problem to register pgAgent service. As per postgres sql documentation following is next steps to register services but I am fail to do this. or don't know how to configure pgAgent service.

Following step from postgre sql documentaion :

The service may be quite simply installed from the command line as follows:
"C:\Program Files\pgAdmin III\pgAgent" INSTALL pgAgent -u postgres -p secret hostaddr=127.0.0.1 dbname=pgadmin user=postgres

but I tried lot to do this, please help in how to register pgAgent service with Windows XP.

reference link of postgre sql : http://www.pgadmin.org/docs/1.6/pgagent-install.html

Please help in this , Thanks in Advance !

Hypopituitarism answered 10/7, 2013 at 9:33 Comment(3)
You tried a lot to do this and ... what happened? Exact error messages? What precisely didn't work when you tried? Also: PostgreSQL version?Theodosia
Thanks, Craig for comment, I am using postgre sql 9.2. I am getting error that install command is not recognize with windows command prompt. I also try with postgre sql command prompt. please help in this.... thanks.Hypopituitarism
Well, it's a Windows command prompt command, entering it in psql will do you no good. Edit your question and add the exact error you get. Add a screenshot showing it if that's easier. Then comment here so notifications are sent.Theodosia
C
32

PgAgent is probably not installed

The pgAgent download page says:

pgAgent is a job scheduler for PostgreSQL which may be managed using pgAdmin. Prior to pgAdmin v1.9, pgAgent shipped as part of pgAdmin. From pgAdmin v1.9 onwards, pgAgent is shipped as a separate application.

And then it provides a download link to http://www.postgresql.org/ftp/pgadmin3/release/pgagent/
But the problem is there's only source code there. There are also SQL files in the tarball but they're useless without pgagent.exe.

How to install it

Apparently the correct way to install a pre-compiled pgAgent is with the Stack Builder installer that also happens to be the primary installation method on Windows for the PostgreSQL server itself. That's what is suggested on the official download page: http://www.postgresql.org/download/windows/

If you have already installed PostgreSQL for Windows with this method, the installer is available under the name Application Stack Builder in the PostgreSQL 9.2 folder in Windows Start Menu.

StackBuilder will normally recognize your installed PostgreSQL version(s), and suggest to install among various programs pgAgent in the Add-ons, tools and utilities category. Once you check pgAgent and continue with the installation, it will download it and launch its setup. The setup phase includes runnning the necessary SQL statements and installing the PostgreSQL scheduling Agent - pgAgent windows service. If this step is successful, there is nothing else to do, the functionality will be available in pgAdmin for creating jobs.

What's misleading in the docs

The latest pgAdmin docs at http://www.pgadmin.org/docs/1.16/pgagent-install.html has a Service installation on Windows chapter that says:

The service may be quite simply installed from the command line as follows (adjusting the path as required):

"C:\Program Files\pgAdmin III\pgAgent" INSTALL pgAgent -u postgres -p secret hostaddr=127.0.0.1 dbname=postgres user=postgres

However in the majority of cases this is not going to be of help because either:

  • pgAgent install is done by pgAgent setup as launched by StackBuilder and this step is not necessary.
  • or you have got pgAdmin alone and pgagent.exe will not be installed so this step is not possible.
Contumelious answered 24/8, 2013 at 19:19 Comment(9)
verite i had done all the way u suggested and even got a service in my service.msc.. but it is not started , it is being in starting state only ..even its unable to stop and restart..i tried the INSTALL pgAgent -u postgres -p secret hostaddr=127.0.0.1 dbname=postgres user=postgres but yet still its showing the same old error .. INSTALL is not an external or internal commandFaggot
This is the path where i had installed my pgAgent..[IMG]i44.tinypic.com/sgl2tz.png[/IMG]Faggot
i got it worked .. i had changed the path and tried the same as before it worked..Faggot
thanks for the support..and can u provide a sample job schedule backup.. if u had any.. to test and proceed further in dept..Faggot
when i tried to create a new job ,it raised an exception..how to solve it. s10.postimg.org/ns6z5e1x5/capture.png .guide me if im wrong in creating the way i doFaggot
if at all i'm giving the name to the scheduler and hitting ok then it is working..s7.postimg.org/umhyzsxor/image.png but i did not make any custom changes to it..and then if i try to create a step then its is not working s10.postimg.org/4oipm5veh/capture_2.pngFaggot
@user2561626: I suggest you open a new question for that, it doesn't look to be related to this one.Boatload
When try to install the pgAgent ask me for login and password but say doesnt are the correct one, I try to create a new connection with those credentials and work ok. So why doesnt recognize my "postgres" user password ?Susannsusanna
nevermind, looks like I have to type the password, doesnt like when I copy/paste it.Susannsusanna
O
2

pgAdmin will be successfully installed after downloading the compressed file from

https://www.pgadmin.org/download/pgagent-source-code/

there inside, you will find the file "sql\pgagent.sql"

Toss the content of this file into the Query Tool and run it. That will install pgAgent. Refresh your database connection to see the result. The tab pgAgent Jobs should have been created at the root level for your connection.

There is no need of using the INSTALL command from your command line.

Orthogenesis answered 27/3, 2018 at 13:9 Comment(1)
With your solution provided you only integrate pg_agent in your database, I think thats not enough. You need to run a windows service as well, to get jobs scheduled by pg_agentTheodolite
Z
0

I faced the same problem. I was able to get pgagent working by downloading and executing the stand-alone installation file pgagent-3.4.0-4-windows.exe from here: http://sbp.enterprisedb.com/getfile.jsp?fileid=11842

Zippel answered 18/2, 2022 at 1:58 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.