zoukankan      html  css  js  c++  java
  • 转 Trace a specific ORA- error

    #感谢Vincent Fenoll,

    Trace a specific ORA- error

    How to trace a specific ORA- error that is raised and can be reproduced?
    We want to find the complete Oracle stack to understand the origin of this error.

    For example, I want to understand why datapump expdp/impdp raises:
    ORA-01422: exact fetch returns more than requested number of rows

    This time, the alert file is not very helpful.

    To determine the root cause, event 1422 can be set as follows:

    connect /as sysdba 
    alter system set events '1422 trace name ERRORSTACK level 3'; 

    […reproduce the issue…]

    The event can be turned off again using:

    connect /as sysdba

    alter system set events '1422 trace name ERRORSTACK off';

    In the event 1422 trace file, below sql query was causing error.

    *** ACTION NAME:(Select sys_context into variable) 2017-01-27 14:15:24.257
    *** MODULE NAME:(Trigger DDL_AUDIT) 2017-01-27 14:15:24.257
    *** SERVICE NAME:(SYS$USERS) 2017-01-27 14:15:24.257
    *** SESSION ID:(3265.22843) 2017-01-27 14:15:24.257
    *** 2017-01-27 14:15:24.257
    ksedmp: internal or fatal error
    ORA-01422: exact fetch returns more than requested number of rows
    Current SQL statement for this session:
    SELECT UPPER(OSUSER), PROGRAM, MODULE, CLIENT_INFO FROM V$SESSION WHERE AUDSID = SYS_CONTEXT(‘userenv’, ‘SESSIONID’)

    Of course, it’s easier to locate the target module if you have already instrumented your code with DBMS_APPLICATION_INFO.SET_MODULE and DBMS_APPLICATION_INFO.SET_ACTION;

    In this case, the problem was due to SYS_CONTEXT(‘USERENV’,’SESSIONID’) returning 2 rows causing the ORA-01422 and subsequent datapump failure.

    The workaround of this specific problem is to disable the Trigger DDL_AUDIT.
    A solution is to modify the cursor or the statement in the trigger to retreive just one row, for example:
    SELECT UPPER(OSUSER), PROGRAM, MODULE, CLIENT_INFO FROM V$SESSION
    WHERE AUDSID = SYS_CONTEXT(‘userenv’, ‘SESSIONID’) and rownum=1;
    Another solution is to trap error with an excveption clause.

     
    Author: Vincent Fenoll, Oracle DBA Montreal

    Trace a specific ORA- error

    How to trace a specific ORA- error that is raised and can be reproduced?
    We want to find the complete Oracle stack to understand the origin of this error.

    For example, I want to understand why datapump expdp/impdp raises:
    ORA-01422: exact fetch returns more than requested number of rows

    This time, the alert file is not very helpful.

    To determine the root cause, event 1422 can be set as follows:

    connect /as sysdba 
    alter system set events '1422 trace name ERRORSTACK level 3'; 

    […reproduce the issue…]

    The event can be turned off again using:

    connect /as sysdba

    alter system set events '1422 trace name ERRORSTACK off';

    In the event 1422 trace file, below sql query was causing error.

    *** ACTION NAME:(Select sys_context into variable) 2017-01-27 14:15:24.257
    *** MODULE NAME:(Trigger DDL_AUDIT) 2017-01-27 14:15:24.257
    *** SERVICE NAME:(SYS$USERS) 2017-01-27 14:15:24.257
    *** SESSION ID:(3265.22843) 2017-01-27 14:15:24.257
    *** 2017-01-27 14:15:24.257
    ksedmp: internal or fatal error
    ORA-01422: exact fetch returns more than requested number of rows
    Current SQL statement for this session:
    SELECT UPPER(OSUSER), PROGRAM, MODULE, CLIENT_INFO FROM V$SESSION WHERE AUDSID = SYS_CONTEXT(‘userenv’, ‘SESSIONID’)

    Of course, it’s easier to locate the target module if you have already instrumented your code with DBMS_APPLICATION_INFO.SET_MODULE and DBMS_APPLICATION_INFO.SET_ACTION;

    In this case, the problem was due to SYS_CONTEXT(‘USERENV’,’SESSIONID’) returning 2 rows causing the ORA-01422 and subsequent datapump failure.

    The workaround of this specific problem is to disable the Trigger DDL_AUDIT.
    A solution is to modify the cursor or the statement in the trigger to retreive just one row, for example:
    SELECT UPPER(OSUSER), PROGRAM, MODULE, CLIENT_INFO FROM V$SESSION
    WHERE AUDSID = SYS_CONTEXT(‘userenv’, ‘SESSIONID’) and rownum=1;
    Another solution is to trap error with an excveption clause.

     
    Author: Vincent Fenoll, Oracle DBA Montreal

  • 相关阅读:
    java int转byte数组
    业务网关-操作手册
    业务网关-配置
    H2数据库的导入、导出(CSV)
    sequelize踩坑处理:时间格式化
    引入koa-static处理静态资源
    MySql利用case when实现批量更新多条记录的不同值实现方法
    Sequelize增删改查及批量新增或批量更新(bulkCreate的updateOnDuplicate)等常用接口
    数据结构队列、双端队列、队列系算法题解析
    配置webpack中externals来减少打包后vendor.js的体积
  • 原文地址:https://www.cnblogs.com/feiyun8616/p/14139753.html
Copyright © 2011-2022 走看看