Search Postgresql Archives

Re: pgAgent

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxx> 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..?


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux