oracle_job processes associated learning test

Oracle cjq0 testing process
Testing process:
1 .CJQ process does not exist
 2 analog Problem
 3 Summary problem

First, the problem phenomenon
CJQ0 process does not exist
[root@adg1 ~]# ps -ef|grep cjq
root      4741  4675  0 11:36 pts/6    00:00:00 grep cjq
[oracle@adg1 ~]$ sqlplus / as sysdba
SQL*Plus: Release 11.2.0.4.0 Production on Sun Jul 28 11:35:04 2019
SQL> show parameter job_que
NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
job_queue_processes                  integer     100


Second, the process simulation problems
1 .JOB create
 1 ) create a test JOB
HTTPS: // www.cnblogs.com/lijiasnong/p/3382578.html 
- create a table
 - TRUNCATE the Table TT;
SQL> GRANT EXECUTE ON DBMS_JOB TO yz;
create table TT(C_DATE DATE); 
create or replace procedure PRO_TT is
 begin 
 insert into TT values(sysdate); 
 commit;
 end;
 /
exec PRO_TT;
SQL> select * from tt;

declare   
job number;      
begin
dbms_job.submit(job,'PRO_TT;',sysdate,'sysdate+1/1440');
end;
/

--
begin
  dbms_job.remove(32);
  commit;
end;
/

--
SQL> select JOB,WHAT,BROKEN from user_jobs;
       JOB WHAT                                                          B
---------- ----------------------------------------------------------------- -
        34 PRO_TT;                                                       N
--dbms_job.broken(23,false,sysdate); 

The first execution job        
begin
 dbms_job.run(34);
end;
/

DB_Alert
Sun Jul 28 11:42:21 2019
Starting background process CJQ0
Sun Jul 28 11:42:21 2019
CJQ0 started with pid=31, OS id=4851


[root@adg1 ~]# ps -ef|grep cjq
oracle    4851     1  0 11:42 ?        00:00:00 ora_cjq0_tt
root      4855  4675  0 11:42 pts/6    00:00:00 grep cjq

SQL> alter session set nls_date_format='yyyy-mm-dd hh24:mi:ss';
SQL> select * from tt ;
C_DATE
-------------------
 2019 - 07 - 28  13 is : 58 : 59 
2019 - 07 - 28  13 is : 59 : 39 
- the operation was to create a JOB, and test manually call a stored procedure execution and implementation of the manual JOB are valid, it will automatically insert a test data.


Under normal circumstances, the JOB is the interval of 1 minute, to insert a record
select job,
       log_user,
       to_char(last_date,'yyyy-mm-dd hh24:mi:ss') last_date,
       to_char(next_date,'yyyy-mm-dd hh24:mi:ss') next_date,
       interval,
       what,
       FAILURES
  from user_jobs where job=34
/
       JOB LOG_USER        LAST_DATE           NEXT_DATE              INTERVAL             WHAT                   FAILURES
---------- ---------- ------------------- ------------------- -------------------- -------------------- ----------
        34 YZ           2019-07-28 13:59:39 2019-07-28 14:00:39      sysdate+1/1440       PRO_TT;                  0
SQL> select * from tt ;
C_DATE
-------------------
2019-07-28 13:58:59
2019-07-28 13:59:39
SQL> select sysdate from dual;
SYSDATE
-------------------
2019-07-28 13:25:34
The verification, it was found JOB does not automatically call execution? ? ?


2 ) JOB abnormal, troubleshooting
 2.1 query log or process information
db alert without exception, job no abnormality
SQL> select * from dba_jobs_running;
no rows selected

SQL> SELECT USERNAME,PNAME,PROGRAM,TRACEFILE from v$process where PNAME like '%CJQ%';
USERNAME        PNAME PROGRAM                                          TRACEFILE
--------------- ----- -------------------------------------------------------------------------------------------------
oracle          CJQ0  oracle@adg1 (CJQ0)                               /u01/app/oracle/diag/rdbms/tt/tt/trace/tt_cjq0_4851.trc 
SQL> select * from v$bgprocess where name='CJQ0';
PADDR              PSERIAL# NAME  DESCRIPTION                ERROR
---------------- ---------- ----- ---------------------------- ------
00000000F552A288          3 CJQ0  Job Queue Coordinator        0

