|
实验条件:
比较简单,一个内存256MB的PC上同时跑了LINUX,WINDOWS.ORACLE数据库在LINUX下.给数据库的内存总共只有几十MB.测试用的test表也是一个简单表,记录数1048576.
SQL> alter session set events '10046 trace name context forever,level 12';
Session altered.
SQL> declare
cursor cur_test is select * from test order by 1,2,3;
cur_row cur_test%rowtype;
t1 number;
t2 number;
t3 number;
begin
dbms_lock.sleep(10);
--t1:=dbms_utility.get_time;
--dbms_output.put_line('t1='||t1);
open cur_test;
dbms_lock.sleep(10);
fetch cur_test into cur_row;
dbms_lock.sleep(10);
loop
fetch cur_test into cur_row;
exit when cur_test%notfound;
end loop ;
close cur_test;
--t2:=dbms_utility.get_time;
--dbms_output.put_line('t2='||t2);
end;
/ 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
PL/SQL procedure successfully completed.
SQL> alter session set events '10046 trace name context off';
生成的trace文件很大(70-80MB)
下面是部分内容
PARSE #1:c=13672,e=557575,p=0,cr=0,cu=0,mis=1,r=0,dep=0,og=4,tim=1053790833956291
BINDS #1:
*** 2004-03-12 16:57:04.323
WAIT #1: nam='PL/SQL lock timer' ela= 9999061 p1=1000 p2=0 p3=0 ------------------!!!
=====================
PARSING IN CURSOR #3 len=48 dep=2 uid=0 oct=3 lid=0 tim=1053790844474988 hv=1005331575 ad='507acaf8'
select user# from sys.user$ where name = 'OUTLN'
END OF STMT
PARSE #3:c=1953,e=372694,p=0,cr=0,cu=0,mis=1,r=0,dep=2,og=4,tim=1053790844474959
BINDS #3:
EXEC #3:c=0,e=83,p=0,cr=0,cu=0,mis=0,r=0,dep=2,og=4,tim=1053790844475206
FETCH #3:c=1953,e=65486,p=0,cr=2,cu=0,mis=0,r=1,dep=2,og=4,tim=1053790844540718
STAT #3 id=1 cnt=1 pid=0 pos=1 obj=22 op='TABLE ACCESS BY INDEX ROWID USER$ '
STAT #3 id=2 cnt=1 pid=1 pos=1 obj=44 op='INDEX UNIQUE SCAN I_USER1 '
=====================
PARSING IN CURSOR #2 len=39 dep=1 uid=22 oct=3 lid=22 tim=1053790844548496 hv=3822992111 ad='507a9238'
SELECT * from test order by 1,2,3
END OF STMT
PARSE #2:c=3906,e=482033,p=0,cr=2,cu=0,mis=0,r=0,dep=1,og=4,tim=1053790844548489
BINDS #2:
EXEC #2:c=0,e=8997,p=0,cr=0,cu=0,mis=0,r=0,dep=1,og=4,tim=1053790844557551
*** 2004-03-12 16:57:15.379
WAIT #1: nam='PL/SQL lock timer' ela= 10305422 p1=1000 p2=0 p3=0 ------------------!!!
*** 2004-03-12 16:58:00.162
WAIT #2: nam='db file sequential read' ela= 353621 p1=3 p2=440 p3=1
WAIT #2: nam='db file scattered read' ela= 496244 p1=3 p2=442 p3=7
WAIT #2: nam='db file scattered read' ela= 253 p1=3 p2=449 p3=8
WAIT #2: nam='db file scattered read' ela= 48647 p1=3 p2=457 p3=8
...
WAIT #2: nam='direct path write' ela= 9 p1=201 p2=633 p3=7
WAIT #2: nam='direct path write' ela= 1 p1=201 p2=640 p3=7
WAIT #2: nam='direct path write' ela= 1 p1=201 p2=647 p3=2
...
WAIT #2: nam='direct path read' ela= 13 p1=201 p2=1615 p3=7
FETCH #2:c=3124999,e=194548919,p=18004,cr=7619,cu=158,mis=0,r=1,dep=1,og=4,tim=1053791049412204
*** 2004-03-12 17:00:48.207
WAIT #1: nam='PL/SQL lock timer' ela= 10038125 p1=1000 p2=0 p3=0 ----------------!!!
FETCH #2:c=0,e=40,p=0,cr=0,cu=0,mis=0,r=1,dep=1,og=4,tim=1053791062730732
FETCH #2:c=0,e=4,p=0,cr=0,cu=0,mis=0,r=1,dep=1,og=4,tim=1053791062730857
FETCH #2:c=0,e=3,p=0,cr=0,cu=0,mis=0,r=1,dep=1,og=4,tim=1053791062730886
FETCH #2:c=0,e=3,p=0,cr=0,cu=0,mis=0,r=1,dep=1,og=4,tim=1053791062730916
FETCH #2:c=0,e=3,p=0,cr=0,cu=0,mis=0,r=1,dep=1,og=4,tim=1053791062730945
FETCH #2:c=0,e=3,p=0,cr=0,cu=0,mis=0,r=1,dep=1,og=4,tim=1053791062730974
FETCH #2:c=0,e=2,p=0,cr=0,cu=0,mis=0,r=1,dep=1,og=4,tim=1053791062731002
FETCH #2:c=0,e=3,p=0,cr=0,cu=0,mis=0,r=1,dep=1,og=4,tim=1053791062731031
FETCH #2:c=0,e=3,p=0,cr=0,cu=0,mis=0,r=1,dep=1,og=4,tim=1053791062731060
...
FETCH #2:c=0,e=3,p=0,cr=0,cu=0,mis=0,r=1,dep=1,og=4,tim=1053791120763847
FETCH #2:c=0,e=2,p=0,cr=0,cu=0,mis=0,r=1,dep=1,og=4,tim=1053791120763876
FETCH #2:c=0,e=3,p=0,cr=0,cu=0,mis=0,r=1,dep=1,og=4,tim=1053791120763905
...
FETCH #2:c=0,e=4,p=0,cr=0,cu=0,mis=0,r=1,dep=1,og=4,tim=1053791127682258
FETCH #2:c=3907,e=2600198,p=0,cr=0,cu=0,mis=0,r=0,dep=1,og=4,tim=1053791130282483
EXEC #1:c=37083984,e=297216323,p=21525,cr=7621,cu=158,mis=0,r=1,dep=0,og=4,tim=1053791131172830
WAIT #1: nam='SQL*Net message to client' ela= 155339 p1=1650815232 p2=1 p3=0
*** 2004-03-12 17:09:50.202
WAIT #1: nam='SQL*Net message from client' ela= 458945383 p1=1650815232 p2=1 p3=0
STAT #2 id=1 cnt=1048576 pid=0 pos=1 obj=0 op='SORT ORDER BY '
STAT #2 id=2 cnt=1048576 pid=1 pos=1 obj=5947 op='TABLE ACCESS FULL TEST '
=====================
PARSING IN CURSOR #1 len=60 dep=0 uid=22 oct=42 lid=22 tim=1053791594973790 hv=2622962732 ad='50768e78'
alter session set events '10046 trace name context off'
END OF STMT
PARSE #1:c=1953,e=460605,p=0,cr=0,cu=0,mis=0,r=0,dep=0,og=4,tim=1053791594973773
BINDS #1:
EXEC #1:c=1953,e=1063909,p=0,cr=0,cu=0,mis=0,r=0,dep=0,og=4,tim=1053791596037806 |
|