Re: pgAgent

From: Adam Brusselback <adambrusselback(at)gmail(dot)com>
To: Champion Always <c2627914(at)gmail(dot)com>
Cc: "pgsql-general(at)postgresql(dot)org" <pgsql-general(at)postgresql(dot)org>
Subject: Re: pgAgent
Date: 2015-04-06 19:29:07
Message-ID: CAMjNa7fN7PvoJ8=jUhze1AF4dbQ5nyanf=dxscr6Fa4R0eXZNQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Here you are:

do $$
declare
job_id int;
begin

/* add a job and get its id: */
insert into
pgagent.pga_job (
jobjclid
, jobname
)
values
(
1 /*1=Routine Maintenance*/
, 'DELETE_NAMES' /* job name */
)
returning
jobid
into
job_id;

/* add a step to the job: */
insert into
pgagent.pga_jobstep (jstjobid, jstname, jstkind, jstcode,
jstdbname)
values
(
job_id
, 'DELETE_NAMES' /* step name */
, 's' /* sql step */
, 'BEGIN DELETE_NAMES; END;' /* the sql to run */
, 'somedatabase' /* the name of the database
to run the step against */
);

/* add a schedule to the job. This one runs every day at midnight: */
insert into pgagent.pga_schedule (
jscjobid
, jscname
, jscdesc
, jscminutes
, jschours
, jscweekdays
, jscmonthdays
, jscmonths
, jscenabled
, jscstart
, jscend)
values(
job_id
, 'schedule name'
, ''
,
'{t,f,f,f,f,f,f,f,f,f,f,f,f,f,f,f,f,f,f,f,f,f,f,f,f,f,f,f,f,f,f,f,f,f,f,f,f,f,f,f,f,f,f,f,f,f,f,f,f,f,f,f,f,f,f,f,f,f,f,f}'
, '{t,f,f,f,f,f,f,f,f,f,f,f,f,f,f,f,f,f,f,f,f,f,f,f}'
, '{f,f,f,f,f,f,f}'
, '{f,f,f,f,f,f,f,f,f,f,f,f,f,f,f,f,f,f,f,f,f,f,f,f,f,f,f,f,f,f,f,f}'
, '{f,f,f,f,f,f,f,f,f,f,f,f}'
, true
, '2015-04-06 00:00:00'
, NULL
);

end $$;

On Thu, Apr 2, 2015 at 12:25 PM, Champion Always <c2627914(at)gmail(dot)com> wrote:

> Hi,
> job_name => 'DELETE_NAMES'
> ,job_type => 'PLSQL_BLOCK'
> ,job_action => 'BEGIN DELETE_NAMES; END;'
> ,start_date => sysdate
> ,repeat_interval => 'FREQ=DAILY'
> ,enabled => TRUE);
> it is oracle ..
>
> .And i installed pgAgent On postgres ..
> how above oracle code can convert to postgres and place it in pgagent for
> daily schedule....
> any help..?
>

In response to

  • pgAgent at 2015-04-02 16:25:05 from Champion Always

Browse pgsql-general by date

  From Date Subject
Next Message Pweaver (Paul Weaver) 2015-04-06 19:46:08 Re: ERROR: could not access status of transaction 283479860
Previous Message Alvaro Herrera 2015-04-06 18:17:35 Re: ERROR: could not access status of transaction 283479860