ORA-4021 的发生原因
An Oracle instance contains a cache that holds the definitions of each different type of objects e.g. cursors, indexes, tables, views, procedures, etc. This cache is called the library cache and conta
Read moreAn Oracle instance contains a cache that holds the definitions of each different type of objects e.g. cursors, indexes, tables, views, procedures, etc. This cache is called the library cache and conta
Read morewww.dbhelp.net 十字螺丝钉的DBA日记 公司备库ADG意外宕机,alert日志显示LGWR进程终止了DB instance
1 2 3 4 |
Wed Dec 06 02:34:59 2017 Errors in file /u01/app/oracle/diag/rdbms/ivlstd3/ivlstd3/trace/ivlstd3_lgwr_40339.trc: ORA-04021: timeout occurred while waiting to lock object LGWR (ospid: 40339): terminating the instance due to error 4021 |
错误原因: 1、发生ORA-4021 错误的原因? 获取library cache lock/pin 超时 2、为什么是 LGWR 终止了db instance? 根据 《Bug 18242740
Read more在生产库发现了一条奇葩SQL,下面进行分析。
1 2 3 4 5 6 7 8 9 |
select count(*) from ORD_MDA_CALL_INFO_D T, PRD_PRD_M P WHERE T.PRD_ID = P.PRD_ID(+) and (T.EMP_NO = :1 OR T.EMP_NO = :2) and T.MDA_CNVR_PTR_CD = :3 and T.INST_DTM > to_date(:4, 'yyyy-mm-dd hh24:mi:ss') and T.INST_DTM < to_date(:5, 'yyyy-mm-dd hh24:mi:ss') AND (T.BIZ_UNT_CD = :6 or T.BIZ_UNT_CD = 'TV') order by T.INST_DTM desc; |
问题1:count()统计行数的时候,排序操作是多余的。 问题2:left join连接中,以左表为主表,和右表通过关联条件连接,A表满足条件的数据都会被返回,而B表中没有的数据则以NULL表示。上面的SQL中T表left join P表,但是SQL中P表并没有任何过滤条件,所有过滤都是
Read more一个朋友问如何设置Oracle闪回区大小,有什么依据没有。 查证官方文档,有这样的描述For example, if you intend to setDB_FLASHBACK_RETENTION_TARGET to 24 hours,and if the database generates 20 GB of redo in a day, then a rule of thumb is to a
Read more在实际工作中,我们经常需要将表中的最大值和最小值同时查询出来,用于分析。 类似于这样的SQL,select min(object_id),max(object_id) from borpt.t1; 但是,表很大的时候,用最容易想到的方式效率很低,那么有没有更高效的方式呢?下面展开讲解。 初始化测试环境
1 2 3 4 5 6 7 8 9 |
create table borpt.t1 as select * from dba_objects; select count(*) from borpt.t1; COUNT(*) ---------- 80588 create index borpt.ind_t1 on borpt.t1(object_id); |
查询最大值时的执行计划,走的
Read more朋友遇到Oracle数据库的 REDO LOG 写丢失,造成数据库,且无法启动。 日志如下:redo log 5无法归档,并且侦测到“写丢失”。最终导致Oracle宕机。
1 2 3 4 5 6 7 8 |
Errors in file /u01/app/oracle/diag/rdbmsdbcontrol/GZDBCONTROL/trace/GZDBCONTROL_ora_32198.trc: ORA-16038: log 5 sequence# 23 cannot be archived ORA-00742: Log read detects lost write in thread %d sequence %d block %d ORA-00312: online log 5 thread 1: '/u01/app/oracle/fast_recovery_area/GZDBCONTROL/onlinelog/o1_mf_5_d61ctj3y_.log' USER (ospid: 32198): terminating the instance due to error 16038 System state dump requested by (instance=1, osid=32198), summary=[abnormal instance termination]. System State dumped to trace file /u01/app/oracle/diag/rdbmsdbcontrol/GZDBCONTROL/trace/GZDBCONTROL_diag_32167_20161227110109.trc Dumping diagnostic data in directory=[cdmp_20161227110109], requested by (instance=1, osid=32198), summary=[abnormal instance termination]. |
问题原因: 这三种清空都可能导致“写丢失”发生:操作系统、存储系统、Oracle内部错误。 解决办法: 使用dump判断redo logfile是否真正发生了&#
Read more前段时间搭建了一个测试库,主库是双节点RAC,备库是单实例。最近开发人员测试时,老反应主备数据不同步。 检查主备库参数配置都没发现问题。最后通过dataguard日志,终于找出问题所在。
1 2 3 |
1 Log Apply Services Informational 0 1888 0 NO 2015-08-06 23:26:02 Media Recovery Log /u01/app/oracle/arch/2_1046_884367293.arc 1 Log Apply Services Warning 0 1889 0 NO 2015-08-06 23:26:03 Media Recovery Waiting for thread 2 sequence 1047 (in transit) 1 Remote File Server Warning 0 1890 0 NO 2015-08-06 23:27:02 RFS[79]: No standby redo logfiles created for thread 2 |
上面第三行日志可以看到,日志报RFS[79]: No standby redo logfiles created for thread 2,意思是
Read more为现有RAC搭建了一套RAC stanby备库,在客户端用VIP可以正常连接,但是通过SCAN IP则无法连接。 客户端无法登录
1 2 3 4 5 6 7 |
$ sqlplus TRADE/xxxxx@10.0.2.110/trade34 SQL*Plus: Release 11.2.0.4.0 Production on Wed Mar 23 13:56:41 2016 Copyright (c) 1982, 2013, Oracle. All rights reserved. ERROR: ORA-12514: TNS:listener does not currently know of service requested in connect descriptor |
问题原因 服务端是RAC,没有设置remote_listener。 11gR2 数据库,默认设置local_listener 参数为local LISTENER(本地监听器,ip地址为vip),为VIP
Read more