原文: https://www.yuque.com/wei01/rlggh6/she282
模拟跟踪错误
-- 创建测试表
SQL> create table tab1 (id number(2,1));
Table created.
SQL> var n number
SQL> exec :n := 100.2
PL/SQL procedure successfully completed.
-- 模拟错误
SQL> insert into tab1 values(:n);
insert into tab1 values(:n)
*
ERROR at line 1:
ORA-01438: value larger than specified precision allowed for this column
-- 实例级别 监控1438错误
SQL> alter system set events '1438 trace name errorstack forever,level 3';
System altered.
-- 会话级别 监控1438错误
-- alter session set events='1438 trace name errorstack forever,level 3';
SQL> insert into tab1 values(:n);
insert into tab1 values(:n)
*
ERROR at line 1:
ORA-01438: value larger than specified precision allowed for this column
-- 跟踪到以后,记得关闭trace,否则可能生成大量日志,撑爆空间
SQL> alter system set events '1438 trace name errorstack off';
System altered.
trace文件通用解读办法
也适用于系统dump出来的trace文件等等
vi /u01/app/oracle/diag/rdbms/orcl/orcl/trace/orcl_ora_9070.trc
*** 2021-04-14 15:10:58.345
*** SESSION ID:(125.397) 2021-04-14 15:10:58.345
*** CLIENT ID:() 2021-04-14 15:10:58.345
*** SERVICE NAME:(SYS$USERS) 2021-04-14 15:10:58.345
*** MODULE NAME:(sqlplus@orcl (TNS V1-V3)) 2021-04-14 15:10:58.345
*** ACTION NAME:() 2021-04-14 15:10:58.345
dbkedDefDump(): Starting a non-incident diagnostic dump (flags=0x0, level=3, mask=0x0)
----- Error Stack Dump -----
ORA-01438: value larger than specified precision allowed for this column
# 执行的sql
----- Current SQL Statement for this session (sql_id=cby8j6hhr5mky) -----
insert into tab1 values(:n)
# 堆栈信息:
----- Call Stack Trace -----
calling call entry argument values in hex
location type point (? means dubious value)
-------------------- -------- -------------------- ----------------------------
*** 2021-04-14 15:10:58.860
skdstdst()+41 call kgdsdst() 000000000 ? 000000000 ?
7FFC7ABE0C90 ? 7FFC7ABE0D68 ?
7FFC7ABE5810 ? 000000002 ?
ksedst1()+103 call skdstdst() 000000000 ? 000000000 ?
7FFC7ABE0C90 ? 7FFC7ABE0D68 ?
7FFC7ABE5810 ? 000000002 ?
ksedst()+39 call ksedst1() 000000000 ? 000000001 ?
7FFC7ABE0C90 ? 7FFC7ABE0D68 ?
7FFC7ABE5810 ? 000000002 ?
dbkedDefDump()+2746 call ksedst() 000000000 ? 000000001 ?
7FFC7ABE0C90 ? 7FFC7ABE0D68 ?
7FFC7ABE5810 ? 000000002 ?
ksedmp()+41 call dbkedDefDump() 000000003 ? 000000000 ?
7FFC7ABE0C90 ? 7FFC7ABE0D68 ?
7FFC7ABE5810 ? 000000002 ?
dbkdaKsdActDriver() call ksedmp() 000000003 ? 000000000 ?
+1960 7FFC7ABE0C90 ? 7FFC7ABE0D68 ?
7FFC7ABE5810 ? 000000002 ?
dbgdaExecuteAction( call dbkdaKsdActDriver() 7FEAE431C730 ? 7FFC7ABE7F10 ?
)+1065 7FFC7ABE0C90 ? 7FFC7ABE0D68 ?
7FFC7ABE5810 ? 000000002 ?
dbgdaRunAction()+81 call dbgdaExecuteAction( 7FEAE431C730 ? 00A6006E0 ?
5 ) 0020C0003 ? 7FFC7ABE7F10 ?
000000001 ? 000000002 ?
# 绑定变量信息
----- Bind Info (kkscoacd) -----
Bind#0
oacdty=02 mxl=22(22) mxlc=00 mal=00 scl=00 pre=00
oacflg=03 fl2=1000000 frm=00 csi=00 siz=24 off=0
kxsbbbfp=7feae3c68cb8 bln=22 avl=04 flg=05
value=100.2
Frames pfr 0x7feae3d7e108 siz=3152 efr 0x7feae3d7e040 siz=3096
Cursor frame dump
# 执行计划
============
Plan Table
============
--------------------------------------------+-----------------------------------+
| Id | Operation | Name | Rows | Bytes | Cost | Time |
--------------------------------------------+-----------------------------------+
| 0 | INSERT STATEMENT | | | | 1 | |
| 1 | LOAD TABLE CONVENTIONAL | | | | | |
--------------------------------------------+-----------------------------------+
# 等待事件和历史等待事件
Current Wait Stack:
Not in wait; last wait ended 2.081502 sec ago
Wait State:
fixed_waits=0 flags=0x21 boundary=(nil)/-1
Session Wait History:
elapsed time of 2.087036 sec since last wait
0: waited for 'SQL*Net message from client'
driver id=0x62657100, #bytes=0x1, =0x0
wait_id=40 seq_num=41 snap_id=1
wait times: snap=3.795465 sec, exc=3.795465 sec, total=3.795465 sec
wait times: max=infinite
wait counts: calls=0 os=0
occurred after 0.000031 sec of elapsed time
1: waited for 'SQL*Net message to client'
driver id=0x62657100, #bytes=0x1, =0x0
wait_id=39 seq_num=40 snap_id=1
wait times: snap=0.000001 sec, exc=0.000001 sec, total=0.000001 sec
wait times: max=infinite
wait counts: calls=0 os=0
occurred after 0.000004 sec of elapsed time
2: waited for 'SQL*Net break/reset to client'