WEB开发网
开发学院数据库Oracle 11G访问DBA_OBJECTS和V$LOCK视图时HANG住 阅读

11G访问DBA_OBJECTS和V$LOCK视图时HANG住

 2008-08-28 12:43:35 来源:WEB开发网   
核心提示: 似乎并不是常见的Oracle将VIEW进行MERGE导致的执行计划效率低的问题,从现有的执行计划上看,11G访问DBA_OBJECTS和V$LOCK视图时HANG住(2),两个视图并没有被MERGE, 不过从统计信息上看,发现也比较有意思,前后出现了gc cr request、latch

似乎并不是常见的Oracle将VIEW进行MERGE导致的执行计划效率低的问题,从现有的执行计划上看,两个视图并没有被MERGE。

不过从统计信息上看,就存在很大问题了,这么简单的一个查询怎么会导致了7万多的db block gets呢。

而且在这个会话的执行过程中,检查了会话的等待时间,发现也比较有意思,前后出现了gc cr request、latch free、db file sequential read等多种等待事件。

而如果改变一下SQL语句的写法,直接写成关联的方式:

   SQL>SELECTOWNER,OBJECT_NAMEFROMDBA_OBJECTS,V$LOCK
  2WHEREOBJECT_ID=ID1
  3ANDSID=305;
  OWNEROBJECT_NAME
  ------------------------------------------------------------
  SYSORA$BASE
  TESTT_PARALLEL
  已用时间:00:00:00.44
  执行计划
  ----------------------------------------------------------
  Planhashvalue:3416262628
  ---------------------------------------------------------------------------------------------------
  |Id|Operation|Name|Rows|Bytes|Cost(%CPU)|Time|
  ---------------------------------------------------------------------------------------------------
  |0|SELECTSTATEMENT||1|159|182(5)|00:00:03|
  |*1|HASHJOIN||1|159|182(5)|00:00:03|
  |2|NESTEDLOOPS||1|63|1(100)|00:00:01|
  |*3|HASHJOIN||1|44|1(100)|00:00:01|
  |*4|FIXEDTABLEFULL|X$KSUSE|1|32|0(0)|00:00:01|
  |5|VIEW|GV$_LOCK|10|120|0(0)|00:00:01|
  |6|UNION-ALL||||||
  |*7|FILTER||||||
  |8|VIEW|GV$_LOCK1|2|152|0(0)|00:00:01|
  |9|UNION-ALL||||||
  |*10|FIXEDTABLEFULL|X$KDNSSF|1|102|0(0)|00:00:01|
  |*11|FIXEDTABLEFULL|X$KSQEQ|1|102|0(0)|00:00:01|
  |*12|FIXEDTABLEFULL|X$KTADM|1|102|0(0)|00:00:01|
  |*13|FIXEDTABLEFULL|X$KTATRFIL|1|102|0(0)|00:00:01|
  |*14|FIXEDTABLEFULL|X$KTATRFSL|1|102|0(0)|00:00:01|
  |*15|FIXEDTABLEFULL|X$KTATL|1|102|0(0)|00:00:01|
  |*16|FIXEDTABLEFULL|X$KTSTUSC|1|102|0(0)|00:00:01|
  |*17|FIXEDTABLEFULL|X$KTSTUSS|1|102|0(0)|00:00:01|
  |*18|FIXEDTABLEFULL|X$KTSTUSG|1|102|0(0)|00:00:01|
  |*19|FIXEDTABLEFULL|X$KTCXB|1|102|0(0)|00:00:01|
  |*20|FIXEDTABLEFIXEDINDEX|X$KSQRS(ind:1)|1|19|0(0)|00:00:01|
  |21|VIEW|DBA_OBJECTS|65980|6185K|181(5)|00:00:03|
  |22|UNION-ALL||||||
  |*23|FILTER||||||
  |*24|HASHJOIN||71138|8475K|178(5)|00:00:03|
  |25|TABLEACCESSFULL|USER$|87|1479|3(0)|00:00:01|
  |*26|HASHJOIN||71138|7294K|174(5)|00:00:03|
  |27|INDEXFULLSCAN|I_USER2|87|2001|1(0)|00:00:01|
  |*28|TABLEACCESSFULL|OBJ$|71138|5696K|172(4)|00:00:03|
  |*29|TABLEACCESSBYINDEXROWID|IND$|1|8|2(0)|00:00:01|
  |*30|INDEXUNIQUESCAN|I_IND1|1||1(0)|00:00:01|
  |31|NESTEDLOOPS||1|28|2(0)|00:00:01|
  |*32|INDEXFULLSCAN|I_USER2|1|20|1(0)|00:00:01|
  |*33|INDEXRANGESCAN|I_OBJ4|1|8|1(0)|00:00:01|
  |34|NESTEDLOOPS||2|86|3(0)|00:00:01|
  |35|INDEXFULLSCAN|I_LINK1|2|52|1(0)|00:00:01|
  |36|TABLEACCESSCLUSTER|USER$|1|17|1(0)|00:00:01|
  |*37|INDEXUNIQUESCAN|I_USER#|1||0(0)|00:00:01|
  ---------------------------------------------------------------------------------------------------
  PredicateInformation(identifiedbyoperationid):
  ---------------------------------------------------
  1-access("OBJECT_ID"="R"."KSQRSID1")
  3-access("SADDR"="S"."ADDR")
  4-filter("S"."KSUSENUM"=305AND"S"."INST_ID"=USERENV('INSTANCE'))
  7-filter(USERENV('INSTANCE')ISNOTNULL)
  10-filter(("KSQLKMOD"<>0OR"KSQLKREQ"<>0)AND"INST_ID"=USERENV('INSTANCE')AND
  BITAND("KSSOBFLG",1)<>0)
  11-filter(("KSQLKMOD"<>0OR"KSQLKREQ"<>0)AND"INST_ID"=USERENV('INSTANCE')AND
  BITAND("KSSOBFLG",1)<>0)
  12-filter(("KSQLKMOD"<>0OR"KSQLKREQ"<>0)AND"INST_ID"=USERENV('INSTANCE')AND
  BITAND("KSSOBFLG",1)<>0)
  13-filter(("KSQLKMOD"<>0OR"KSQLKREQ"<>0)AND"INST_ID"=USERENV('INSTANCE')AND
  BITAND("KSSOBFLG",1)<>0)
  14-filter(("KSQLKMOD"<>0OR"KSQLKREQ"<>0)AND"INST_ID"=USERENV('INSTANCE')AND
  BITAND("KSSOBFLG",1)<>0)
  15-filter(("KSQLKMOD"<>0OR"KSQLKREQ"<>0)AND"INST_ID"=USERENV('INSTANCE')AND
  BITAND("KSSOBFLG",1)<>0)
  16-filter(("KSQLKMOD"<>0OR"KSQLKREQ"<>0)AND"INST_ID"=USERENV('INSTANCE')AND
  BITAND("KSSOBFLG",1)<>0)
  17-filter(("KSQLKMOD"<>0OR"KSQLKREQ"<>0)AND"INST_ID"=USERENV('INSTANCE')AND
  BITAND("KSSOBFLG",1)<>0)
  18-filter(("KSQLKMOD"<>0OR"KSQLKREQ"<>0)AND"INST_ID"=USERENV('INSTANCE')AND
  BITAND("KSSOBFLG",1)<>0)
  19-filter(("KSQLKMOD"<>0OR"KSQLKREQ"<>0)AND"INST_ID"=USERENV('INSTANCE')AND
  BITAND("KSSPAFLG",1)<>0)
  20-filter("RADDR"="R"."ADDR")
  23-filter(("O"."TYPE#"<>1AND"O"."TYPE#"<>10OR"O"."TYPE#"=1AND(SELECT1FROM
  "SYS"."IND$""I"WHERE"I"."OBJ#"=:B1AND("I"."TYPE#"=1OR"I"."TYPE#"=2OR"I"."TYPE#"=3
  OR"I"."TYPE#"=4OR"I"."TYPE#"=6OR"I"."TYPE#"=7OR"I"."TYPE#"=9))=1)AND
  ("O"."TYPE#"<>4AND"O"."TYPE#"<>5AND"O"."TYPE#"<>7AND"O"."TYPE#"<>8AND
  "O"."TYPE#"<>9AND"O"."TYPE#"<>10AND"O"."TYPE#"<>11AND"O"."TYPE#"<>12AND
  "O"."TYPE#"<>13AND"O"."TYPE#"<>14AND"O"."TYPE#"<>22AND"O"."TYPE#"<>87AND
  "O"."TYPE#"<>88ORBITAND("U"."SPARE1",16)=0OR("O"."TYPE#"=4OR"O"."TYPE#"=5OR
  "O"."TYPE#"=7OR"O"."TYPE#"=8OR"O"."TYPE#"=9OR"O"."TYPE#"=10OR"O"."TYPE#"=11OR
  "O"."TYPE#"=12OR"O"."TYPE#"=13OR"O"."TYPE#"=14OR"O"."TYPE#"=22OR"O"."TYPE#"=87)
  AND(SYS_CONTEXT('userenv','current_edition_name')='ORA$BASE'AND"U"."TYPE#"<>2OR
  "U"."TYPE#"=2AND"U"."SPARE2"=TO_NUMBER(SYS_CONTEXT('userenv','current_edition_id'))OR
  EXISTS(SELECT0FROMSYS."USER$""U2",SYS."OBJ$""O2"WHERE"O2"."OWNER#"="U2"."USER#"
  AND"O2"."TYPE#"=88AND"O2"."DATAOBJ#"=:B2AND"U2"."TYPE#"=2AND
  "U2"."SPARE2"=TO_NUMBER(SYS_CONTEXT('userenv','current_edition_id'))))))
  24-access("O"."SPARE3"="U"."USER#")
  26-access("O"."OWNER#"="U"."USER#")
  28-filter("O"."NAME"<>'_NEXT_OBJECT'AND"O"."NAME"<>'_default_auditing_options_'AND
  "O"."LINKNAME"ISNULLANDBITAND("O"."FLAGS",128)=0)
  29-filter("I"."TYPE#"=1OR"I"."TYPE#"=2OR"I"."TYPE#"=3OR"I"."TYPE#"=4OR
  "I"."TYPE#"=6OR"I"."TYPE#"=7OR"I"."TYPE#"=9)
  30-access("I"."OBJ#"=:B1)
  32-access("U2"."TYPE#"=2AND"U2"."SPARE2"=TO_NUMBER(SYS_CONTEXT('userenv','current_edi
  tion_id')))
  filter("U2"."TYPE#"=2AND"U2"."SPARE2"=TO_NUMBER(SYS_CONTEXT('userenv','current_edi
  tion_id')))
  33-access("O2"."DATAOBJ#"=:B1AND"O2"."TYPE#"=88AND"O2"."OWNER#"="U2"."USER#")
  37-access("L"."OWNER#"="U"."USER#")
  统计信息
  ----------------------------------------------------------
  15recursivecalls
  3dbblockgets
  977consistentgets
  0physicalreads
  0redosize
  667bytessentviaSQL*Nettoclient
  520bytesreceivedviaSQL*Netfromclient
  2SQL*Netroundtripsto/fromclient
  0sorts(memory)
  0sorts(disk)
  2rowsprocessed

Tags:访问 DBA OBJECTS

编辑录入:爽爽 [复制链接] [打 印]
赞助商链接