模拟跟踪错误

  1. -- 创建测试表
  2. SQL> create table tab1 (id number(2,1));
  3. Table created.
  4. SQL> var n number
  5. SQL> exec :n := 100.2
  6. PL/SQL procedure successfully completed.
  7. -- 模拟错误
  8. SQL> insert into tab1 values(:n);
  9. insert into tab1 values(:n)
  10. *
  11. ERROR at line 1:
  12. ORA-01438: value larger than specified precision allowed for this column
  13. -- 实例级别 监控1438错误
  14. SQL> alter system set events '1438 trace name errorstack forever,level 3';
  15. System altered.
  16. -- 会话级别 监控1438错误
  17. -- alter session set events='1438 trace name errorstack forever,level 3';
  18. SQL> insert into tab1 values(:n);
  19. insert into tab1 values(:n)
  20. *
  21. ERROR at line 1:
  22. ORA-01438: value larger than specified precision allowed for this column
  23. -- 跟踪到以后,记得关闭trace,否则可能生成大量日志,撑爆空间
  24. SQL> alter system set events '1438 trace name errorstack off';
  25. System altered.

trace文件通用解读办法

也适用于系统dump出来的trace文件等等

  1. vi /u01/app/oracle/diag/rdbms/orcl/orcl/trace/orcl_ora_9070.trc
  2. *** 2021-04-14 15:10:58.345
  3. *** SESSION ID:(125.397) 2021-04-14 15:10:58.345
  4. *** CLIENT ID:() 2021-04-14 15:10:58.345
  5. *** SERVICE NAME:(SYS$USERS) 2021-04-14 15:10:58.345
  6. *** MODULE NAME:(sqlplus@orcl (TNS V1-V3)) 2021-04-14 15:10:58.345
  7. *** ACTION NAME:() 2021-04-14 15:10:58.345
  8. dbkedDefDump(): Starting a non-incident diagnostic dump (flags=0x0, level=3, mask=0x0)
  9. ----- Error Stack Dump -----
  10. ORA-01438: value larger than specified precision allowed for this column
  11. # 执行的sql
  12. ----- Current SQL Statement for this session (sql_id=cby8j6hhr5mky) -----
  13. insert into tab1 values(:n)
  14. # 堆栈信息:
  15. ----- Call Stack Trace -----
  16. calling call entry argument values in hex
  17. location type point (? means dubious value)
  18. -------------------- -------- -------------------- ----------------------------
  19. *** 2021-04-14 15:10:58.860
  20. skdstdst()+41 call kgdsdst() 000000000 ? 000000000 ?
  21. 7FFC7ABE0C90 ? 7FFC7ABE0D68 ?
  22. 7FFC7ABE5810 ? 000000002 ?
  23. ksedst1()+103 call skdstdst() 000000000 ? 000000000 ?
  24. 7FFC7ABE0C90 ? 7FFC7ABE0D68 ?
  25. 7FFC7ABE5810 ? 000000002 ?
  26. ksedst()+39 call ksedst1() 000000000 ? 000000001 ?
  27. 7FFC7ABE0C90 ? 7FFC7ABE0D68 ?
  28. 7FFC7ABE5810 ? 000000002 ?
  29. dbkedDefDump()+2746 call ksedst() 000000000 ? 000000001 ?
  30. 7FFC7ABE0C90 ? 7FFC7ABE0D68 ?
  31. 7FFC7ABE5810 ? 000000002 ?
  32. ksedmp()+41 call dbkedDefDump() 000000003 ? 000000000 ?
  33. 7FFC7ABE0C90 ? 7FFC7ABE0D68 ?
  34. 7FFC7ABE5810 ? 000000002 ?
  35. dbkdaKsdActDriver() call ksedmp() 000000003 ? 000000000 ?
  36. +1960 7FFC7ABE0C90 ? 7FFC7ABE0D68 ?
  37. 7FFC7ABE5810 ? 000000002 ?
  38. dbgdaExecuteAction( call dbkdaKsdActDriver() 7FEAE431C730 ? 7FFC7ABE7F10 ?
  39. )+1065 7FFC7ABE0C90 ? 7FFC7ABE0D68 ?
  40. 7FFC7ABE5810 ? 000000002 ?
  41. dbgdaRunAction()+81 call dbgdaExecuteAction( 7FEAE431C730 ? 00A6006E0 ?
  42. 5 ) 0020C0003 ? 7FFC7ABE7F10 ?
  43. 000000001 ? 000000002 ?
  44. # 绑定变量信息
  45. ----- Bind Info (kkscoacd) -----
  46. Bind#0
  47. oacdty=02 mxl=22(22) mxlc=00 mal=00 scl=00 pre=00
  48. oacflg=03 fl2=1000000 frm=00 csi=00 siz=24 off=0
  49. kxsbbbfp=7feae3c68cb8 bln=22 avl=04 flg=05
  50. value=100.2
  51. Frames pfr 0x7feae3d7e108 siz=3152 efr 0x7feae3d7e040 siz=3096
  52. Cursor frame dump
  53. # 执行计划
  54. ============
  55. Plan Table
  56. ============
  57. --------------------------------------------+-----------------------------------+
  58. | Id | Operation | Name | Rows | Bytes | Cost | Time |
  59. --------------------------------------------+-----------------------------------+
  60. | 0 | INSERT STATEMENT | | | | 1 | |
  61. | 1 | LOAD TABLE CONVENTIONAL | | | | | |
  62. --------------------------------------------+-----------------------------------+
  63. # 等待事件和历史等待事件
  64. Current Wait Stack:
  65. Not in wait; last wait ended 2.081502 sec ago
  66. Wait State:
  67. fixed_waits=0 flags=0x21 boundary=(nil)/-1
  68. Session Wait History:
  69. elapsed time of 2.087036 sec since last wait
  70. 0: waited for 'SQL*Net message from client'
  71. driver id=0x62657100, #bytes=0x1, =0x0
  72. wait_id=40 seq_num=41 snap_id=1
  73. wait times: snap=3.795465 sec, exc=3.795465 sec, total=3.795465 sec
  74. wait times: max=infinite
  75. wait counts: calls=0 os=0
  76. occurred after 0.000031 sec of elapsed time
  77. 1: waited for 'SQL*Net message to client'
  78. driver id=0x62657100, #bytes=0x1, =0x0
  79. wait_id=39 seq_num=40 snap_id=1
  80. wait times: snap=0.000001 sec, exc=0.000001 sec, total=0.000001 sec
  81. wait times: max=infinite
  82. wait counts: calls=0 os=0
  83. occurred after 0.000004 sec of elapsed time
  84. 2: waited for 'SQL*Net break/reset to client'