How to install pgAgent on windows (PostgreSQL Job Scheduler)
This is a surprise for me that PostgreSQL do not have any build-in job scheduler. However It did pack into pgAdmin source but i wonder why it didnt intsall it by default? Here i provide some steps to show how to install pgAgent(Job Scheduler) on windows as services
1) Go to your PgAdim file path like below, please change to your own pgAdmin file path like “C:\Program Files\PostgreSQL\8.2\pgAdmin III”
2) Get pgAgent.sql and execute the script, it will create all pgAgent core tables
3) After executed pgAgent script, user will notice one job icon appear at pgAdmin.
4) Job scheduler is still not working yet, you have to register it as services in windows. Please issue following command on command prompt
C:\Program Files\PostgreSQL\8.2\bin\pgAgent INSTALL pgAgent -u postgres -p secret hostaddr=127.0.0.1 dbname=newdb user=postgres password=secret
please issue C:\Program Files\PostgreSQL\8.2\bin\pgAgent to show usage of pgAgent, where
-u = username
-p = password
“hostaddr=127.0.0.1 dbname=newdb user=postgres password=secret” = connect string
P.S please notice INSTALL is all uppercase, do not type lowercase , it will not work.
5) After registered service on windows, just go windows service to start it or use net start command.
6) Done, we can start to schedule our job now.