basirana
asked on
change time dbms_job
Hi friend
Below is the job script that is used to run a procedure at 10:01 AM daily. I want to change the time to 10:45AM Howcan I do that. what I have to use
DECLARE
X NUMBER;
BEGIN
SYS.DBMS_JOB.SUBMIT
( job => X
,what => 'procedure_name;'
,next_date => to_date('26/01/2007 10:01:05','dd/mm/yyyy hh24:mi:ss')
,interval => 'sysdate + 1'
,no_parse => TRUE
);
SYS.DBMS_OUTPUT.PUT_LINE(' Job Number is: ' || to_char(x));
END;
/
commit;
Below is the job script that is used to run a procedure at 10:01 AM daily. I want to change the time to 10:45AM Howcan I do that. what I have to use
DECLARE
X NUMBER;
BEGIN
SYS.DBMS_JOB.SUBMIT
( job => X
,what => 'procedure_name;'
,next_date => to_date('26/01/2007 10:01:05','dd/mm/yyyy hh24:mi:ss')
,interval => 'sysdate + 1'
,no_parse => TRUE
);
SYS.DBMS_OUTPUT.PUT_LINE('
END;
/
commit;
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
SQL> begin
2 dbms_job.change(673, next_date => to_date('26/01/2007 10:45:00','dd/mm/yyyy hh24:mi:ss'));
3 end;
4 /
dbms_job.change(673, next_date => to_date('26/01/2007 10:45:00','dd/mm/yyyy hh24:mi:ss'));
*
ERROR at line 2:
ORA-06550: line 2, column 1:
PLS-00306: wrong number or types of arguments in call to 'CHANGE'
ORA-06550: line 2, column 1:
PL/SQL: Statement ignored
2 dbms_job.change(673, next_date => to_date('26/01/2007 10:45:00','dd/mm/yyyy hh24:mi:ss'));
3 end;
4 /
dbms_job.change(673, next_date => to_date('26/01/2007 10:45:00','dd/mm/yyyy hh24:mi:ss'));
*
ERROR at line 2:
ORA-06550: line 2, column 1:
PLS-00306: wrong number or types of arguments in call to 'CHANGE'
ORA-06550: line 2, column 1:
PL/SQL: Statement ignored
Eliminate the TO_DATE part:
next_date => (TRUNC(SYSDATE) + 645/1440)
next_date => (TRUNC(SYSDATE) + 645/1440)
ASKER
Sorry friend but I want to schedule it at 10:45 not 645/1400 which will give hours
ASKER
How to remove existing job and create new job to run procedure but different time...
Can you help me with example
Can you help me with example
Sorry, I got confused and I'm still confused. Do you just want to change the next_date? If it's the case you can do this:
EXEC DBMS_JOB.NEXT_DATE(<job as integer>,to_date('26/01/20 07 10:45:00','dd/mm/yyyy hh24:mi:ss'));
EXEC DBMS_JOB.NEXT_DATE(<job as integer>,to_date('26/01/20
exec DBMS_JOB.CHANGE(<job number>,null,TRUNC(SYSDATE +10/24)+45 /1440,'TRU NC(SYSDATE +10/24)+45 /1440');
commit;
commit;
ASKER
how to create new job that will execute at 10:45 AM.. to execute a procedure
Do you want to run it today?
The one below will run tomorrow at 10:45 and every following day at 10:45 AM:
DECLARE
X NUMBER;
BEGIN
SYS.DBMS_JOB.SUBMIT
( job => X
,what => 'procedure_name;'
,next_date => trunc(sysdate + 1) + 645/1440
,interval => 'trunc(sysdate + 1) + 645/1440'
,no_parse => TRUE
);
SYS.DBMS_OUTPUT.PUT_LINE(' Job Number is: ' || to_char(x));
END;
/
The one below will run tomorrow at 10:45 and every following day at 10:45 AM:
DECLARE
X NUMBER;
BEGIN
SYS.DBMS_JOB.SUBMIT
( job => X
,what => 'procedure_name;'
,next_date => trunc(sysdate + 1) + 645/1440
,interval => 'trunc(sysdate + 1) + 645/1440'
,no_parse => TRUE
);
SYS.DBMS_OUTPUT.PUT_LINE('
END;
/
exec DBMS_JOB.ISUBMIT(12, 'begin smd.smd_update(trunc(sysda te-1));end ;',TRUNC(S YSDATE+10/ 24)+45/144 0,'TRUNC(S YSDATE+10/ 24)+45/144 0');
commit;
With isubmit you provide the joib number, here in the example I used a 12.
From the begin until the the end is my proc, please, copy/paste your proc.
commit;
With isubmit you provide the joib number, here in the example I used a 12.
From the begin until the the end is my proc, please, copy/paste your proc.
ASKER
friend I tried to execute but the time is not correct
exec DBMS_JOB.CHANGE(<job number>,null,TRUNC(SYSDATE +10/24)+45 /1440,'TRU NC(SYSDATE +10/24)+45 /1440');
OUTPUT
DECLARE
X NUMBER;
BEGIN
SYS.DBMS_JOB.SUBMIT
( job => X
,what => 'dbms_refresh.refresh("... .");'
,next_date => to_date('26/01/2007 00:45:00','dd/mm/yyyy hh24:mi:ss')
,interval => 'TRUNC((SYSDATE+1)+10/24)+ 45/1440'
,no_parse => TRUE
);
SYS.DBMS_OUTPUT.PUT_LINE(' Job Number is: ' || to_char(x));
END;
/
exec DBMS_JOB.CHANGE(<job number>,null,TRUNC(SYSDATE
OUTPUT
DECLARE
X NUMBER;
BEGIN
SYS.DBMS_JOB.SUBMIT
( job => X
,what => 'dbms_refresh.refresh("...
,next_date => to_date('26/01/2007 00:45:00','dd/mm/yyyy hh24:mi:ss')
,interval => 'TRUNC((SYSDATE+1)+10/24)+
,no_parse => TRUE
);
SYS.DBMS_OUTPUT.PUT_LINE('
END;
/
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Hi.
I think it is about time you distribute the points as we have separated precious time of our own to help you.
Now it is time you help us giving the points we deserve.
I think it is about time you distribute the points as we have separated precious time of our own to help you.
Now it is time you help us giving the points we deserve.
Forced accept.
Computer101
EE Admin
Computer101
EE Admin
Just remove the current job and recreate it with the script you have (after changing the time).
dbms_job.remove(<job_numbe