1. v$session_wait中的莫名sid
duck_11 > select distinct sid from v$session_event minus select distinct sid from v$session;
SID
----------
14
26
30
139
146
147
151
152
8 rows selected.
select distinct sid from v$session_wait_history minus select distinct sid from v$session
no rows selected
WHY? v$session_event中的不也是活动的session吗?这些不存在于v$session的sid是什么?
select distinct sid from v$session_wait_history minus select distinct sid from v$session肯定不返回行,因为v$session_wait_history就是从v$session取的,隔1秒取一次,保持10次的数据,
对于第一个问题,你可以通过下面的SQL语句看一下到底是什么进程
select spid from v$session t1,v$process t2 where t1.paddr = t2.addr and t1.sid=<多出来的SID>,然后根据spid到OS中查看是什么进程,也许是僵尸进程;
对于第二个问题,我的理解是v$latch的addr是一个bucket的地址,而v$latch_children则是这个bucket上每个handle的地址
select latch#,count(addr) from v$latch_children group by latch# order by latch#;