学习动态性能表(13)
[font=宋体]本视图列出[/font][font=Times New Roman]session[/font][font=宋体]打开的所有[/font][font=Times New Roman]cursors[/font][font=宋体],很多时候都将被用到,比如:你可以通过它查看各个[/font][font=Times New Roman]session[/font][font=宋体]打开的[/font][font=Times New Roman]cursor[/font][font=宋体]数。[/font][font=Times New Roman] [/font]
[font=宋体] 当诊断系统资源占用时,它常被用于联接[/font][font=Times New Roman]v$sqlarea[/font][font=宋体]和[/font][font=Times New Roman]v$sql[/font][font=宋体]查询出特定[/font][font=Times New Roman]SQL([/font][font=宋体]高逻辑或物理[/font][font=Times New Roman]I/O)[/font][font=宋体]。然后,下一步就是找出源头。在应用环境,基本都是同一类用户登陆到数据库[/font][font=Times New Roman]([/font][font=宋体]在[/font][font=Times New Roman]V$SQLAREA[/font][font=宋体]中拥有相同的[/font][font=Times New Roman]PARSING_USER_ID)[/font][font=宋体],而通过这个就可以找出它们的不同。[/font][font=Times New Roman]V$SQLAREA[/font][font=宋体]中的统计项在语句完全执行后被更新[/font][font=Times New Roman]([/font][font=宋体]并且从[/font][font=Times New Roman]V$SESSION.SQL_HASH_VALUE[/font][font=宋体]中消失[/font][font=Times New Roman])[/font][font=宋体]。因此,你不能直接找到[/font][font=Times New Roman]session[/font][font=宋体]除非语句被再次执行。不过如果[/font][font=Times New Roman]session[/font][font=宋体]的[/font][font=Times New Roman]cursor[/font][font=宋体]仍然打开着,你可以通过[/font][font=Times New Roman]v$open_cursor[/font][font=宋体]找出执行这个语句的[/font][font=Times New Roman]session[/font][font=宋体]。[/font]
[font=Times New Roman] [/font]
[b][font=Times New Roman]V$OPEN_CURSOR[/font][/b][b][font=宋体]中的连接列[/font][/b]
[b][font=Times New Roman] [/font][/b]
[b][font=Times New Roman]Column
View
Joined Column(s) [/font][/b]
[font=Times New Roman]-----------------------------
----------------------------------------
-----------------------------[/font]
[size=9pt][font=Times New Roman]HASH_VALUE, ADDRESS
V$SQLAREA, V$SQL, V$SQLTEXT
HASH_VALUE, ADDRESS[/font][/size]
[size=9pt][font=Times New Roman]SID
V$SESSION
SID[/font][/size]
[font=Times New Roman] [/font]
[b][font=宋体]示例:[/font][/b]
[b][font=Times New Roman]1.[/font][/b][b][font=宋体]找出执行某语句的[/font][font=Times New Roman]session[/font][/b][b][font=宋体]:[/font][/b]
[font=Times New Roman]SELECT hash_value, buffer_gets, disk_reads [/font]
[font=Times New Roman]FROM V$SQLAREA[/font]
[font=Times New Roman]WHERE disk_reads > 1000000 [/font]
[font=Times New Roman]ORDER BY buffer_gets DESC;[/font]
[font=Times New Roman] [/font]
[font=Times New Roman]HASH_VALUE BUFFER_GETS DISK_READS[/font]
[font=Times New Roman]---------- ----------- ----------[/font]
[font=Times New Roman]1514306888
177649108
3897402[/font]
[font=Times New Roman]
478652562
63168944
2532721[/font]
[font=Times New Roman]
360282550
14158750
2482065[/font]
[font=Times New Roman] [/font]
页:
[1]