分享
 
 
 

Oracle诊断案例:Job任务停止执行

王朝oracle·作者佚名  2008-05-31
窄屏简体版  字體: |||超大  

摘要:

本文通过一次Oracle Job任务异常案例诊断,分析其原因及解决过程,从内部揭示Oracle Job任务调度及内部计时机制。

问题及环境

接到研发人员报告,数据库定时任务未正常执行,导致某些操作失败。

开始介入处理该事故.

系统环境:

SunOS DB 5.8 Generic_108528-21 sun4u sparc SUNW,Ultra-4

Oracle9i Enterprise Edition Release 9.2.0.3.0 - ProdUCtion

解决过程

首先介入检查数据库任务

$ sqlplus "/ as sysdba"

SQL*Plus: Release 9.2.0.3.0 - Production on Wed Nov 17 20:23:53 2004

Copyright (c) 1982, 2002, Oracle Corporation. All rights reserved.

Connected to:

Oracle9i Enterprise Edition Release 9.2.0.3.0 - Production

With the Partitioning, OLAP and Oracle Data Mining options

JServer Release 9.2.0.3.0 - Production

SQL> select job,last_date,last_sec,next_date,next_sec,broken,failures from

dba_jobs;

JOB LAST_DATE LAST_SEC NEXT_DATE NEXT_SEC B FAILURES

INTERVAL

---------- --------- ---------------- --------- ---------------- - ----------

----------------------------

31 16-NOV-04 01:00:02 17-NOV-04 01:00:00 N 0

trunc(sysdate+1)+1/24

27 16-NOV-04 00:00:04 17-NOV-04 00:00:00 N 0

TRUNC(SYSDATE) + 1

35 16-NOV-04 01:00:02 17-NOV-04 01:00:00 N 0

trunc(sysdate+1)+1/24

29 16-NOV-04 00:00:04 17-NOV-04 00:00:00 N 0

TRUNC(SYSDATE) + 1

30 01-NOV-04 06:00:01 01-DEC-04 06:00:00 N 0

trunc(add_months(sysdate,1),’MM’)+6/24

65 16-NOV-04 04:00:03 17-NOV-04 04:00:00 N 0

trunc(sysdate+1)+4/24

46 16-NOV-04 02:14:27 17-NOV-04 02:14:27 N 0

sysdate+1

66 16-NOV-04 03:00:02 17-NOV-04 18:14:49 N 0

trunc(sysdate+1)+3/24

8 rows selected.

发现JOB任务是都没有正常执行,最早一个应该在17-NOV-04 01:00:00执行。但是没有执行。

建立测试JOB

create or replace PROCEDURE pining

IS

BEGIN

NULL;

END;

/

variable jobno number;

variable instno number;

begin

select instance_number into :instno from v$instance;

dbms_job.submit(:jobno, ’pining;’, trunc(sysdate+1/288,’MI’),

’trunc(SYSDATE+1/288,’’MI’’)’, TRUE, :instno);

end;

/

发现同样的,不执行。

但是通过dbms_job.run(<job>)执行没有任何问题。

进行恢复尝试

怀疑是CJQ0进程失效,首先设置JOB_QUEUE_PROCESSES为0,Oracle会杀掉CJQ0及相应job进程

SQL> ALTER SYSTEM SET JOB_QUEUE_PROCESSES = 0;

等2~3分钟,重新设置

SQL> ALTER SYSTEM SET JOB_QUEUE_PROCESSES = 5;

此时PMON会重起CJQ0进程

Thu Nov 18 11:59:50 2004

ALTER SYSTEM SET job_queue_processes=0 SCOPE=MEMORY;

Thu Nov 18 12:01:30 2004

ALTER SYSTEM SET job_queue_processes=10 SCOPE=MEMORY;

Thu Nov 18 12:01:30 2004

Restarting dead background process CJQ0

CJQ0 started with pid=8

但是Job仍然不执行,而且在再次修改的时候,CJQ0直接死掉了。

Thu Nov 18 13:52:05 2004

ALTER SYSTEM SET job_queue_processes=0 SCOPE=MEMORY;

Thu Nov 18 14:09:30 2004

ALTER SYSTEM SET job_queue_processes=10 SCOPE=MEMORY;

Thu Nov 18 14:10:27 2004

ALTER SYSTEM SET job_queue_processes=0 SCOPE=MEMORY;

Thu Nov 18 14:10:42 2004

ALTER SYSTEM SET job_queue_processes=10 SCOPE=MEMORY;

Thu Nov 18 14:31:07 2004

ALTER SYSTEM SET job_queue_processes=0 SCOPE=MEMORY;

Thu Nov 18 14:40:14 2004

ALTER SYSTEM SET job_queue_processes=10 SCOPE=MEMORY;

Thu Nov 18 14:40:28 2004

ALTER SYSTEM SET job_queue_processes=0 SCOPE=MEMORY;

Thu Nov 18 14:40:33 2004

ALTER SYSTEM SET job_queue_processes=1 SCOPE=MEMORY;

Thu Nov 18 14:40:40 2004

ALTER SYSTEM SET job_queue_processes=10 SCOPE=MEMORY;

Thu Nov 18 15:00:42 2004

ALTER SYSTEM SET job_queue_processes=0 SCOPE=MEMORY;

Thu Nov 18 15:01:36 2004

ALTER SYSTEM SET job_queue_processes=15 SCOPE=MEMORY;

