Tuesday, April 6, 2010

Postgres Database -- Enable Jobs

Steps to Enable Jobs in PostgresSQL 8.3 for Windows
Steps to Enable PGAgent and schedule jobs, which can used for for automating our various tasks :-

1. Open pgAdmin PostgresSQL tools.

2. Open PostgresSQL Query tool.

3. First we need to Create Language using command below. It might possible that you have already created Language, so just ignore the steps.

CREATE LANGUAGE plpgsql;

4. You can now run script C:\Program Files\PostgreSQL\8.2\pgAdmin III\pgAgent.sql.

5. Service to create and Remove for Windows is below

pgAgent is able to self-install itself as a service on Windows systems.


Usage: pgAgent REMOVE pgAgent INSTALL [options] options: -u -p -d -t -r =10, default 30)> -l 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=pgadmin user=postgres The service may then be started from the command line using net start pgAgent, or from the Services control panel applet. Any logging output or errors will be reported in the Application event log.

For Example :

"C:\Program Files\pgAdmin III\pgAgent"> INSTALL PGAGENTSERVICE -l 2 -u Domain\user -p Password hostaddr=127.0.0.1 dbname=postgres user=postgres password=postgres

This will create Service Name PGAGENTSERVICE under services. You start the services.

6. Open PGADMIN III, Under services you can see Jobs. Now you can create and schedule jobs.

7. In case of any Issue, you can check event viewer and you will get exact error message.

No comments: