Dba_jobs
Hi All,
I wish to find out the execution time of a job in dba_jobs.
The TOTAL_TIME in dba_jobs is not useful to me as th column is for the total time taken for the jobs since the 1st time it's executed.
I only wish to find out how long it takes for the last run. Is it possible?
thanks
1* select distinct owner,job_name,run_duration from DBA_SCHEDULER_JOB_RUN_DETAILS
01:27:56 SQL> /
OWNER JOB_NAME RUN_DURATION
SYS AUTO_SPACE_ADVISOR_JOB +000 00:03:12
SYS AUTO_SPACE_ADVISOR_JOB +000 00:02:53
Similar Messages
-
Error while running job which is in DBA_JOBS
All,
My environment is Oracle - 10.2.0.4.0
Linux - 2.6
2 Node RAC environment
I have a job which is listed in DBA_JOBS. It is not auto executing. When I run manually, I am getting error.
Please see the error details below.
SQL> exec dbms_job.run(1);
BEGIN dbms_job.run(1); END;
ERROR at line 1:
ORA-12011: execution of 1 jobs failed
ORA-06512: at "SYS.DBMS_IJOB", line 413
ORA-06512: at "SYS.DBMS_JOB", line 275
ORA-06512: at line 1
When I check the alert log files, I am getting following message. Looks like some privilege issue. Can somebody help me. Job is owned by System and ran by System.
Mon Aug 10 11:09:27 2009
Errors in file ****************.trc:
ORA-12012: error on auto execute of job 1
ORA-01031: insufficient privileges
ORA-06512: at "SYS.DBMS_SNAPSHOT", line 2251
ORA-06512: at "SYS.DBMS_SNAPSHOT", line 2457
ORA-06512: at "SYS.DBMS_IREFRESH", line 685
ORA-06512: at "SYS.DBMS_REFRESH", line 195Lose the double quote and use 2 single quotes instead.
And bear in mind:
- next_date = DATE
- interval = VARCHAR2
PROCEDURE SUBMIT
Argumentnaam Type In/Out Standaard?
JOB BINARY_INTEGER OUT
WHAT VARCHAR2 IN
NEXT_DATE DATE IN DEFAULT
INTERVAL VARCHAR2 IN DEFAULT
NO_PARSE BOOLEAN IN DEFAULT
INSTANCE BINARY_INTEGER IN DEFAULT
FORCE BOOLEAN IN DEFAULT
So, try:
begin
dbms_job.submit( job => :jobno
, what => 'begin dbms_refresh.refresh(''ADDR''); end;'
, next_date => sysdate
, interval => 'sysdate + 1/1440'
commit;
end; -
Automatic scheduled jobs failed but nothing shown up in dba_jobs?
Hi All,
My db version is 10.2.0.4.0. In the alert log file , i could see the following messages:
Summary of Errors (grep ORA-)
ORA-12012: error on auto execute of job 3196
ORA-00942: table or view does not exist
ORA-06512: at "SYS.DBMS_SNAPSHOT", line 2251
ORA-06512: at "SYS.DBMS_SNAPSHOT", line 2457
ORA-06512: at "SYS.DBMS_IREFRESH", line 685
ORA-06512: at "SYS.DBMS_REFRESH", line 195
ORA-06512: at line 1
ORA-12012: error on auto execute of job 3197
ORA-00942: table or view does not exist
ORA-06512: at "SYS.DBMS_SNAPSHOT", line 2251
ORA-06512: at "SYS.DBMS_SNAPSHOT", line 2457
ORA-06512: at "SYS.DBMS_IREFRESH", line 685
ORA-06512: at "SYS.DBMS_REFRESH", line 195
ORA-06512: at line 1
ORA-02091: transaction rolled back
I am trying to see why those jobs 3196,3197 are failing by querying dba_jobs;
SQL> select * from dba_jobs where job=3196;
no rows selected
SQL> select * from dba_jobs where job=3197;
no rows selected
It should show regarding that jobs.right? Can anyone please tell me why its not showing any information about the jobs? If i am looking at the wrong place then please guide me right one.
Thanks In Advance.Thanks for your replies.
I could see the below jobs on dba_scheduler_jobs but no materialized views refresh jobs.
SQL> select state, job_name from dba_scheduler_jobs;
STATE JOB_NAME
SCHEDULED AUTO_SPACE_ADVISOR_JOB
SCHEDULED GATHER_STATS_JOB
DISABLED FGR$AUTOPURGE_JOB
SCHEDULED PURGE_LOG
SCHEDULED MGMT_STATS_CONFIG_JOB
SCHEDULED MGMT_CONFIG_JOB
SCHEDULED RLM$SCHDNEGACTION
SCHEDULED RLM$EVTCLEANUP -
Execution time of dba_jobs
How can I find the last execution time of the jobs in dba_jobs?
select TOTAL_TIME from dba_jobs where job=21;
TOTAL_TIME
157611This doesnt make sense, since it makes 2 days.create a table for logging the start and finish time, then add an insert into the table statement at the beginning and end of the job or the package/procedure it's calling that will log the sysdate to the table you created.
OR
create a new job that does the same thing but will only run once, i.e. no next_date
Edited by: TedA on Apr 29, 2010 7:58 PM -
Hi All,
What exactly does the total_time coloumn in dba_jobs specify ?
My requirement is to find out how long a job has taken to run.Currently the column value is 2077291 which I seriously doubt. Is this the sum of the time taken by the job ? If so how do I find the time for a particular instance ?The total_time column show the total time taken since the job creation and first run.
To have the last execution time, you need to keep an historic table.
Nicolas. -
How to add record to DBA_JOBS tables
Hi:
I would like to know how can I insert a new record to DBA_JOBS table ?
Thank you for your time!I want to assing following update statemtnet and schedule it.. Should I create a SP for this update (Ex: MY PROCEDURE), and then passs it to the dbms_job.submit ?
update rte_note set record_mode_code ='OFFICIAL'
where record_mode_code = 'WIP' and sys_create_time + 1 <=sysdate;
exec dbms_job.isubmit(784, 'MY PROCEDURE', SYSDATE); -
How to view/ammend jobs in DBA_JOBS using Enterprise Manager (Database Control)
Dear Gurus,
We are using Oracle 10gR2 on Widwos OS. We defined couple of jobs using DBMS_JOBS and i can see them using DBA_JOBS view, how can we view/amend these jobs in Enterprise Manager (Database Control)?
Regards,
RiazRiaz wrote:
Dear Gurus,
We are using Oracle 10gR2 on Widwos OS. We defined couple of jobs using DBMS_JOBS and i can see them using DBA_JOBS view, how can we view/amend these jobs in Enterprise Manager (Database Control)?
Regards,
Riaz
In V10 which is no longer under support DBA_JOBS was superceded by DBMS_SCHEDULER.
Why are you dependent upon EM to manage the DB? -
Dba_job that runs every saturday?
There is a bug in oracle 10.1.0.3 that causes issues when running the default analyzer with dbms_scheduler. Oracle records that I drop this and run it as a dba_job.
how do I scheduler it to run every saturday at 11 PM?
declare
vout integer;
begin
dbms_job.submit(job=>vout,
what=>'begin dbms_stats.gather_database_stats(cascade => TRUE,method_opt => ''FOR ALL COLUMNS SIZE AUTO'',
degree=>8 ); end;',next_date=>to_date('11072009 23:00','DDMMYYYY HH24:MI'),
interval=>next_day(trunc(sysdate),'SATURDAY')+0/24);
end;
2 3 4 5 6 7 8 9 declare
ERROR at line 1:
ORA-23319: parameter value "18-JUL-09" is not appropriate
ORA-06512: at "SYS.DBMS_JOB", line 57
ORA-06512: at "SYS.DBMS_JOB", line 134
ORA-06512: at line 4Can you use crontab command ?
I think this will help and with less headache.
In your case it would be
0 23 * * 6 script ,path
Check this for more info.
http://www.adminschoice.com/docs/crontab.htm
Cheers
Edited by: [email protected] on Jul 13, 2009 2:42 PM -
hi guys,
i have a dba job scheduled in oracle 9i database. when i query from dba_jobs, the interval is TRUNC(LAST_DAY(LAST_DAY(SYSDATE)+1))+2/24.
May i know how to interprete it?
anyway to check when the job is 1st scheduled?
thanksthanks for the advise.
the previous dba has scheduled a job with the above interval.. which means it will actually run every mth end at 2am... this morning, the job failed due to the package being invalid..
when i query the database (dba_jobs) at 9.30am, i got the following next_date as 31-JUL-08 10:30:18... this shouldn't be the case I believe, it shud actually shows the date as next mth end 2am instead.
any experts can kindly advise?
thanks -
Suspending jobs scheduled in dba_jobs
Oracle9i
Hi: I have a few jobs scheduled as shown in the dba_jobs. I want to suspend some of the jobs for 2 days. Is there a way to suspend these jobs?
select JOB,INTERVAL from dba_jobs;
JOB INTERVAL
121 trunc(sysdate+1/24, 'HH24')
104 trunc(sysdate+1/12, 'HH24')+1/96
107 trunc(sysdate+1/24, 'HH24')+3/96
81 sysdate+1/12
108 trunc(sysdate+1/24, 'HH24')+3/96
186 trunc(sysdate+1/24, 'HH24')
110 trunc(sysdate+1, 'HH24')
206 trunc(sysdate+1/12, 'HH24')+1/96
181 sysdate+1
182 sysdate+1
183 sysdate+1
185 trunc(sysdate+1/24, 'HH24')
201 trunc(sysdate+1/12, 'HH24')+1/96
202 trunc(sysdate+1/12, 'HH24')+1/96
203 trunc(sysdate+1/12, 'HH24')+1/96
204 trunc(sysdate+1/12, 'HH24')+1/96
205 TRUNC(SYSDATE+1/12, 'HH24')+1/96
207 trunc(sysdate+1/12, 'HH24')+1/96
208 trunc(sysdate+1/12, 'HH24')+1/96
209 trunc(sysdate+1/12, 'HH24')+1/96
210 trunc(sysdate+1/12, 'HH24')+1/96
211 trunc(sysdate+1/12, 'HH24')+1/96
212 trunc(sysdate+1/12, 'HH24')+1/96If you know when you want it to start again, use something like this
begin
sys.dbms_job.NEXT_DATE( job => 1234,
next_date => TO_DATE( '13 Aug 2010 17:15:00', 'DD Mon YYYY HH24:MI:SS' ) );
end;
COMMIT;If you want it to not run until you decide to manually intervene, use something like this
begin
dbms_job.broken(job => 66
,broken => TRUE);
end;
commit; -
Dba_jobs newbie question
Hi: our DBA left and I am troubleshooting a job that is failing. When I query the dba_jobs tables, I get the following job detail. How do I find out which PL/SQL code is this executing?
SQL> select WHAT from dba_jobs where broken='Y' or failures > 0;
WHAT
dbms_refresh.refresh('"DWH"."REM"');TIA
RaviHi,
You can use Describe command to obtain useful information.
Connected to Oracle Database 10g Enterprise Edition Release 10.2.0.1.0
Connected as hr
SQL> desc dba_jobs;
Name Type Nullable Default Comments
JOB NUMBER Identifier of job. Neither import/export nor repeated executions change it.
LOG_USER VARCHAR2(30) USER who was logged in when the job was submitted
PRIV_USER VARCHAR2(30) USER whose default privileges apply to this job
SCHEMA_USER VARCHAR2(30) select * from bar means select * from schema_user.bar
LAST_DATE DATE Y Date that this job last successfully executed
LAST_SEC VARCHAR2(8) Y Same as LAST_DATE. This is when the last successful execution started.
THIS_DATE DATE Y Date that this job started executing (usually null if not executing)
THIS_SEC VARCHAR2(8) Y Same as THIS_DATE. This is when the last successful execution started.
NEXT_DATE DATE Date that this job will next be executed
NEXT_SEC VARCHAR2(8) Y Same as NEXT_DATE. The job becomes due for execution at this time.
TOTAL_TIME NUMBER Y Total wallclock time spent by the system on this job, in seconds
BROKEN VARCHAR2(1) Y If Y, no attempt is being made to run this job. See dbms_jobq.broken(job).
INTERVAL VARCHAR2(200) A date function, evaluated at the start of execution, becomes next NEXT_DATE
FAILURES NUMBER Y How many times has this job started and failed since its last success?
WHAT VARCHAR2(4000) Y Body of the anonymous PL/SQL block that this job executes
NLS_ENV VARCHAR2(4000) Y alter session parameters describing the NLS environment of the job
MISC_ENV RAW(32) Y a versioned raw maintained by the kernel, for other session parameters
INSTANCE NUMBER Y Instance number restricted to run the job
SQL> Regards, -
Unit of total_time in dba_jobs view
Hi All,
I refresh the materialized view in database and select dba_jobs to view time it spent but the values in column Total_time in second(I guess) is over than really time it spent.Anyone know What is the unit of total_time column in dba_jobs view ?
Thanks All,
MckaTOTAL_TIME column in DBA_JOBS view shows "Total time spent by the system on that job , in seconds"
-
Hi there,
In our shop we have quite a few databases where control center service is installed.
Therefore if I execute the sql script $OWB_HOME/owb/rtp/sql/show_service.sql I will get "Available" in all of them.
Now, while logged on to the database, if I execute the following script
select what from dba_jobs where log_user = 'OWBRUN' then my result should be
what
wb_rti_service_job.check_service(1)
This happens in all of my databases where control center is installed (target databases) except one.
Everything works fine, packages are being deployed correctly, they are being executed correctly, statistics are being logged correctly in that one database.
Can someone tell me where that job is or what could cause such behaviour?
Our Oracle database version is 10.2.0.4, our OWB version is 10.2.0.1, our databases are installed onto Sun Solaris 10 server.
ThanksNo the control center was configured with owner = OWBRUN. I do that in all my databases that have a control center.
-
Job not running in DBA_Jobs
Hi,
We have a job set in dba_jobs.
Suddenly after 31st mar-2011 the job is not running
The job of 31st mar 2011 is still in active state and exists in the database
The details of the job are as follows:
SELECT r.sid, r.job, r.this_date, r.this_sec, SUBSTR(what,1,40) what
FROM dba_jobs_running r,dba_jobs j
WHERE r.job = j.job;
SID JOB THIS_DATE THIS_SEC
439 65709 31-MAR-11 06:31:54
A OS process also exists
oracle 11130 1 0 Mar 31 ? 1:51 ora_j000_GAT
SQL> select status, to_char(logon_time,'dd-mm-yyyy:hh24:mi:ss') from v$session where sid=439;
STATUS TO_CHAR(LOGON_TIME,
ACTIVE 31-03-2011:06:31:29
SQL> select THIS_DATE,NEXT_DATE from dba_jobs where job=65709;
THIS_DATE NEXT_DATE
31-MAR-11 31-MAR-11
In long running SQL
439 SELECT TO_CHAR(HPEOP_EIN) EMPLID, NVL(HP GAT_OWNER 31-03-11:06:31:29 ACTIVE
EOP_GRADE,' ') JOBCODE, NVL(HPEOP_PREFER
RED_PHONE,' ') BT_PREFERRED_COMMS, NVL(H
The jobs usually take 1-5 mins
Can you please advice what needs to be done
What could have happened.Can you kill the job from the OS?
Then stop the job from running : set it to broken
Find out why it doesn't stop this time: look in code and data.
If you are confident it will not happen again schedule the job again. -
Dba_jobs - any way to find out when a job was first submitted?
Hello Experts.
I am trying to find out when a couple of jobs I have found via dba_jobs were first submitted.
Is there a table / view to check for this?
10.2.0.5.0
Linux RHEL 6.869150 wrote:
Hello Experts.
I am trying to find out when a couple of jobs I have found via dba_jobs were first submitted.
It depends.
DBMS_LOGMNR could provides desired details.
Is there a table / view to check for this?NO.
>
10.2.0.5.0
Linux RHEL 6.
Maybe you are looking for
-
Quantity not updating in storage location
Dear one and all, For a Sales order and Delivery order , System has not reduced the entire qty from a storage location after making the invoice. System reduced only part qty. The balance qty is still remaining in the storage location. Plz guide wha
-
is there any tool for translating a jsp code to be a servlet ? I know that basically this is what happened but this is my problem we are making a product that can be implemented in many application servers our problem,somtime , is that the jsp code s
-
Dynamic tray selection - SAPScript
Hi, I need to dynamically select a tray to print a form using SAPScript, depending on some condition. Need to know how to do this? Thanks in advance! regards, Karen
-
Combining hor and vert spry menus
Hi, My client wants to have their horizontal nav menu display the drop down choices horizontally like the http://www.businessweek.com/ Can this be done with a spry menu widget? (shouldn't have to add this but...) If so, how? Thanks, J
-
USB Mic in Windows XP not recognised
I have a Plantronics Gamecom Pro 1 USB headset with mic that is supposed to work with both Windows XP and Mac OSX. It works on the OSX side of my Intel iMac but isn't recognised on the XP side (Bootcamp drivers all installed). I get sound to the earp