尝试重起数据库,这个必须在晚上进行:

PMON started with pid=2

DBW0 started with pid=3

LGWR started with pid=4

CKPT started with pid=5

SMON started with pid=6

RECO started with pid=7

CJQ0 started with pid=8

QMN0 started with pid=9

....

CJQ0正常启动,但是Job仍然不执行。

没办法了...

继续研究...居然发现Oralce有这样一个bug

1. Clear description of the problem encountered:

slgcsf() / slgcs() on Solaris will stop incrementing after

497 days 2 hrs 28 mins (approx) machine uptime.

2. Pertinent configuration information

No special configuration other than long machine uptime. .

3. Indication of the frequency and predictability of the problem

100% but only after 497 days.

4. Sequence of events leading to the problem

If the gethrtime() OS call returns a value > 42949672950000000

nanoseconds then slgcs() stays at 0xffffffff. This can

cause some problems in parts of the code which rely on

slgcs() to keep moving.

eg: In kkjssrh() does "now = slgcs(&se)" and compares that

to a previous timestamp. After 497 days uptime slgcs()

keeps returning 0xffffffff so "now - kkjlsrt" will

always return 0. .

5. Technical impact on the customer. Include persistent after effects.

In this case DBMS JOBS stopped running after 497 days uptime.

Other symptoms could occur in various places in the code.

好么,原来是计时器溢出了,一检查我的主机:

bash-2.03$ uptime

10:00pm up 500 day(s), 14:57, 1 user, load average: 1.31, 1.09, 1.08

bash-2.03$ date

Fri Nov 19 22:00:14 CST 2004

刚好到事发时是497天多一点.ft.

安排重起主机系统..

这个问题够郁闷的,NND,谁曾想Oracle这都成...

Oracle最后声称:

fix made it into 9.2.0.6 patchset

在Solaris上的9206尚未发布...晕.

好了,就当是个经历吧,假如有问题非常不可思议的话,那么大胆怀疑Oracle吧,是Bug,可能就是Bug。

重起以后问题解决,状态如下:

$ sqlplus "/ as sysdba"

SQL*Plus: Release 9.2.0.3.0 - Production on Fri Nov 26 09:21:21 2004

Copyright (c) 1982, 2002, Oracle Corporation. All rights reserved.

Connected to:

Oracle9i Enterprise Edition Release 9.2.0.3.0 - Production

With the Partitioning, OLAP and Oracle Data Mining options

JServer Release 9.2.0.3.0 - Production

SQL>

select job,last_date,last_sec,next_date,next_sec from user_jobs;

JOB LAST_DATE LAST_SEC NEXT_DATE NEXT_SEC

---------- --------- ---------------- --------- ----------------

70 26-NOV-04 09:21:04 26-NOV-04 09:26:00

SQL> /

JOB LAST_DATE LAST_SEC NEXT_DATE NEXT_SEC

---------- --------- ---------------- --------- ----------------

70 26-NOV-04 09:26:01 26-NOV-04 09:31:00

SQL>

SQL> select * from v$timer;

HSECS

----------

3388153

SQL> select * from v$timer;

HSECS

----------

3388319

SQL>

FAQ

 
 
 
免责声明:本文为网络用户发布,其观点仅代表作者个人观点,与本站无关,本站仅提供信息存储服务。文中陈述内容未经本站证实,其真实性、完整性、及时性本站不作任何保证或承诺,请读者仅作参考,并请自行核实相关内容。
2023年上半年GDP全球前十五强
 百态   2023-10-24
美众议院议长启动对拜登的弹劾调查
 百态   2023-09-13
上海、济南、武汉等多地出现不明坠落物
 探索   2023-09-06
印度或要将国名改为“巴拉特”
 百态   2023-09-06
男子为女友送行,买票不登机被捕
 百态   2023-08-20
手机地震预警功能怎么开?
 干货   2023-08-06
女子4年卖2套房花700多万做美容:不但没变美脸,面部还出现变形
 百态   2023-08-04
住户一楼被水淹 还冲来8头猪
 百态   2023-07-31
女子体内爬出大量瓜子状活虫
 百态   2023-07-25
地球连续35年收到神秘规律性信号,网友:不要回答!
 探索   2023-07-21
全球镓价格本周大涨27%
 探索   2023-07-09
钱都流向了那些不缺钱的人,苦都留给了能吃苦的人
 探索   2023-07-02
倩女手游刀客魅者强控制(强混乱强眩晕强睡眠)和对应控制抗性的关系
 百态   2020-08-20
美国5月9日最新疫情:美国确诊人数突破131万
 百态   2020-05-09
荷兰政府宣布将集体辞职
 干货   2020-04-30
倩女幽魂手游师徒任务情义春秋猜成语答案逍遥观:鹏程万里
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案神机营:射石饮羽
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案昆仑山:拔刀相助
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案天工阁:鬼斧神工
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案丝路古道:单枪匹马
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案镇郊荒野:与虎谋皮
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案镇郊荒野:李代桃僵
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案镇郊荒野:指鹿为马
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案金陵:小鸟依人
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案金陵:千金买邻
 干货   2019-11-12
 
推荐阅读
 
 
 
>>返回首頁<<
 
靜靜地坐在廢墟上,四周的荒凉一望無際,忽然覺得,淒涼也很美
© 2005- 王朝網路 版權所有