标签云
asm恢复 bbed bootstrap$ dul In Memory kcbzib_kcrsds_1 kccpb_sanity_check_2 MySQL恢复 ORA-00312 ORA-00607 ORA-00704 ORA-00742 ORA-01110 ORA-01555 ORA-01578 ORA-01595 ORA-08103 ORA-600 2131 ORA-600 2662 ORA-600 3020 ORA-600 4000 ORA-600 4137 ORA-600 4193 ORA-600 4194 ORA-600 16703 ORA-600 kcbzib_kcrsds_1 ORA-600 KCLCHKBLK_4 ORA-15042 ORA-15196 ORACLE 12C oracle dul ORACLE PATCH Oracle Recovery Tools oracle加密恢复 oracle勒索 oracle勒索恢复 oracle异常恢复 Oracle 恢复 ORACLE恢复 ORACLE数据库恢复 oracle 比特币 OSD-04016 YOUR FILES ARE ENCRYPTED 勒索恢复 比特币加密文章分类
- Others (2)
- 中间件 (2)
- WebLogic (2)
- 操作系统 (103)
- 数据库 (1,770)
- DB2 (22)
- MySQL (77)
- Oracle (1,611)
- Data Guard (52)
- EXADATA (8)
- GoldenGate (24)
- ORA-xxxxx (166)
- ORACLE 12C (72)
- ORACLE 18C (6)
- ORACLE 19C (15)
- ORACLE 21C (3)
- Oracle 23ai (8)
- Oracle ASM (69)
- Oracle Bug (8)
- Oracle RAC (54)
- Oracle 安全 (6)
- Oracle 开发 (28)
- Oracle 监听 (29)
- Oracle备份恢复 (592)
- Oracle安装升级 (98)
- Oracle性能优化 (62)
- 专题索引 (5)
- 勒索恢复 (86)
- PostgreSQL (30)
- pdu工具 (6)
- PostgreSQL恢复 (9)
- SQL Server (32)
- SQL Server恢复 (13)
- TimesTen (7)
- 达梦数据库 (3)
- 达梦恢复 (1)
- 生活娱乐 (2)
- 至理名言 (11)
- 虚拟化 (2)
- VMware (2)
- 软件开发 (39)
- Asp.Net (9)
- JavaScript (12)
- PHP (2)
- 小工具 (22)
-
最近发表
- Oracle 19c 202507补丁(RUs+OJVM)-19.28
- 2025年的Oracle 8.0.5数据库恢复
- ORA-600 kokiasg1故障分析(obj$中核心字典序列全部被恶意删除)
- ORA-00756 ORA-10567故障数据0丢失恢复
- 数据库文件变成32k故障恢复
- tcp连接过多导致监听TNS-12532 TNS-12560 TNS-00502错误
- 文件系统格式化MySQL数据库恢复
- .sstop勒索加密数据库恢复
- 解决一次硬件恢复之后数据文件0kb的故障恢复case
- Error in invoking target ‘libasmclntsh19.ohso libasmperl19.ohso client_sharedlib’问题处理
- ORA-01171: datafile N going offline due to error advancing checkpoint
- linux环境oracle数据库被文件系统勒索加密为.babyk扩展名溯源
- ORA-600 ksvworkmsgalloc: bad reaper
- ORA-600 krccfl_chunk故障处理
- Oracle Recovery Tools恢复案例总结—202505
- ORA-600 kddummy_blkchk 数据库循环重启
- 记录一次asm disk加入到vg通过恢复直接open库的案例
- CHECKDB 发现了 N 个分配错误和 M 个一致性错误
- 达梦数据库dm.ctl文件异常恢复
- Oracle Recovery Tools修复ORA-00742、ORA-600 ktbair2: illegal inheritance故障
分类目录归档:Oracle
找出 alter system kill session ‘sid,serial#’ kill 掉的数据库会话对应进程
当我们使用alter system kill session ‘sid,serial#’ 在数据库中kill掉某个会话的时候,如果你观察仔细会发现v$session.paddr发生了改变,从而是的不能直接通过关联v$process.add找出spid,然后进行其他操作.本文提供三种方法找该种情况下spid的方法.
数据库版本
SQL> select * from v$version; BANNER ----------------------------------------------------------------------- Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - Production PL/SQL Release 11.2.0.3.0 - Production CORE 11.2.0.3.0 Production TNS for Linux: Version 11.2.0.3.0 - Production NLSRTL Version 11.2.0.3.0 - Production
会话1
SQL> select sid, SERIAL#,paddr from v$session where 2 sid=(select sid from v$mystat where rownum=1); SID SERIAL# PADDR ---------- ---------- -------- 133 53 35FE16F4
会话2
SQL> select sid, SERIAL#,paddr from v$session where 2 sid=(select sid from v$mystat where rownum=1); SID SERIAL# PADDR ---------- ---------- -------- 143 21 35FE2D3C
会话3
SQL> alter system kill session '133,53'; System altered. SQL> alter system kill session '143,21'; System altered. SQL> select sid, SERIAL#,paddr,status from v$session where sid in(133,143); SID SERIAL# PADDR STATUS ---------- ---------- -------- ---------------- 133 53 3547A3F4 KILLED 143 21 3547A3F4 KILLED
证明alter system kill session后,v$session中的paddr发生了改变,这个时候如果需要找出原来的spid,不能使用v$session.paddr和v$process.addr关联获得
找出kill掉的spid方法1
SQL> select spid, program from v$process 2 where program!= 'PSEUDO' 3 and addr not in (select paddr from v$session) 4 and addr not in (select paddr from v$bgprocess) 5 and addr not in (select paddr from v$shared_server); SPID PROGRAM ------------------------------------------------ ------------------------------ 14260 oracle@xifenfei (L001) 14256 oracle@xifenfei (L000) 15300 oracle@xifenfei (TNS V1-V3) 14179 oracle@xifenfei (D000) 15318 oracle@xifenfei (TNS V1-V3) 14252 oracle@xifenfei (N000) SQL> !ps -ef|grep 15300|grep -v grep oracle 15300 14052 0 03:22 ? 00:00:00 oracleora11g (DESCRIPTION=(LOCAL=YES)(ADDRESS=(PROTOCOL=beq))) SQL> !ps -ef|grep 15318|grep -v grep oracle 15318 15315 0 03:22 ? 00:00:00 oracleora11g (DESCRIPTION=(LOCAL=YES)(ADDRESS=(PROTOCOL=beq)))
找出kill 掉的spid 方法2
SQL> SELECT s.username,s.status, 2 x.ADDR,x.KSLLAPSC,x.KSLLAPSN,x.KSLLASPO,x.KSLLID1R,x.KSLLRTYP, 3 decode(bitand (x.ksuprflg,2),0,null,1) 4 FROM x$ksupr x,v$session s 5 WHERE s.paddr(+)=x.addr 6 and bitand(ksspaflg,1)!=0; USERNAME STATUS ADDR KSLLAPSC KSLLAPSN KSLLASPO KSLLID1R KSLL DE ---------- ---------------- -------- ---------- ---------- ------------------------ ---------- ---- -- ACTIVE 35FD5990 6 26 14121 0 1 ACTIVE 35FD6FD8 1 69 14055 0 1 ACTIVE 35FD8620 1 69 14055 0 1 ACTIVE 35FD9C68 1 69 14055 0 1 ACTIVE 35FDB2B0 8 27 15300 0 1 ACTIVE 35FDC8F8 12 36 15300 0 1 ACTIVE 35FDDF40 1 69 14055 0 1 ACTIVE 35FDF588 1 69 14055 0 1 ACTIVE 35FE3860 7 26 14236 0 1 ACTIVE 35FE4EA8 1 69 14224 0 1 ACTIVE 35FE64F0 63 2 14311 377 EV 1 ACTIVE 35FEA7C8 3 26 14155 258 EV 1 ACTIVE 35FE9180 59 2 14248 378 EV 1 ACTIVE 35FE9CA4 12 2 14603 0 1 ACTIVE 35FD64B4 1 69 14055 0 1 ACTIVE 35FD7AFC 2 27 14055 0 1 ACTIVE 35FD9144 2 27 15300 0 1 ACTIVE 35FDA78C 3 26 14171 0 1 ACTIVE 35FDBDD4 17 2 15255 0 1 ACTIVE 35FDD41C 22 26 14155 0 1 ACTIVE 35FDEA64 52 26 14155 0 1 ACTIVE 35FE4384 1 69 14224 0 1 ACTIVE 35FE59CC 1 69 14224 0 1 ACTIVE 35FEB2EC 2 2 14248 0 1 ACTIVE 35FEC934 11 26 14121 0 1 SYS ACTIVE 35FEF5C4 4 16 14117 0 35FE0BD0 1 69 14055 0 35FE865C 1 69 14117 0 35FE7B38 1 69 14117 0 35FE16F4 1 26 14155 0 35FD4E6C 0 0 0 35FE00AC 2 279 14117 0 35FE2D3C 0 0 0 35FE7014 2 335 14117 0 --挑选username和status为null的会话 SQL> select spid,program from v$process where addr in ( 2 '35FE0BD0', 3 '35FE865C', 4 '35FE7B38', 5 '35FE16F4', 6 '35FD4E6C', 7 '35FE00AC', 8 '35FE2D3C', 9 '35FE7014' 10 ); SPID PROGRAM ------------------------------------------------ ------------------------------ PSEUDO 14179 oracle@xifenfei (D000) 14183 oracle@xifenfei (S000) 15300 oracle@xifenfei (TNS V1-V3) 15318 oracle@xifenfei (TNS V1-V3) 14252 oracle@xifenfei (N000) 14256 oracle@xifenfei (L000) 14260 oracle@xifenfei (L001) 8 rows selected. --同样可以发现spid 15300和15318的进程已经在数据库中被kill掉
找出kill掉的spid方法3(11g特有)
SQL> select spid,program from v$process where addr in 2 (select creator_addr from v$session where sid in(133,143)); SPID PROGRAM ------------------------------------------------ ------------------------------ 15300 oracle@xifenfei (TNS V1-V3) 15318 oracle@xifenfei (TNS V1-V3)
找出kill掉的spid方法4(11g特有)
SQL> select * from V$DETACHED_SESSION; INDX PG_NAME SID SERIAL# PID ---------- ------------------------------------------------------------ ---------- ---------- ---------- 0 DEFAULT 143 21 21 1 DEFAULT 133 53 19 SQL> select spid,program from v$process where pid in(21,19); SPID PROGRAM ------------------------------------------------ ------------------------------ 15300 oracle@xifenfei (TNS V1-V3) 15318 oracle@xifenfei (TNS V1-V3)
ROW CACHE LOCK等待事件
ROW CACHE LOCK基础说明
ROW CACHE LOCK等待事件是一个共享池相关的等待事件。是由于对于字典缓冲的访问造成的。
P1 – Cache Id
P2 – Mode Held
P3 – Mode Requested
mode 和REQUEST的取值:
KQRMNULL 0 null mode – not locked
KQRMS 3 share mode
KQRMX 5 exclusive mode
KQRMFAIL 10 fail to acquire instance lock
如果是RAC/OPS环境,前台进程发出锁请求,LCK0进程发出锁请求。如果是单实例模式,由前台进程直接发出锁请求。
在RAC/OPS环境下,前台进程会循环等待锁的获取,最多会等待60秒钟。在单实例环境,前台进程会循环1000次,等待3秒钟。PMON进程无论在哪种模式,都会等待5秒钟。
要注意的是单实例模式下和多实例模式下申请该锁调用的模块是不同的(kqrget()- 单实例,kqgigt()- 多实例)。
如果发现这个等待十分高,一般来说可能由于2种原因,一是共享池太小了,需要增加共享池,另外一种情况是SQL分析过于频繁,对于共享池的并发访问量过大。对于任何一种情况,绝大多数情况下加大共享池会有助于降低该等待,不过加大共享池的时候也要注意,并不一定所有的情况下增加共享池都会有明显的效果,特别是对于第二种情况,精确的分析十分重要。另外进一步分析,弄清楚哪些ROW CACHE的等待最为严重,有助于解决问题。
SQL查询
--查询row cache lock等待 select * from v$session_wait where wait_class = 'row cache lock'; --查询rowcache 名称 select * from v$rowcache where cache# = &p1;
ENQUEUE TYPE
DC_TABLESPACES
Probably the most likely cause is the allocation of new extents. If extent sizes are set low then the application may constantly be requesting new extents and causing contention. Do you have objects with small extent sizes that are rapidly growing? (You may be able to spot these by looking for objects with large numbers of extents). Check the trace for insert/update activity, check the objects inserted into for number of extents.
DC_SEQUENCES
Check for appropriate caching of sequences for the application requirements.
DC_USERS
Deadlock and resulting “WAITED TOO LONG FOR A ROW CACHE ENQUEUE LOCK!” can occur if a session issues a GRANT to a user, and that user is in the process of logging on to the database.
DC_SEGMENTS
This is likely to be down to segment allocation. Identify what the session holding the enqueue is doing and use errorstacks to diagnose.
DB_ROLLBACK_SEGMENTS
This is due to rollback segment allocation. Just like dc_segments,identify what is holding the enqueue and also generate errorstacks. Remember that on a multi-node system (RAC) the holder may be on another node and so multiple systemstates from each node will be required.
DC_AWR_CONTROL
This enqueue is related to control of the Automatic Workload Repository. As such any operation manipulating the repository may hold this so look for processes blocking these.
Process OS id : xxxxx alive after kill
Process OS id : xxxxx alive after kill警告
Mon May 21 04:55:06 2012 Shutting down instance (immediate) License high water mark = 373 Mon May 21 04:55:06 2012 Stopping Job queue slave processes Mon May 21 04:55:06 2012 Job queue slave processes stopped All dispatchers and shared servers shutdown Mon May 21 04:55:14 2012 Process OS id : 9922 alive after kill Errors in file Mon May 21 04:55:16 2012 Process OS id : 8159 alive after kill Errors in file /oracle/admin/resultdb/udump/resultdb_ora_14639.trc Mon May 21 04:55:17 2012 Process OS id : 8285 alive after kill Errors in file /oracle/admin/resultdb/udump/resultdb_ora_14639.trc Mon May 21 04:55:33 2012 ALTER DATABASE CLOSE NORMAL
错误原因
On some platforms it takes some time to kill processes--AIX being one of those platforms There have been previous reports of shutdown taking time on AIX and after all Oracle waits were taken out of the picture it was determined to be due to the way the kill command is implemented on that platform. Bug 4931101 ERRORS IN ALERT LOG DURING SHUTDOWN
处理建议
Ignore the error as all processes will be closed and shutdown will complete successfully.
补充说明
本次出问题的数据库是运行在 linux 平台上的 10.2.0.3