zoukankan      html  css  js  c++  java
  • 如何查询Oracle数据库事件(转)

    原文地址:http://www.juliandyke.com/Diagnostics/Events/Events.html#Introduction

    Oracle event的序号范围是从10000到10999。

    1. 列出所有数据库事件

    • 使用PL/SQL从数据库中查询数据库事件

    SET SERVEROUTPUT ON
    DECLARE
      err_msg VARCHAR2(120);
    BEGIN
      dbms_output.enable (1000000);
      FOR err_num IN 10000..10999
      LOOP
        err_msg := SQLERRM (-err_num);
        IF err_msg NOT LIKE '%Message '||err_num||' not found%' THEN
          dbms_output.put_line (err_msg);
        END IF;
      END LOOP;
    END;
    /

    • Unix系统上查看event message文件

    文件名称:$ORACLE_HOME/rdbms/mesg/oraus.msg

    • Unix使用shell脚本查看

    #/bin/sh

    event=10000               
    while [ $event -ne 10999 ]
    do                        
        event=`expr $event + 1`
        oerr ora $event       
    done

    2. 列出当前会话开启动的数据库事件

    SET SERVEROUTPUT ON                                           
    DECLARE                                                       
        l_level NUMBER;                                           
    BEGIN                                                         
        FOR l_event IN 10000..10999                               
        LOOP                                                      
            dbms_system.read_ev (l_event,l_level);                
            IF l_level > 0 THEN                                   
                dbms_output.put_line ('Event '||TO_CHAR (l_event)||' is set at level '||TO_CHAR (l_level));          
            END IF;                                               
        END LOOP;                                                 
    END;                                                          
    /

  • 相关阅读:
    P2207 Photo
    P1022 计算器的改良
    P1003 铺地毯
    P3014 [USACO11FEB]牛线Cow Line && 康托展开
    P4180 【模板】严格次小生成树[BJWC2010]
    P2776 [SDOI2007]小组队列
    P2426 删数
    P1948 [USACO08JAN]电话线Telephone Lines
    P1978 集合
    P1564 膜拜
  • 原文地址:https://www.cnblogs.com/cqubityj/p/2277509.html
Copyright © 2011-2022 走看看