oracle trace檔案解析

chance2000發表於2006-03-26
oracle trace檔案解析[@more@]

*** 2006-02-23 22:11:45.000
=====================
PARSING IN CURSOR #1 len=68 dep=0 uid=59 oct=42 lid=59 tim=12047812267 hv=570864185 ad='66bd0bc4'
alter session set events '10046 trace name context forever,level 12'
END OF STMT
EXEC #1:c=0,e=89,p=0,cr=0,cu=0,mis=0,r=0,dep=0,og=4,tim=12047812255
WAIT #1: nam='SQL*Net message to client' ela= 5 p1=1111838976 p2=1 p3=0
WAIT #1: nam='SQL*Net message from client' ela= 3350384 p1=1111838976 p2=1 p3=0
=====================
PARSING IN CURSOR #1 len=57 dep=0 uid=59 oct=3 lid=59 tim=12051164358 hv=1391558827 ad='66bfe7d8'
select count(*) from emp a,dept b where a.deptno=b.deptno
END OF STMT
PARSE #1:c=0,e=76,p=0,cr=0,cu=0,mis=0,r=0,dep=0,og=4,tim=12051164349
BINDS #1:
EXEC #1:c=0,e=192,p=0,cr=0,cu=0,mis=0,r=0,dep=0,og=4,tim=12051165308
WAIT #1: nam='SQL*Net message to client' ela= 7 p1=1111838976 p2=1 p3=0
FETCH #1:c=0,e=140,p=0,cr=5,cu=0,mis=0,r=1,dep=0,og=4,tim=12051165720
WAIT #1: nam='SQL*Net message from client' ela= 302 p1=1111838976 p2=1 p3=0
FETCH #1:c=0,e=4,p=0,cr=0,cu=0,mis=0,r=0,dep=0,og=0,tim=12051166486
WAIT #1: nam='SQL*Net message to client' ela= 4 p1=1111838976 p2=1 p3=0
WAIT #1: nam='SQL*Net message from client' ela= 3248265 p1=1111838976 p2=1 p3=0
STAT #1 id=1 cnt=1 pid=0 pos=1 obj=0 op='SORT AGGREGATE '
STAT #1 id=2 cnt=14 pid=1 pos=1 obj=0 op='NESTED LOOPS '
STAT #1 id=3 cnt=14 pid=2 pos=1 obj=30139 op='TABLE ACCESS FULL EMP '
STAT #1 id=4 cnt=14 pid=2 pos=2 obj=30138 op='INDEX UNIQUE SCAN PK_DEPT '
=====================
PARSING IN CURSOR #1 len=55 dep=0 uid=59 oct=42 lid=59 tim=12054418195 hv=3381932903 ad='66bd7b34'
alter session set events '10046 trace name context off'
END OF STMT
PARSE #1:c=15625,e=703,p=0,cr=0,cu=0,mis=0,r=0,dep=0,og=4,

tim=12054418182
BINDS #1:
EXEC #1:c=0,e=321,p=0,cr=0,cu=0,mis=0,r=0,dep=0,og=4,tim=12054419670

#######################################
PARSING IN CURSOR #1 len=68 dep=0 uid=59 oct=42 lid=59 tim=12047812267 hv=570864185 ad='66bd0bc4'
Cursor# 遊標號
len SQL語句的長度
dep SQL語句的遞迴深度
Uid 當前模式中的使用者ID
Oct Oracle命令型別
Lid 用於核對訪問許可權的使用者ID
Tim 一個計時器,精度以1%秒為單位
Ha SQL語句的雜湊ID號
Ad 指向SQL語句的V$SQLAREA的ADDR列


EXEC Cursor#:c=%d,e=%d,p=%d,cr=%d,cu=%d,mis=%d,r=%d,dep=%d,og=%d,tim=%d
EXEC #1:c=0,e=89,p=0,cr=0,cu=0,mis=0,r=0,dep=0,og=4,tim=12047812255
Cursor# 游標號
c 以1%秒為單位的CPU執行時間
e 以1%秒為單位的經過的時間
p 所執行的物理讀的數量
cr Consistent模式下的讀(邏輯輸入/輸出)
cu Current模式下的讀(邏輯輸入/輸出)
mis 丟失在資料庫快取中的遊標,指出由於它在資料共享區中老化,
或不在資料共享池裡,或其他造成無效的原因
r 處理的行數
dep SQL語句的遞迴深度
og 最佳化器目標,1=所有行,2=起始行,3=規則,4=選擇
tim 計時器,精度以1%秒為單位的時間


