Re: pgAgent

Поиск
Список
Период
Сортировка
От Adam Brusselback
Тема Re: pgAgent
Дата
Msg-id CAMjNa7fN7PvoJ8=jUhze1AF4dbQ5nyanf=dxscr6Fa4R0eXZNQ@mail.gmail.com
обсуждение исходный текст
Ответ на pgAgent  (Champion Always <c2627914@gmail.com>)
Список 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@gmail.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..?

В списке pgsql-general по дате отправления:

Предыдущее
От: Alvaro Herrera
Дата:
Сообщение: Re: ERROR: could not access status of transaction 283479860
Следующее
От: "Pweaver (Paul Weaver)"
Дата:
Сообщение: Re: ERROR: could not access status of transaction 283479860