Oracle daily maintenance-invalid object

1.About check_mk metric:ORA_ORCL_Object_Invalid

This is a custom monitoring metric on check_mk platform,
the threshold is defined in /usr/lib/check_mk_oracle/MAIN/conf/perf_IYOA_object.json

[oracle@idpcn-iyoa conf]$ cat perf_IYOA_object.json 
{"target_info":[{
"perf_min":"0",
"chk_interval":5000,
"output_cmd":"echo",
"post_action":"",
"export2rdb":"Y",
"perf_crit":"30",
"chk_cmd":"sh run_invalid.sh",
"perf_max":"0",
"chk_result_separator":";",
"perf_warn":"1",
"database":"IYOA"
}]}

notice the two threshold value:“perf_warn”:“1”,“perf_crit”:“30”,Represent warning and critical respectively

2.solution

2.1 check whether there are invalid objects in DB

SELECT  *  FROM  dba_objects   
        WHERE   status='INVALID'  
        AND OWNER NOT IN ('SYSMAN','WMSYS','PUBLIC','SYS','OLAPSYS','CTXSYS','XDB','EXFSYS','ORDSYS','MDSYS') 
        AND OBJECT_TYPE NOT IN ('MATERIALIZED VIEW')   ;

2.2 Generate batch sql for recompile purpose

SELECT  'alter '||object_type||' '||owner||'.'||object_name||' compile;'  batch_script FROM  dba_objects   
        WHERE   status='INVALID'  
        AND OWNER NOT IN ('SYSMAN','WMSYS','PUBLIC','SYS','OLAPSYS','CTXSYS','XDB','EXFSYS','ORDSYS','MDSYS') 
        AND OBJECT_TYPE NOT IN ('MATERIALIZED VIEW');

output:
在这里插入图片描述

2.3 paste the previous output results to linux text file in linux

vi /home/oracle/alter.sql

alter PROCEDURE MYSIS.P_BUMILSAKT_ALERT compile;
alter PROCEDURE MYSIS.PCR_WORK6DAYSTEST compile;
alter FUNCTION MYSIS.FCR_CALCOT2_TESTVPLG compile;
alter SYNONYM MYSIS.CR_TRANS compile;
-- INSERT --                                  

2.4 save and quit text editor, then go into sqlplus

sqlplus /nolog
connect / as sysdba

2.5 execute the sql script in sqlplus

@/home/oracle/alter.sql
Warning: Procedure altered with compilation errors.
Procedure altered.

“Procedure altered” mean successful recompile, “Warning” mean unsuccessful compile

2.6 co-work with developer

for unsuccessful recompilation, need to re-execute step2.1, and post the output result to relevant developer, ask them review source code and provide necessary support

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值