DBA_JOBS_RUNNING
What does the column JOB represent in DBA_JOBS_RUNNING view and is there reference table/view available where I can link JOB column to derive supplimentary information? This is about 9i.
Thanks,
R
SQL> desc dba_jobs_running
Name Null? Type
SID NUMBER
JOB NUMBER
FAILURES NUMBER
LAST_DATE DATE
LAST_SEC VARCHAR2(8)
THIS_DATE DATE
THIS_SEC VARCHAR2(8)
INSTANCE NUMBER
SQL> desc dba_jobs
Name Null? Type
JOB NOT NULL NUMBER
LOG_USER NOT NULL VARCHAR2(30)
PRIV_USER NOT NULL VARCHAR2(30)
SCHEMA_USER NOT NULL VARCHAR2(30)
LAST_DATE DATE
LAST_SEC VARCHAR2(8)
THIS_DATE DATE
THIS_SEC VARCHAR2(8)
NEXT_DATE NOT NULL DATE
NEXT_SEC VARCHAR2(8)
TOTAL_TIME NUMBER
BROKEN VARCHAR2(1)
INTERVAL NOT NULL VARCHAR2(200)
FAILURES NUMBER
WHAT VARCHAR2(4000)
NLS_ENV VARCHAR2(4000)
MISC_ENV RAW(32)
INSTANCE NUMBER
Similar Messages
-
"select count(*) from dba_jobs_running" takes 5 minutes to return
Hi,
I login as sys or system from sql*plus to run query "select count(*) from dba_jobs_running". This query takes about 5 minutes to run.
Querying other DBA_* views returns instantly, only this dba_jobs_running view is troubling.
I have 11 records in dba_jobs, and 18 records in v$lock as usual.
No error or warning in logfile, no trace file.
What's possibly wrong with the server?
Thanks,
HarryHi,
The following are the exact statements I used to create the trace file:
alter session set timed_statistics=true;
alter session set max_dump_file_size=unlimited;
alter session set events '10046 trace name context forever, level 12';
select count(*) from dba_jobs_running;
exit;
The content of the trace file is attached at the end.
If it is CPU bound, I have no activity on the db host. I am solely using it to analyze this problem.
load averages: 0.02, 0.02, 0.07 22:16:38
48 processes: 47 sleeping, 1 on cpu
CPU states: 98.4% idle, 1.6% user, 0.0% kernel, 0.0% iowait, 0.0% swap
Memory: 1792M real, 983M free, 517M swap in use, 2937M swap free
PID USERNAME THR PRI NICE SIZE RES STATE TIME CPU COMMAND
655 oracle 1 59 0 0K 0K sleep 1:14 0.32% oracle
865 oracle 1 59 0 2072K 1184K cpu 0:00 0.14% top
667 oracle 1 59 0 0K 0K sleep 0:13 0.08% oracle
663 oracle 1 59 0 0K 0K sleep 0:27 0.07% oracle
665 oracle 1 59 0 0K 0K sleep 0:15 0.02% oracle
671 oracle 1 59 0 0K 0K sleep 0:00 0.02% oracle
645 oracle 18 59 0 0K 0K sleep 0:23 0.01% oracle
657 oracle 1 59 0 0K 0K sleep 0:14 0.00% oracle
649 oracle 1 59 0 0K 0K sleep 0:02 0.00% oracle
659 oracle 1 59 0 0K 0K sleep 0:01 0.00% oracle
251 root 20 59 0 3256K 2512K sleep 0:00 0.00% nscd
70 root 5 59 0 2864K 2096K sleep 0:00 0.00% picld
224 root 3 59 0 3912K 2008K sleep 0:00 0.00% automountd
271 root 1 59 0 4408K 1896K sleep 0:00 0.00% sendmail
588 oracle 1 59 0 2600K 1864K sleep 0:00 0.00% bash
Any help is greatly appreciated.
<-- TRACE FILE CONTENT -->
*** 2006-11-21 21:34:54.413
*** SESSION ID:(21.832) 2006-11-21 21:34:54.412
APPNAME mod='[email protected] (TNS V1-V3)' mh=0 act='' ah=0
=====================
PARSING IN CURSOR #1 len=69 dep=0 uid=0 oct=42 lid=0 tim=107123626140 hv=2004533713 ad='97219d80'
alter session set events '10046 trace name context forever, level 12'
END OF STMT
EXEC #1:c=0,e=346,p=0,cr=0,cu=0,mis=1,r=0,dep=0,og=4,tim=107123625473
WAIT #1: nam='SQL*Net message to client' ela= 11 p1=1650815232 p2=1 p3=0
WAIT #1: nam='SQL*Net message from client' ela= 6476024 p1=1650815232 p2=1 p3=0
=====================
PARSING IN CURSOR #1 len=37 dep=0 uid=0 oct=3 lid=0 tim=107130104260 hv=2246554324 ad='97c21958'
select count(*) from dba_jobs_running
END OF STMT
PARSE #1:c=0,e=548,p=0,cr=0,cu=0,mis=0,r=0,dep=0,og=4,tim=107130104237
BINDS #1:
EXEC #1:c=0,e=1412,p=0,cr=0,cu=0,mis=0,r=0,dep=0,og=4,tim=107130106034
WAIT #1: nam='SQL*Net message to client' ela= 12 p1=1650815232 p2=1 p3=0
*** 2006-11-21 21:40:53.931
FETCH #1:c=350760000,e=344612113,p=0,cr=2,cu=16652,mis=0,r=1,dep=0,og=4,tim=107474718456
WAIT #1: nam='SQL*Net message from client' ela= 1936 p1=1650815232 p2=1 p3=0
FETCH #1:c=0,e=6,p=0,cr=0,cu=0,mis=0,r=0,dep=0,og=0,tim=107474721309
WAIT #1: nam='SQL*Net message to client' ela= 8 p1=1650815232 p2=1 p3=0
*** 2006-11-21 21:56:30.972
WAIT #1: nam='SQL*Net message from client' ela= 915075702 p1=1650815232 p2=1 p3=0
XCTEND rlbk=0, rd_only=1
STAT #1 id=1 cnt=1 pid=0 pos=1 obj=0 op='SORT AGGREGATE (cr=2 r=0 w=0 time=100535896 us)'
STAT #1 id=2 cnt=0 pid=1 pos=1 obj=0 op='NESTED LOOPS (cr=2 r=0 w=0 time=100535876 us)'
STAT #1 id=3 cnt=5550 pid=2 pos=1 obj=0 op='MERGE JOIN CARTESIAN (cr=2 r=0 w=0 time=128639 us)'
STAT #1 id=4 cnt=10 pid=3 pos=1 obj=0 op='NESTED LOOPS OUTER (cr=2 r=0 w=0 time=5839 us)'
STAT #1 id=5 cnt=10 pid=4 pos=1 obj=69 op='FIXED TABLE FULL X$KSQRS (cr=0 r=0 w=0 time=4790 us)'
STAT #1 id=6 cnt=10 pid=4 pos=2 obj=202 op='INDEX UNIQUE SCAN OBJ#(202) (cr=2 r=0 w=0 time=561 us)'
STAT #1 id=7 cnt=5550 pid=3 pos=2 obj=0 op='BUFFER SORT (cr=0 r=0 w=0 time=90039 us)'
STAT #1 id=8 cnt=555 pid=7 pos=1 obj=16 op='FIXED TABLE FULL X$KSUSE (cr=0 r=0 w=0 time=1277 us)'
STAT #1 id=9 cnt=0 pid=2 pos=2 obj=0 op='VIEW (cr=0 r=0 w=0 time=344148954 us)'
STAT #1 id=10 cnt=105477 pid=9 pos=1 obj=0 op='UNION-ALL (cr=0 r=0 w=0 time=343814331 us)'
STAT #1 id=11 cnt=105476 pid=10 pos=1 obj=0 op='VIEW (cr=0 r=0 w=0 time=203487737 us)'
STAT #1 id=12 cnt=105476 pid=11 pos=1 obj=0 op='UNION-ALL (cr=0 r=0 w=0 time=202961626 us)'
STAT #1 id=13 cnt=0 pid=12 pos=1 obj=272 op='FIXED TABLE FULL X$KDNSSF (cr=0 r=0 w=0 time=13633786 us)'
STAT #1 id=14 cnt=105476 pid=12 pos=2 obj=72 op='FIXED TABLE FULL X$KSQEQ (cr=0 r=0 w=0 time=188317145 us)'
STAT #1 id=15 cnt=0 pid=10 pos=2 obj=253 op='FIXED TABLE FULL X$KTADM (cr=0 r=0 w=0 time=76301426 us)'
STAT #1 id=16 cnt=1 pid=10 pos=3 obj=254 op='FIXED TABLE FULL X$KTCXB (cr=0 r=0 w=0 time=62693462 us)'
STAT #1 id=16 cnt=1 pid=10 pos=3 obj=254 op='FIXED TABLE FULL X$KTCXB (cr=0 r=0 w=0 time=62693462 us)'
<---- END of TRACE FILE --> -
Dba_jobs_running dictionary view
i'm trying to query the dba_jobs_running dictionary view from PL/SQL procedure and am getting
Table or view does not exists Error at compile Time.
I also tried the same using Execute Immediate and am getting the same error
Table or view does not exists Error at run Time.
Also when I query the same dba_jobs_running from SQL*Plus
i am getting the required output.
The Oracle Version i'm using is 9.2.0.1.0
I tried all the above steps in Oracle version 8.1.5.0.0
and am not getting the above errors
Table or view does not exists(inside PL/SQL Procedure)
Pls can any one help me on the same.Try SYS.dba_jobs, maybe there isn't a public synonym for that view.
-
Troubled to get scheduler job to run?
Hi all friends:
I'm having trouble getting any scheduler jobs (here, troubled job name is CUSTMASTER_CHANGES_01) to actually run.
when
sql>select job_name,state,enabled,retry_count,failure_count,run_count,restartable,start_date,repeat_interval,job_class
from all_scheduler_jobs;
JOB_NAME STATE ENABL RETRY_COUNT FAILURE_COUNT RUN_COUNT RESTA START_DATE REPEAT_INTERVAL JOB_CLASS
CUSTMASTER_CHANGES_01 SCHEDULED TRUE 0 0 0 FALSE 14-JAN-08 09.46.14.6 FREQ=SECONDLY;I SCANNER_JO
72965 AM AMERICA/NEW NTERVAL=5 B_CLASS
_YORK
for job 'CUSTMASTER_CHANGES_01'
we can see RUN_COUNT 0 and restartable false.
I upped slave processes to 5. dbms_scheduler.run_job('CUSTMASTER_CHANGES_01') works, but it's still not executing on the schedule
when run as sysdba
SQL> exec dbms_scheduler.run_job('CUSTMASTER_CHANGES_01');
ERROR at line 1:
ORA-27475: "SYS.CUSTMASTER_CHANGES_01" must be a job
ORA-06512: at "SYS.DBMS_ISCHED", line 150
ORA-06512: at "SYS.DBMS_SCHEDULER", line 441
ORA-06512: at line 1
to resolve that,
we found
When you create your job by using dbsm_scheduler, it has a parameter called ‘auto_drop’, is by default, =’true’, like, auto_drop => TRUE
see below;
dbms_scheduler.create_job(
job_name IN VARCHAR2,
job_type IN VARCHAR2,
job_action IN VARCHAR2,
number_of_arguments IN PLS_INTEGER DEFAULT 0,
start_date IN TIMESTAMP WITH TIME ZONE DEFAULT NULL,
repeat_interval IN VARCHAR2 DEFAULT NULL,
end_date IN TIMESTAMP WITH TIME ZONE DEFAULT NULL,
job_class IN VARCHAR2 DEFAULT 'DEFAULT_JOB_CLASS',
enabled IN BOOLEAN DEFAULT FALSE,
auto_drop IN BOOLEAN DEFAULT TRUE,
comments IN VARCHAR2 DEFAULT NULL);
The job you manually run once and then it drops itself when you test.
so I am specifiying auto_drop to be false, but it is showing it has true as the attribute.
DBMS_SCHEDULER.CREATE_JOB(
job_name => scanner.scanner_name,
job_type => 'PLSQL_BLOCK',
job_action => 'BEGIN IF EEG_SCAN.GET_RUNNING_JOBS_COUNT('
||''''||UPPER(scanner.scanner_name)||''''
||') < 2 THEN '||scanner.scanner_proc_name||'; END IF; END;',
repeat_interval => 'FREQ=SECONDLY;INTERVAL=5',
job_class => c_job_class_name,
auto_drop => FALSE,
enabled => true
scheduler job is still not working as expected.....?
Can you help me for this??
thanks a lot in advance.
Message was edited by:
jerrygreat
Message was edited by:
jerrygreatHi,
There are a few other limits you could check .
Make sure that you have not exceeded the maximum number of sessions or the maximum number of processes or the maximum number of scheduler jobs
select * from dba_scheduler_global_attribute;
and
select name,value from v$parameter where name like '%process%';
select name,value from v$parameter where name like '%session%';
Also check how many jobs are currently running
select count(*) from dba_scheduler_running_jobs;
select count(*) from dba_jobs_running ;
select count(*) from v$session ;
One of these limits may need to be increased.
The run_job succeeds because it runs in the current session by default, if you use use_current_session=>false, does it still work ?
Also auto_drop only drops the job when it has completed e.g. past its end_date or exceeded its max_runs.
Finally note that there is a dedicated forum for dbms_scheduler located here
Scheduler
Hope this helps,
Ravi. -
Having trouble getting a job to run using job scheduler
I am using Oracle 11g. I run a sql script that schedules a job:
exec sys.dbms_scheduler.create_job( job_name => '"SYSTEM"."UCR"', job_type => 'EXECUTABLE', job_action => 'D:\UserCountReport\bin\ucr.bat', repeat_interval => 'FREQ=HOURLY;BYHOUR=3;BYMINUTE=0;BYSECOND=0',start_date => to_timestamp_tz('2011-07-21 US/Eastern', 'YYYY-MM-DD TZR'), job_class => 'DEFAULT_JOB_CLASS', auto_drop => FALSE,enabled => FALSE);
exec sys.dbms_scheduler.set_attribute( name => '"SYSTEM"."UCR"', attribute => 'job_weight', value => 1);
exec sys.dbms_scheduler.enable( '"SYSTEM"."UCR"' );
commit;
exit;When I am connected to the database, I run these commands:
SQL> SELECT JOB_NAME, STATE, job_action, repeat_interval FROM DBA_SCHEDULER_JOBS
where job_name='UCR';
JOB_NAME
STATE
JOB_ACTION
REPEAT_INTERVAL
UCR
SCHEDULED
C:\UserCountReport\bin\ucr.bat
FREQ=HOURLY;BYHOUR=9;BYMINUTE=0;BYSECOND=0
SQL> SELECT JOB_NAME, status FROM DBA_SCHEDULER_JOB_LOG where job_name = 'UCR';
JOB_NAME
STATUS
UCR
SUCCEEDED
UCR
SUCCEEDED
UCR
SUCCEEDEDHowever, I don't get any signs that the job has run even though Oracle says all the runs have succeeded. The batch file that the job is supposed to execute creates a file and writes stuff to it. However, the file is not written. When I run the batch file from command prompt, it executes correctly.
I have tried following instructions here:
Answers to "Why are my jobs not running?"
However, all three of these commands return errors:
SQL> select value from v$parameter where name='job_queue_processes';
select value from v$parameter where name='job_queue_processes'
ERROR at line 1:
ORA-00942: table or view does not exist
SQL> select count(*) from dba_scheduler_running_jobs;
select count(*) from dba_scheduler_running_jobs
ERROR at line 1:
ORA-00942: table or view does not exist
SQL> select count(*) from dba_jobs_running;
select count(*) from dba_jobs_running
ERROR at line 1:
ORA-00942: table or view does not existI've tried various other commands from that list and I get errors as well.
I'm not quite sure where to go from here to troubleshoot this problem. Any help would be appreciated. Thanks.
Edited by: 874375 on Jul 22, 2011 9:14 AM
Edited by: 874375 on Jul 22, 2011 9:18 AMSo I changed my script to this:
exec sys.dbms_scheduler.create_job( job_name => '"SYSTEM"."UCR"', job_type => 'EXECUTABLE', job_action => '%windir%\system32\cmd.exe /C D:\UserCountReport\bin\ucr.bat', ....I now have this:
SQL> SELECT JOB_NAME, status FROM DBA_SCHEDULER_JOB_LOG where job_name='BOXTONE_
MONTHLY_UCR';
JOB_NAME
STATUS
BOXTONE_MONTHLY_UCR
FAILED
BOXTONE_MONTHLY_UCR
SUCCEEDED
BOXTONE_MONTHLY_UCR
SUCCEEDED
JOB_NAME
STATUS
BOXTONE_MONTHLY_UCR
SUCCEEDEDIs there a place with log files that will tell me why the job failed? If so where are the log files located? -
Error while taking dump using datapump
getting following error -
Export: Release 10.2.0.1.0 - Production on Friday, 15 September, 2006 10:31:41
Copyright (c) 2003, 2005, Oracle. All rights reserved.
Connected to: Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production
With the Partitioning, OLAP and Data Mining options
Starting "XX"."SYS_EXPORT_SCHEMA_02": XX/********@XXX directory=dpdump dumpfile=XXX150906.dmp logfile=XXX150906.log
Estimate in progress using BLOCKS method...
Processing object type SCHEMA_EXPORT/TABLE/TABLE_DATA
ORA-39125: Worker unexpected fatal error in KUPW$WORKER.GET_TABLE_DATA_OBJECTS while calling DBMS_METADATA.FETCH_XML_CLOB []
ORA-31642: the following SQL statement fails:
BEGIN "DMSYS"."DBMS_DM_MODEL_EXP".SCHEMA_CALLOUT(:1,0,0,'10.02.00.01.00'); END;
ORA-06512: at "SYS.DBMS_SYS_ERROR", line 86
ORA-06512: at "SYS.DBMS_METADATA", line 907
ORA-06550: line 1, column 7:
PLS-00201: identifier 'DMSYS.DBMS_DM_MODEL_EXP' must be declared
ORA-06550: line 1, column 7:
PL/SQL: Statement ignored
ORA-06512: at "SYS.DBMS_SYS_ERROR", line 95
ORA-06512: at "SYS.KUPW$WORKER", line 6235
----- PL/SQL Call Stack -----
object line object
handle number name
2A68E610 14916 package body SYS.KUPW$WORKER
2A68E610 6300 package body SYS.KUPW$WORKER
2A68E610 9120 package body SYS.KUPW$WORKER
2A68E610 1880 package body SYS.KUPW$WORKER
2A68E610 6861 package body SYS.KUPW$WORKER
2A68E610 1262 package body SYS.KUPW$WORKER
255541A8 2 anonymous block
Job "XX"."SYS_EXPORT_SCHEMA_02" stopped due to fatal error at 10:33:12
Action required is contact customer support. And on metalink found a link that states it a bug in 10g release 1 that was suppose to be fixed in 10g release 1 version 4.
some of the default schemas were purposely dropped from the database. The only default schema available now are -
DBSNMP, DIP, OUTLN, PUBLIC, SCOTT, SYS, SYSMAN, SYSTEM, TSMSYS.
DIP, OUTLN, TSMSYS were created again.
Could this be a cause of problem??
Thanks in adv.Hi,
Below is the DDL taken from different database. Will this be enough ? One more thing please, what shall be the password should it be DMSYS.....since this will not be used by me but system.
CREATE USER "DMSYS" PROFILE "DEFAULT" IDENTIFIED BY "*******" PASSWORD EXPIRE DEFAULT TABLESPACE "SYSAUX" TEMPORARY TABLESPACE "TEMP" QUOTA 204800 K ON "SYSAUX" ACCOUNT LOCK
GRANT ALTER SESSION TO "DMSYS"
GRANT ALTER SYSTEM TO "DMSYS"
GRANT CREATE JOB TO "DMSYS"
GRANT CREATE LIBRARY TO "DMSYS"
GRANT CREATE PROCEDURE TO "DMSYS"
GRANT CREATE PUBLIC SYNONYM TO "DMSYS"
GRANT CREATE SEQUENCE TO "DMSYS"
GRANT CREATE SESSION TO "DMSYS"
GRANT CREATE SYNONYM TO "DMSYS"
GRANT CREATE TABLE TO "DMSYS"
GRANT CREATE TRIGGER TO "DMSYS"
GRANT CREATE TYPE TO "DMSYS"
GRANT CREATE VIEW TO "DMSYS"
GRANT DROP PUBLIC SYNONYM TO "DMSYS"
GRANT QUERY REWRITE TO "DMSYS"
GRANT SELECT ON "SYS"."DBA_JOBS_RUNNING" TO "DMSYS"
GRANT SELECT ON "SYS"."DBA_REGISTRY" TO "DMSYS"
GRANT SELECT ON "SYS"."DBA_SYS_PRIVS" TO "DMSYS"
GRANT SELECT ON "SYS"."DBA_TAB_PRIVS" TO "DMSYS"
GRANT SELECT ON "SYS"."DBA_TEMP_FILES" TO "DMSYS"
GRANT EXECUTE ON "SYS"."DBMS_LOCK" TO "DMSYS"
GRANT EXECUTE ON "SYS"."DBMS_REGISTRY" TO "DMSYS"
GRANT EXECUTE ON "SYS"."DBMS_SYSTEM" TO "DMSYS"
GRANT EXECUTE ON "SYS"."DBMS_SYS_ERROR" TO "DMSYS"
GRANT DELETE ON "SYS"."EXPDEPACT$" TO "DMSYS"
GRANT INSERT ON "SYS"."EXPDEPACT$" TO "DMSYS"
GRANT SELECT ON "SYS"."EXPDEPACT$" TO "DMSYS"
GRANT UPDATE ON "SYS"."EXPDEPACT$" TO "DMSYS"
GRANT SELECT ON "SYS"."V_$PARAMETER" TO "DMSYS"
GRANT SELECT ON "SYS"."V_$SESSION" TO "DMSYS"
The other database has the DMSYS and the status is EXPIRED & LOCKED but I'm still able to take the dump using datapump?? -
Help in Understanding DBMS_JOB.SUBMIT
Hi,
I trying DBMS_JOB.SUBMIT for the first time and i am unable to figure out what is wrong in my code as i dont find any errors.
I have a Procedure Pro_job which has DBMS_JOB.SUBMIT which inturn calls an procedure.
here is the code.
CREATE OR REPLACE procedure Pro_job( P_Number1 IN Number) is
jobno number;
Begin
DBMS_JOB.SUBMIT(job=>jobno,
what => 'P_T.Proc_T(''P_Number1'');');
dbms_output.put_line(P_Number1);
dbms_output.put_line(jobno);
End;
When i compled there are no erros, but this DBMS_JOB.SUBMIT is not triggering or running P_T.Proc_T. And also i want it to run only once with out NEXT_DATE schedule. When i see in DBA_JOBS_RUNNING I find that the job is getting scheduled to run again for the same jobno. which i dont want evern if it fails. Thats the reason why i havnt given any Next_Date in DBMS_JOB.SUBMIT, but still it takes.
Select * from DBA_JOBS_RUNNING
I dont understand which i went work. Can someone guide me on this issue.
Thanks
SamiYou say that it's not triggering or running P_T.Proc_T.
How do you know?
Is it because you can't see the effects of that proc?
You also say that you can see it in DBA_JOBS_RUNNING and that it's getting rescheduled.
This means that the submit has worked.
It also sounds very much like the job is failing.
If the job fails it will retry a number of times before getting set to broken.
If you put some logging in what you're calling (the logging in an autonomous transaction perhaps), it might be more obvious what's happening.
Here's a standalone example of submitting a job, and it running:
SQL> drop table job_test;
Table dropped.
SQL> create table job_test
2 (col1 date);
Table created.
SQL>
SQL> create or replace procedure p_job_test
2 as
3 begin
4 insert into job_test
5 values(sysdate);
6 commit;
7 end;
8 /
Procedure created.
SQL> select * from job_test;
no rows selected
SQL>
SQL> declare
2 l_job integer;
3 begin
4 dbms_job.submit(l_job,'p_job_test;');
5 commit;
6 end;
7 /
PL/SQL procedure successfully completed.
SQL>
SQL> select * from job_test;
no rows selected
SQL> select * from job_test;
COL1
02-FEB-11
SQL> select * from user_jobs;
no rows selected
SQL> -
Scheduling job using DBMS_JOB.SUBMIT()
Hi people I hav esubmitted a job using DBMS_JOB.SUBMIT() package.I have set the time it should run after 5 minutes from the time i created.but now my question is how do we know the submitted job has been executed within specified interval?.am using oracle 9i.please suggest me.
Regards
VIDSYou should refer to DBA_JOBS and DBA_JOBS_RUNNING views to get information about your jobs
Please refer to this address to get more information about these views
http://pandazen.wordpress.com/2007/12/19/oracle-job-to-be-continued/
Kamran Agayev A. (10g OCP)
http://kamranagayev.wordpress.com -
Scheduling stored procedure using DBMS_JOB package
I have stored procedure called extract_every_day, I want this procedure to run automatically at 7:00 PM every day.
I used DBMS_JOB.SUBMIT to achieve this, below is pl/sql block
DECLARE
v_jobno number ;
BEGIN
DBMS_JOB.SUBMIT
(v_jobno,
' extract_every_day ',
TRUNC (SYSDATE) + 1 + 9/24,
'TRUNC (SYSDATE) + 1 + 9/24');
COMMIT;
END;
When I run above pl/sql block is that mean procedure extract_every_day executes every day and what is the significance of job OUT parameter in DBMS_JOB.SUBMIT procedure. Also how can I see list of jobs submitted.
Any help is appreciated.
ThanksThe OUT parameter is the unique number of the job being executed. This is the Sequence generated from sequence sys.jobseq
Also, in the example you have provided, the Job will run at 9Am and not 7PM.
To make it run at 7PM every day change the following lines :
'TRUNC (SYSDATE) + 1 + 9/24'
'TRUNC (SYSDATE) + 1 + 9/24'
To ,
'TRUNC (SYSDATE) + 19/24' <-- Changed
'TRUNC (SYSDATE) + 1 + 19/24' <-- Changed
Also do remember to include the parameter "job_queue_processes" parameter within the init.ora file. This parameter is used to determine the max no
of concurrently running jobs (i.e. Set in Init.ora).
NOTE :- Job_queue_process cannot be set to 0. If set to 0, no jobs is run.
he view dba_jobs and dba_jobs_running should be used to view the jobs.
-- Shailender Mehta -- -
Why Does Replication requires db restart to get transactions through
I am having problems with the deferred tranasactions. There were about 44,000 in the queue before. The dbms job was broken so I ran it and it was able to push half the tranactions from the 44,000 through.
However, only half. I am manually pushing the transactions through using OEM. But they do not seem to go through. Any ideas as to why they do not go through. Any alternatives to get all the deferred tranactions to being pushed?
Oracle 9.2.0.1 on W2k Svr.
The deferred tranaction queue had then incresed in size to 53,000 tranactions to be applied. I ran this query today, and get the following result.
SQL> SELECT SID, r.JOB, LOG_USER, r.THIS_DATE, r.THIS_SEC
2 FROM DBA_JOBS_RUNNING r, DBA_JOBS j
3 WHERE r.JOB = j.JOB;
SID JOB LOG_USER THIS_DATE THIS_SEC
54 8 REPADMIN 15-OCT-06 17:24:52
SQL>
Any ideas as to what to do with this information. I ran the query several times within an hour, but the ame result...any sggestions as to how to apply all the tranactions in teh deferred tranaction queue sucessfully across?
I executed the dbms jobs (which were broken) on all sites so that the DTQ empties. This was sucessfull on two of thethree master sites. However, on one of the master sites, it was only able to push half of the tranactions to one other site. This is what I am trying to resolve.
I try to manually push these transactiosn form OEM, but they do not seem to go through. Is there a way I could find wher the errors lay? I have checked all the alert logs and the trace files but no major errors.
W2K Ad Svr, Oracle 9i Release 2. and three Multimaster sites.
I even ran the following script, it executes, but does not push it through.
declare rc binary_integer; begin rc := sys.dbms_defer_sys.push(destination=>'DESTHOST.DOMAIN', stop_on_error=>FALSE, delay_seconds=>0, parallelism=>0); end;
Once again...in our Oracle 9.2.0.1 multimaster replication environmment on Windows 2000 server system containing three master sites is giving strange errors.
The transactions within defferred transaction queue at one of the sites are not being pushed at the other site. Last month, it was the other way around.
In the trace files, we can see that there are TNS connect error to the other master sites. However as soon as we restart the particular server, the transactions are pushed through.
This environment was working fine before and we were wondering as to what could be causing these errors all of a sudden.
These are only the transactions from the Deferrerd Transaction Queue which are yet to be applied to the other site. The error queue is quite constant and we are not facing much problems there.
In the trace files the errors are:
ORA-12012: error on auto execute of job 78
ORA-23324: error ORA-12535: TNS:operation timed out, while creating deferror entry at "globaldbname" with error -12535
ORA-06512: at "SYS.DBMS_DEFER_SYS", line 1716
ORA-06512: at "SYS.DBMS_DEFER_SYS", line 1804
ORA-06512: at line 1
*** 2006-11-07 22:05:42.000Did you fix your problem?
If Yes please help me bescause I am in the same situation -
Hi All,
I came across this good article on AQ troubleshooting. Thought of sharing it with all, hence, this post. Out of things mentioned in article, I have outlined a few steps, that helped me in our environment while troubleshooting AQ issues.
How to troubleshoot AQ issues?
https://blogs.oracle.com/db/entry/oracle_support_master_note_for_troubleshooting_advanced_queuing_and_oracle_streams_propagation_issue
a step-by-step methodology for troubleshooting and resolving problems with Advanced Queuing Propagation in both Streams and basic Advanced Queuing environments
1. Check if queues are buffered (in-memory) or persistent (on disk in a queue_table).
SQL> select * from v$buffered_queues;
no rows selected
2. Check if queue_to_queue or queue_to_dblink is used.
col destination for a15
col session_id for a15
set line 200
select qname,destination,session_id,process_name,schedule_disabled,instance, current_start_time
from dba_queue_schedules order by current_start_time desc,schedule_disabled desc ;
3. Check if queues are propagating data at all or are slow?
select TOTAL_NUMBER from DBA_QUEUE_SCHEDULES where QNAME='&queue_name';
4. Check job_queue_processes parameter. Should be more than 4.
5. Identify job queue processes...
For 10.2 and lower
select p.SPID, p.PROGRAM
from V$PROCESS p, DBA_JOBS_RUNNING jr, V$SESSION s, DBA_JOBS j
where s.SID=jr.SID
and s.PADDR=p.ADDR
and jr.JOB=j.JOB
and j.WHAT like '%sys.dbms_aqadm.aq$_propaq(job)%';
For 11.1 and higher
col PROGRAM for a30
select p.SPID, p.PROGRAM, j.JOB_name
from v$PROCESS p, DBA_SCHEDULER_RUNNING_JOBS jr, V$SESSION s, DBA_SCHEDULER_JOBS j
where s.SID=jr.SESSION_ID
and s.PADDR=p.ADDR
and jr.JOB_name=j.JOB_NAME
--and j.JOB_NAME like '%AQ_JOB$_%';
6. Check Alert.log and tracefiles for more information.
7. Check if DBlink is working fine through owner of DBlink.
8. Check queue errors and also find out associated Queue table
set linesize 140;
column destination format a25;
column last_error_msg format a35;
column schema format a15
select schema,
qname,
destination,
failures,
last_error_date,
last_error_time,
last_error_msg
from dba_queue_schedules
where failures != 0;
select QUEUE_TABLE from DBA_QUEUES where NAME ='&queue_name';
Check what queue is supposed to do
column qname format a40
column user_comment format a40
column last_error_msg format a40
column destination format a25
select distinct a.schema || '.' || a.qname qname
,a.destination
,a.schedule_disabled
,b.user_comment
from dba_queue_schedules a, dba_queues b
where a.qname=b.name;
9. Check if Queues are disabled.
select schema || '.' || qname,
destination,
schedule_disabled,
last_error_msg
from dba_queue_schedules
where schedule_disabled='Y';
10. If queue is DISABLED...enable it using following
select 'exec dbms_aqadm.enable_propagation_schedule(''' || schema || '.' || qname || ''', ''' || destination || ''');'
from dba_queue_schedules
where schedule_disabled='Y';
10.1 Check if propagation has been set correctly
Check that the propagation schedule has been created and that a job queue process has been assigned. Look for the entry in DBA_QUEUE_SCHEDULES and SYS.AQ$_SCHEDULES for your schedule. For 10g and below, check that it has a JOBNO entry in SYS.AQ$_SCHEDULES, and that there is an entry in DBA_JOBS with that JOBNO. For 11g and above, check that the schedule has a JOB_NAME entry in SYS.AQ$_SCHEDULES, and that there is an entry in DBA_SCHEDULER_JOBS with that JOB_NAME. Check the destination is as intended and spelled correctly.
10.2 Check if a Process_Name has been assigned to a queue, if no process_name is assigned...schedule is not currently executing. You may need to execute this statement no. of times to verify if a process is being allocated.
10.3 if a process_name is assigned and schedule executing but failing...Refer to step 8 for errors.
10.4 Check if queue tables exists in sys
SQL> select NAME, ENQUEUE_ENABLED, DEQUEUE_ENABLED
from DBA_QUEUES where owner='SYS'
and QUEUE_TABLE like '%PROP_TABLE%';
If the %PROP_NOTIFY queue is not enabled for enqueue or dequeue, it should be so enabled using DBMS_AQADM.START_QUEUE. However, the exception queue AQ$_AQ$_PROP_TABLE_E should not be enabled for enqueue or dequeue.
10.5 Check that the remote queue the propagation is transferring messages to exists and is enabled for enqueue
If the AQ_PROP_NOTIFY queue is not enabled for enqueue or dequeue, it should be so enabled using DBMS_AQADM.START_QUEUE. However, the exception queue AQ$_AQ$_PROP_TABLE_E should not be enabled for enqueue or dequeue.
11. Check performance of each queue.
col last_run_date for a40
col qname for a25
col NEXT_RUN_DATE for a40
col seconds for 9999
set line 200
select qname,
last_run_date,
NEXT_RUN_DATE,
total_number MESSAGES,
total_bytes/1024 KBYTES,
total_time SECONDS,
round(total_bytes/(total_time+0.0000001)) BYTES_PER_SEC, process_name
from dba_queue_schedules
order by BYTES_PER_SEC;
12. Check if there are locking issues...High value for Ctime>1800 indicates suspicious lock
select * from gv$transaction_enqueue order by ctime;
12.1 Find out objects accessed by session
select * from gv$access
where sid = 176 and object like 'T_%'
and owner = 'owner_name';
INST_ID SID OWNER OBJECT TYPE
3 176 owner_name Some_queue_table_name TABLE
2 176 owner_name Some_queue_table_name TABLE
1 176 owner_name Some_queue_table_name TABLE
12.2
select * from gv$lock
where sid = 176 and inst_id = 3;
INST_ID ADDR KADDR SID TY ID1 ID2 LMODE REQUEST CTIME BLOCK
3 A404050C A4040520 176 TM 35580 0 3 0 82823 2
3 A40407A0 A40407B4 176 TM 35578 0 3 0 82823 2
3 A4040058 A404006C 176 TM 35591 0 3 0
12.3
select object_name
from gv$lock l join dba_objects on id1 = object_id
where sid = 176 and inst_id = 3
and type = 'TM';
OBJECT_NAME
AQ$_queue_table_name_T
AQ$_queue_table_name_H
AQ$_queue_table_name_I
Some_queue_table_name
12.4. It could be that session is stuck...mostly, it ll be job in dbms_job trying to propagate message for 10.2 and below version
select /*+rule*/ *
from dba_jobs_running
where sid = 176;
SID JOB FAILURES LAST_DATE LAST_SEC THIS_DATE THIS_SEC INSTANCE
176 2867992 13-MAY-07 16:27:06 3
select job,what,this_date,next_date,broken
from dba_jobs
where job = 2867992;
JOB WHAT THIS_DATE NEXT_DATE B
2867992 next_date := sys.dbms_aqadm.aq$_propaq(job); 13-MAY-2007 16:27 13-MAY-2007 16:27 N
Check the job has an associated propagation schedule. If it doesn’t then that means the locks being seen are problems because the job is not doing anything.
select sid,jobno
from sys.aq$_schedules
where jobno = 2867992;
no rows selected
Check the job still has a thread running within the Oracle executable:
select sid,spid,p.program
from gv$session s join gv$process p on paddr = addr
where s.sid= 176 and s.inst_id = 3;
SID SPID PROGRAM
176 4608 ORACLE.EXE (J044)
v$session_wait shows it is still waiting for input even though the link has gone, confirming the issue:
select event from gv$session_wait where sid = 176 and inst_id = 3;
EVENT
SQL*Net message from dblink
13. Tracing queues
10.2 and below
connect / as sysdba
select p.SPID, p.PROGRAM
from v$PROCESS p, DBA_JOBS_RUNNING jr, V$SESSION s, DBA_JOBS j
where s.SID=jr.SID
and s.PADDR=p.ADDR
and jr.JOB=j.JOB
and j.WHAT like '%sys.dbms_aqadm.aq$_propaq(job)%';
-- For the process id (SPID) attach to it via oradebug and generate the following trace
oradebug setospid <SPID>
oradebug unlimit
oradebug Event 10046 trace name context forever, level 12
oradebug Event 24040 trace name context forever, level 10
-- Trace the process for 5 minutes
oradebug Event 10046 trace name context off
oradebug Event 24040 trace name context off
-- The following command returns the pathname/filename to the file being written to
oradebug tracefile_name
11g
connect / as sysdba
col PROGRAM for a30
select p.SPID, p.PROGRAM, j.JOB_NAME
from v$PROCESS p, DBA_SCHEDULER_RUNNING_JOBS jr, V$SESSION s, DBA_SCHEDULER_JOBS j
where s.SID=jr.SESSION_ID
and s.PADDR=p.ADDR
and jr.JOB_NAME=j.JOB_NAME
and j.JOB_NAME like '%AQ_JOB$_%';
-- For the process id (SPID) attach to it via oradebug and generate the following trace
oradebug setospid <SPID>
oradebug unlimit
oradebug Event 10046 trace name context forever, level 12
oradebug Event 24040 trace name context forever, level 10
-- Trace the process for 5 minutes
oradebug Event 10046 trace name context off
oradebug Event 24040 trace name context off
-- The following command returns the pathname/filename to the file being written to
oradebug tracefile_name
How to Enable/Diasble queue
col desitnation for a25
select QNAME,DESTINATION,SCHEDULE_DISABLED from dba_queue_Schedules where destination='DB_link';
exec dbms_aqadm.DISABLE_PROPAGATION_SCHEDULE(QUEUE_NAME=>'&Enter_SchemaName_QueueName',DESTINATION=>'&Enter_Destination');
exec dbms_aqadm.ENABLE_PROPAGATION_SCHEDULE(QUEUE_NAME=>'&Enter_SchemaName_QueueName',DESTINATION=>'&Enter_Destination');
exec dbms_aqadm.unschedule_propagation(QUEUE_NAME=>'&Enter_SchemaName_QueueName',DESTINATION=>'&Enter_Destination');
exec dbms_aqadm.schedule_propagation(QUEUE_NAME=>'&Enter_SchemaName_QueueName',DESTINATION=>'&Enter_Destination');My audio has the scratchy, stuttering, speedy
problems others have reported. I have followed all
the tips and recommendations in the troubleshooting
document for this problem, and I am incredibly
frustrated.
I'm running XP and everything was fine on iTunes 6.
Nothing in my system has changed other than
installing iTunes 7 - so I can't imagine that there
is anything out of whack on my system.
Does anyone have any real solutions for this problem?
Sorry to report that I too have this problem. I was hoping that someone could help me get back to i-Tunes 6 as that worked very well for me. What I do with the scratchy popping thing for now is I simply close the i-Tunes and restart it. Most of the time that will work on the first try.
I'm using windows XP also with no other issues. -
Scheduling Manager hangs...
Hello,
We are using Discoverer Plus 10g (10.1.2.45.46c) and migrated from an earlier version (4i) spring of 2006.
- I am trying to schedule a workbook with multiple sheets created with the new version.
- The workbook executes in about 4 minutes, when I manually execute the 5 worksheets back to back
- But when I schedule it, it hangs in the Scheduling manager but when I check directly on the Database using the following command I notice that the job is done :
SELECT job,sid FROM dba_jobs_running; (no rows are returned)
After I execute that SELECT, the Scheduling Manager is automatically updated and the status the job becomes ‘Complete’. I can then open the Scheduled Workbook normally.
It is as if the Scheduling manager does not know when the execution is complete and the SELECT I do triggers the status to be updated.
Everything works fine when I schedule a workbook with single or multiple worksheets created with the earlier version. It also works fine when I schedule a single worksheet out of a multiple worksheet Workbook created with the later version of Discoverer!!!!
Can anyone mane any sense of what is happening ?
Thank You !
MarieHi Marie
What database privileges do you have? This is the first place I would look. These are the ones you need:
connect
resource
analyze any
create procedure
create sequence
create session
create table
create view
execute any procedure
global query rewrite
select any table
unlimited tablespace
execute on sys.dbms_job
select on sys.v_$parameter
I hope this helps
Best wishes
Michael Armstrong-Smith
URL: http://learndiscoverer.com
Blog: http://learndiscoverer.blogspot.com -
If I request a ob to be scheduled with the command:
dbms_job.submit()
How can I monitor the status of the job
Which table do I need to perform a select on ?
ThanksYou can answer any question about the dictionary views by issuing
select *
from dict
where table_name like '%'||upper('&keyword')||'%'
in your case 'job'
This should result in dba_jobs, dba_jobs_running and user_jobs
Sybrand Bakker
Senior Oracle DBA -
DBMS_JOB executes only once
Hi,
I submit a job to the job queue using the following syntax:
declare
jobno number;
begin
dbms_job.submit(job=>jobno,
what=>'begin call_job; end;',
next_date=>SYSDATE,
interval=>'SYSDATE+1/1440');
end;
The CALL_JOB procedure just has a simple insert statement which inserts a row into a table.
After submitting the job, the job executes at once and inserts a row in the database, but after the first execution, though the values for the LAST_DATE and the NEXT_DATE columns in DBA_JOBS get incremented, no rows are inserted into the table.
There is no entry in the DBA_JOBS_RUNNING table.
TIA,
RameshWhat is job_queue_interval set to in the init.ora?
If it's set to '60', and you job interval is every minute, I'm not sure it will run. Try reducing job_queue_interval to 30 (restart database) or try making your jobs next interval a little longer.
Just a guess though. -
Hi ,
We use DBMS to kick our OWB maps.Previously it worked very fine ..But from near about 2 weeks we are facing problems.
Problem is though our JOB_QUEUE_PROCESS is set to 8 and even I can see 8 jobs with this_data populated in dba_jobs (means jobs are running as we cannot query DBA_JOBS_RUNNING view to see the no of jobs running as it is taking too much time ) we can see only entry of two of there maps in WB_RT_AUDIT.other maps start only if these two get complete .
and there is huge time difference between actual job start time and the entry into WB_RT_AUDIT table .
can any one help us with solution.
Bcos of this issues load which used to take max 4 hours is now taking 24 hours..
Thanks & RegardsI've successfully installed OWF as described in Installation guide (all components are on the sam server).
But when I deploy a workflow in OWB I get some errors. In the job details
I find ORA-00942 and RPE-02053. It seems that the workflow repository is missing.
Are there additional steps for creating a workflow repository?
Or what is wrong? All installation logs (wf.log and workflow.log) are without errors and with success messages.
Any idea?
Maybe you are looking for
-
Hi! All Is it possible to use AT NEW statement in Smartforms-->Program Lines? i,e i need to display in such a way ( format the key should not be repeated.) for example i need to display the packing details for a particular Invoice b
-
when i try ctrl+alt+backspace to stop X, my screen goes black and then my monitor says there is no input. (like what happens when your monitor is on, but the computer isnt.) how do i fix this? so far i love arch linux, but this is my main problem
-
Duping (send to back)
When i duplicate a movie clip it always seems to come to the front and get in the way, is there a code to send it to the back, even when you dupe it. thanks in advance.
-
MS OFFICE 2014 Converting Problems
I have just bought Adobe XI Pro, I am also using MS OFFICE 2014. When I save Word file as 2014 format and convert it to PDF , On header & footer section , if there is a picture or shape behind writings, writings are not been shown when converted. I
-
Hi all! I am new to this discussions page. HAPPY NEW YEAR! anyway, i have the version of iWeb prior to iWeb '08 on my Mac mini (which is an awesome machine may I add) is there any way i can put widgets and HTML in without upgrading to iWeb '08??? Tha