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

  • 相关阅读:
    mysql 数据库集群连接配置
    tomcat server.xml 配置优化
    使用PowerDesigner16.5 逆向数据库生产表结构或导出word文档
    SpringBoot、thymeleaf 国际化配置
    解决 SpringBoot 跨域请求问题
    在 centos7 系统中用 docker 创建 tomcat 服务镜像
    JAVA 调用 com.google.protobuf
    登录后获取token,作为参数传入下一个操作
    通过二进制数据流方式上传图片及性能测试脚本编写
    信息服务(ISS)管理器之报错【"/"应用程序中的服务器错误。】
  • 原文地址:https://www.cnblogs.com/feiyun8616/p/14139753.html
Copyright © 2011-2022 走看看