PARSE 分析一個語句
FETCH 從遊標中取出所需行時
UNMAP 用以從程式執行中間結果中釋放一些不再用到的臨時段
SORT UNMAP 和unmap類似,只不過用於排序段


WAIT Cursor#:nam='%s' ela=%d p1=%ul p2=%ul p3=%ul
WAIT #1: nam='SQL*Net message to client' ela= 5 p1=1111838976 p2=1 p3=0
WAIT #1: nam='SQL*Net message from client' ela= 3350384 p1=1111838976 p2=1 p3=0
Cursor# 遊標號
nam 等待事件的名稱。Oracle Server Reference中列出了全部等待事件,並有詳細解釋
ela 以1%秒為單位的事件經過的時間
p1,p2,p3 專門用於等待事件的引數。每一個事件都有它自己的一套引數。
參考Oracle Server Reference中關於特定等待事件的引數p1,p2,p3的含義


BINDS #4:
bind 0:dty=2 mxl=22(21) mal=00 scl=00 pre=00 oacflg=03 oacf12=1 size=24 offset=0
bfp=07425360 bln=22 avl=03 flg=05
value=7698
cursor # 遊標號
bind N 繫結位置,從0開始(0是第一個繫結變數)
dty 資料型別,dty資料型別的數字用USER_TAB_COLUMNS檢視的資訊來解碼
mxl 繫結變數的最大長度
mal 最大最組的長度(當用到陣列繫結變數或批操作時)
scl 比例
pre 精度
oacflg 內部標記,這個數字若是奇數,繫結變數就是空(允許有空值)
ocaf12 內部標記的擴充套件
size 緩衝區的大小
bfp 繫結地址
bln 繫結緩衝區的長度
avl 實際值的長度
flg 內部標記
value 繫結值的字串的表示(如果可能,是16進位制轉儲),這正是想要得到的

如何解析等待資源?
WAIT #4: nam='enqueue' ela=308 p1=1415053318 p2=393290 p3=2947
create or replace function enqueue_decode(l_p1 in number) return varchar2
as
l_str varchar2(25);
begin
select chr(bitand(l_p1,-16777216)/16777215) ||
chr(bitand(l_p1,16711680)/65535) || ' ' ||
decode(bitand(l_p1,65535),
0,'No lock',
1,'No lock',
2,'Row-Share',
3,'Row-Exclusive',
4,'Share',
5,'Share Row-Excl',
6,'Exclusive')
into l_str
from dual;
return l_str;
end;
/
select enqueue_decode(1415053318) from dual;


XCTEND rlbk=0,rd_only=0
rlbk 返回標記,0表示提交過了,1表示返回
rd_only 只讀標記,1表示事務是隻讀的,0可以進行改動,提交或返回


WAIT #0:nam='log file sync' ela=0 p1=988 p2=0 p3=0
STAT #4 id=1 cnt=1 pid=0 pos=0 obj=0 op='UPDATE EMP'
STAT #4 id=1 cnt=1 pid=1 pos=1 obj=24767 op='TABLE ACCESS FULL EMP'
cursor # 遊標號
id 解釋方案中的行,從1到該方案中的行數
cnt 透過查詢方案此階段的行數
pid 方案中這一步的父ID。用於以縮排恰當地反映方案的層次結構
pos 解釋方案中的位置
obj 可用情況下,引用物件的目標ID
op 已執行操作的原文描述


PARSE ERROR #3:len=15 dep=0 uid=69 oct=3 lid=69 tim=7160573 err=903
Cursor# 遊標號
len SQL語句的長度
dep SQL語句的遞迴深度
Uid 當前模式中的使用者ID
Oct Oracle命令型別
Lid 用於核對訪問許可權的使用者ID
Tim 一個計時器,精度以1%秒為單位
err ORA錯誤程式碼,可以執行如下方式得到錯誤的內容:
EXEC DBMS_OUTPUT.PUT_LINE(SQLERRM(-903));

來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/802415/viewspace-823026/,如需轉載,請註明出處,否則將追究法律責任。

相關文章