[oracle@adg1 ~]$ ps -ef|grep cjq
oracle   10884  9146  0 21:37 pts/2    00:00:00 grep cjq
The environment found cjq process does not exist! ! !
Jobs Not Executing Automatically (文档 ID 313102.1)    


2.2 reset the parameters
SQL> alter system set job_queue_processes=0;
SQL> alter system set job_queue_processes=200;
DB_Alert
Sun Jul 28 11:36:56 2019
ALTER SYSTEM SET job_queue_processes=0 SCOPE=BOTH;
Sun Jul 28 11:37:26 2019
ALTER SYSTEM SET job_queue_processes=200 SCOPE=BOTH;

[root@adg1 ~]# ps -ef|grep cjq
root      4817  4675  0 11:37 pts/6    00:00:00 grep cjq
Job_queue_process by resetting the parameters did not meet the purpose of the process started cjq

2.3 Query sga area of memory status, is 1
SQL> oradebug setmypid
Statement processed.
SQL> oradebug dumpvar sga kkjsre
sword kkjsre_ [060040500, 060040504) = 00000001
       
2.4 修改参数,event
IF -Jobs Do Not Run Automatically as CJQ is Not Getting Started when Jobs are to be Run (文档 ID 2081753.1)    
 Upgraded from 10.2.0.4 to 11.2.0.2
SQL> alter system set events '10195 trace name context off';

2.5 manual call execution Job without exception
begin
 dbms_job.run(34);
end;
/
But the process was not started

2.6 finally found the problem
Test environment JOB, can not be invoked automatically, according to investigation documents, test environment in a restricted mode
HTTP: // blog.itpub.net/29487349/viewspace-1663945/ 
restricted mode, after the configuration, without affecting the connected session, a new session without permission can not be restricted session landing db

SQL> select instance_name,logins from v$instance;
INSTANCE_NAME    LOGINS
---------------- ----------
tt               RESTRICTED
SQL> alter system disable restricted session;
System altered.
SQL> select instance_name,logins from v$instance;
INSTANCE_NAME    LOGINS
---------------- ----------
tt               ALLOWED
SQL> select * from tt ;
C_DATE
-------------------
2019-07-28 13:58:59
2019-07-28 13:59:39
2019-07-28 14:09:52
2019-07-28 14:10:52
2019-07-28 14:11:52
2019-07-28 14:12:52
6 rows selected.


SQL> truncate table tt;
Table truncated.


Alert log, after the restoration of normal conditions, job automatically calls the execution, automatic background process started cjq service.
Sun Jul 28 22:28:24 2019
Restarting dead background process CJQ0
Sun Jul 28 22:28:24 2019
CJQ0 started with pid=20, OS id=11444 

SQL> alter system set job_queue_processes=0;
Sun Jul 28 22:34:11 2019
Stopping background process CJQ0
Sun Jul 28 22:34:11 2019
ALTER SYSTEM SET job_queue_processes=0 SCOPE=BOTH;
SQL> alter system set job_queue_processes=200;
[oracle@adg1 ~]$ ps -ef|grep cjq
oracle   11545  9146  0 22:34 pts/2    00:00:00 grep cjq

to sum up:
1 . Modify Job_queue_processes, from> 0 0 modify, and there CJQ0 process, will kill cjq0 process, and the subsequent job can not be performed automatically calls
 2 . Job_queue_processes modifying parameters> 0 , the process can not be started immediately CJQ0, and need to meet the timing Job call a job, it will first start cjq0 process (if the parameter is 0, can not start)
 3 . performed manually call a stored procedure, job id was not able to start immediately cjq0 process, modify Events ' 10195 the trace name context OFF ' only the problem, there is CJQ process or upgrade to 10g 11g job can not perform automatic processing issues;
 4 If the database connection status is rESTRICTED restricted mode if no appropriate permissions, you can not perform automatic JOB;.
 5 . If cjq process exists, but the job does not automatically invoke execution , and the memory region is not 1 sga 00000001 , in accordance with the need to restart or mos
Jobs do not the Execute Automatically (Doc ID 309,945.1 ) for processing
SQL> exec  dbms_ijob.set_enabled(true);

       

 

Guess you like

Origin www.cnblogs.com/lvcha001/p/11793066.html