elmah oracle

1.

   <sectionGroup name="elmah">
      <section name="security" requirePermission="false" type="Elmah.SecuritySectionHandler, Elmah" />
      <section name="errorLog" requirePermission="false" type="Elmah.ErrorLogSectionHandler, Elmah" />
      <section name="errorMail" requirePermission="false" type="Elmah.ErrorMailSectionHandler, Elmah" />
      <section name="errorFilter" requirePermission="false" type="Elmah.ErrorFilterSectionHandler, Elmah" />
    </sectionGroup>
2.
  <httpModules>
      <add name="ErrorLog" type="Elmah.ErrorLogModule, Elmah" />
      <add name="ErrorMail" type="Elmah.ErrorMailModule, Elmah" />
      <add name="ErrorFilter" type="Elmah.ErrorFilterModule, Elmah" />
    </httpModules>
3.
   <modules runAllManagedModulesForAllRequests="true">
      <add name="ErrorLog" type="Elmah.ErrorLogModule, Elmah" preCondition="managedHandler" />
      <add name="ErrorMail" type="Elmah.ErrorMailModule, Elmah" preCondition="managedHandler" />
      <add name="ErrorFilter" type="Elmah.ErrorFilterModule, Elmah" preCondition="managedHandler" />
    </modules>
4.
 <elmah>
    <!--
        See http://code.google.com/p/elmah/wiki/SecuringErrorLogPages for
        more information on remote access and securing ELMAH.
    -->
    <security allowRemoteAccess="false" />
    <errorLog type="Elmah.OracleErrorLog, Elmah" connectionStringName="elmah-oracle" schemaOwner="" />
  </elmah>
  <location path="elmah.axd" inheritInChildApplications="false">
    <system.web>
      <httpHandlers>
        <add verb="POST,GET,HEAD" path="elmah.axd" type="Elmah.ErrorLogPageFactory, Elmah" />
      </httpHandlers>
      <!--
        See http://code.google.com/p/elmah/wiki/SecuringErrorLogPages for
        more information on using ASP.NET authorization securing ELMAH.

      <authorization>
        <allow roles="admin" />
        <deny users="*" />
      </authorization>
      -->
    </system.web>
    <system.webServer>
      <handlers>
        <add name="ELMAH" verb="POST,GET,HEAD" path="elmah.axd" type="Elmah.ErrorLogPageFactory, Elmah" preCondition="integratedMode" />
      </handlers>
    </system.webServer>
  </location>
5.
  <connectionStrings>
    <!-- TODO: Replace the ****‘s with the correct entries -->     <add name="elmah-oracle" connectionString="Data Source=****;User ID=****;Password=****;" />
  </connectionStrings>
6.oracle脚本
/*

   ELMAH - Error Logging Modules and Handlers for ASP.NET
   Copyright (c) 2004-9 Atif Aziz. All rights reserved.

    Author(s):

      James Driscoll, mailto:[email protected]

   Licensed under the Apache License, Version 2.0 (the "License");
   you may not use this file except in compliance with the License.
   You may obtain a copy of the License at

      http://www.apache.org/licenses/LICENSE-2.0

   Unless required by applicable law or agreed to in writing, software
   distributed under the License is distributed on an "AS IS" BASIS,
   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   See the License for the specific language governing permissions and
   limitations under the License.

*/

-- $Id: Oracle.sql 568 2009-05-11 14:18:34Z azizatif $

-- NB This script assumes you have logged on in the schema where you want to create the ELMAH objects

-- create a sequence for the errors (user to simulate an identity in SQL Server)
CREATE SEQUENCE elmah$error_seq START WITH 1 INCREMENT BY 1 NOMAXVALUE NOCYCLE NOCACHE NOORDER;

-- create the table to store the data
-- you can optionally specify tablespaces here too!
CREATE TABLE elmah$error
(
    -- if using Oracle 10g and above you can add DEFAULT SYS_GUID()
    -- to the errorid definition.
    -- Oracle 8i doesn‘t like it with an NVARCHAR2
    -- haven‘t tested it against 9i
    errorid         NVARCHAR2(32) NOT NULL,
    application     NVARCHAR2(60) NOT NULL,
    host            NVARCHAR2(30) NOT NULL,
    type            NVARCHAR2(100) NOT NULL,
    source          NVARCHAR2(60),
    message         NVARCHAR2(500) NOT NULL,
    username        NVARCHAR2(50),
    statuscode      NUMBER NOT NULL,
    timeutc         DATE NOT NULL,
    sequencenumber  NUMBER NOT NULL,
    allxml          NCLOB NOT NULL,
    CONSTRAINT idx_elmah$error_pk
        PRIMARY KEY (errorid)
        USING INDEX -- TABLESPACE "TABLESPACE FOR INDEX"
) -- TABLESPACE "TABLESPACE FOR DATA"
/

-- trigger to make sure we get our sequence number in the table
CREATE TRIGGER trg_elmah$error_bi
BEFORE INSERT ON elmah$error
FOR EACH ROW
BEGIN
    SELECT elmah$error_seq.NEXTVAL INTO :new.sequencenumber FROM dual;
END trg_elmah$error_bi;
/

-- create the index on the table
CREATE INDEX idx_elmah$error_app_time_seq ON elmah$error(application, timeutc DESC, sequencenumber DESC)
/

-- package containing the procedure we need for ELMAH to log errors
CREATE OR REPLACE PACKAGE pkg_elmah$log_error
IS
    PROCEDURE LogError
    (
        v_ErrorId IN elmah$error.errorid%TYPE,
        v_Application IN elmah$error.application%TYPE,
        v_Host IN elmah$error.host%TYPE,
        v_Type IN elmah$error.type%TYPE,
        v_Source IN elmah$error.source%TYPE,
        v_Message IN elmah$error.message%TYPE,
        v_User IN elmah$error.username%TYPE,
        v_AllXml IN elmah$error.allxml%TYPE,
        v_StatusCode IN elmah$error.statuscode%TYPE,
        v_TimeUtc IN elmah$error.timeutc%TYPE
    );

END pkg_elmah$log_error;
/

CREATE OR REPLACE PACKAGE BODY pkg_elmah$log_error
IS
    PROCEDURE LogError
    (
        v_ErrorId IN elmah$error.errorid%TYPE,
        v_Application IN elmah$error.application%TYPE,
        v_Host IN elmah$error.host%TYPE,
        v_Type IN elmah$error.type%TYPE,
        v_Source IN elmah$error.source%TYPE,
        v_Message IN elmah$error.message%TYPE,
        v_User IN elmah$error.username%TYPE,
        v_AllXml IN elmah$error.allxml%TYPE,
        v_StatusCode IN elmah$error.statuscode%TYPE,
        v_TimeUtc IN elmah$error.timeutc%TYPE
    )
    IS
    BEGIN
        INSERT INTO elmah$error
            (
                errorid,
                application,
                host,
                type,
                source,
                message,
                username,
                allxml,
                statuscode,
                timeutc
            )
        VALUES
            (
                UPPER(v_ErrorId),
                v_Application,
                v_Host,
                v_Type,
                v_Source,
                v_Message,
                v_User,
                v_AllXml,
                v_StatusCode,
                v_TimeUtc
            );

    END LogError;   

END pkg_elmah$log_error;
/

-- package containing the procedure we need for ELMAH to retrieve errors
CREATE OR REPLACE PACKAGE pkg_elmah$get_error
IS
        -- NB this is for backwards compatibility with Oracle 8i
    TYPE t_cursor IS REF CURSOR;

    PROCEDURE GetErrorXml
    (
        v_Application IN elmah$error.application%TYPE,
        v_ErrorId IN elmah$error.errorid%TYPE,
        v_AllXml OUT elmah$error.allxml%TYPE
    );

    PROCEDURE GetErrorsXml
    (
        v_Application IN elmah$error.application%TYPE,
        v_PageIndex IN NUMBER DEFAULT 0,
        v_PageSize IN NUMBER DEFAULT 15,
        v_TotalCount OUT NUMBER,
        v_Results OUT t_cursor
    );

END pkg_elmah$get_error;
/

CREATE OR REPLACE PACKAGE BODY pkg_elmah$get_error
IS
    PROCEDURE GetErrorXml
    (
        v_Application IN elmah$error.application%TYPE,
        v_ErrorId IN elmah$error.errorid%TYPE,
        v_AllXml OUT elmah$error.allxml%TYPE
    )
    IS
    BEGIN
        SELECT  allxml
        INTO    v_AllXml
        FROM    elmah$error
        WHERE   errorid = UPPER(v_ErrorId)
        AND     application = v_Application;
    EXCEPTION
        WHEN NO_DATA_FOUND THEN
            v_AllXml := NULL;
    END GetErrorXml;

    PROCEDURE GetErrorsXml
    (
        v_Application IN elmah$error.application%TYPE,
        v_PageIndex IN NUMBER DEFAULT 0,
        v_PageSize IN NUMBER DEFAULT 15,
        v_TotalCount OUT NUMBER,
        v_Results OUT t_cursor
    )
    IS
        l_StartRowIndex NUMBER;
        l_EndRowIndex   NUMBER;
    BEGIN
        -- Get the ID of the first error for the requested page
        l_StartRowIndex := v_PageIndex * v_PageSize + 1;
        l_EndRowIndex := l_StartRowIndex + v_PageSize - 1;

        -- find out how many rows we‘ve got in total
        SELECT  COUNT(*)
        INTO    v_TotalCount
        FROM    elmah$error
        WHERE   application = v_Application;

        OPEN v_Results FOR
            SELECT  *
            FROM
            (
                SELECT  e.*,
                        ROWNUM row_number
                FROM
                (
                    SELECT  /*+ INDEX(elmah$error, idx_elmah$error_app_time_seq) */
                            errorid,
                            application,
                            host,
                            type,
                            source,
                            message,
                            username,
                            statuscode,
                            timeutc
                    FROM    elmah$error
                    WHERE   application = v_Application
                    ORDER BY
                            timeutc DESC,
                            sequencenumber DESC
                ) e
                WHERE ROWNUM <= l_EndRowIndex
            )
            WHERE   row_number >= l_StartRowIndex;

    END GetErrorsXml;

END pkg_elmah$get_error;
/

/*
-- If you are securing the packages above, you will need to grant execute
-- privileges on them so that they can be called by the user connecting to the database.
-- NB As long as you use the schema owner for the connection string, this is not necessary,
-- although this is generally discouraged by Best Practices.

-- Option 1) Allow any user to execute the package (not recommended)
-- replace OWNER for the schema owner in the following statement
GRANT EXECUTE ON OWNER.pkg_elmah$log_error TO PUBLIC;
GRANT EXECUTE ON OWNER.pkg_elmah$get_error TO PUBLIC;

-- Option 2) Allow a single user to execute the package (better)
-- replace OWNER for the schema owner in the following statement
GRANT EXECUTE ON OWNER.pkg_elmah$log_error TO USER_NAME;
GRANT EXECUTE ON OWNER.pkg_elmah$get_error TO USER_NAME;

-- Option 3) Lock things down so that one user can only log errors, while another user can read and log errors (most secure)
-- replace OWNER for the schema owner in the following statement
-- LOGGING_USER_NAME will be used to connect to the database in all sites which log errors to the database
GRANT EXECUTE ON OWNER.pkg_elmah$log_error TO LOGGING_USER_NAME;
-- ADMIN_USER_NAME will be used to connect to the database in an admin portal which allows users to read errors
GRANT EXECUTE ON OWNER.pkg_elmah$log_error TO ADMIN_USER_NAME;
GRANT EXECUTE ON OWNER.pkg_elmah$get_error TO ADMIN_USER_NAME;

-- NB if you do take this approach, be sure to set the schemaOwner parameter in your web.config
*/

Oracle创建表脚本
时间: 2024-10-05 14:50:53

elmah oracle的相关文章

利用Elmah和Google体验一把入侵的快感

介绍 关于ELMAH,相信大家都不陌生了,最流行的错误日志记录组件,用过的人都知道其强大的威力,可以记录非常详细的错误信息供管理员和开发人员进行分析.Elmah配置起来也非常简单,但是同时也带来了一个问题:那就是如果配置不好的话,就会被入侵,而且入侵的方法非常非常简单,本文我讲演示一下,如何利用Elmah错误信息和Google搜索来入侵一个站点,同时本文也提供了正确的Elmah配置方法. 注1:本人目的是让大家正确配置ELMAH,不是教大家入侵哦,入侵有风险,实施需谨慎 注2:在这里,我要澄清一

【工具推荐】ELMAH——可插拔错误日志工具

ELMAH 是 Error Logging Modules and Handlers for ASP.NET 的缩写.ELMAH可以让你记录下你的网站发生的任何一个错误,在将来,你可以重新检查这些错误.你可以从ELMAH项目的官方网站免费下载ELMAH:http://code.google.com/p/elmah/. ELMAH既支持ASP.NET Web Forms 又支持 ASP.NET MVC.你可以对ELMAH进行配置来存储各种不同的错误(XML文件,事件日志,Access数据库,SQL

elmah - Error Logging Modules and Handlers for ASP.NET - 1 : 初体验

elmah(英文):https://code.google.com/p/elmah/ 写作思路:先看结果,然后再说原理 elmah文章基本内容如下 1.安装 2.基本使用 3.详细配置讲解 简介 ELMAH是一个开源项目,其目的是记录和报告在ASP.NET Web应用程序未处理的异常. 早在2004年9月与Atif阿齐兹和斯科特·米切尔发表在MSDN Library,其目的是作为一个概念证明,编写自包含的功能与ASP.NET HTTP模块和处理程序是绝对有可能的,大多有这种特征可能是一篇文章插入

MVC使用 Elmah 日志记录组件

简介 ELMAH(Error Logging Modules and Handlers)错误日志记录模块和处理程序,是一种应用广泛的错误日志工具是完全可插拔.它可以动态添加到一个正在运行的ASP.NET Web应用程序,甚至是一台机器上的所有ASP.NET Web应用程序,而无需重新编译或重新部署. ELMAH既支持ASP.NET Web Forms 又支持 ASP.NET MVC.你可以对ELMAH进行配置来存储各种不同的错误(XML文件,事件日志,Access数据库,SQL数据库,Oracl

Elmah 日志记录组件

[http://www.cnblogs.com/chenkai/archive/2013/01/26/2877855.html] 常在服务器端处理用户请求时.特别是针对Web应用程序.当出现异常是可以根据日志操作记录还原异常出现时操作步骤.而记录异常堆栈信息判断问题出现问题位置. 为了跟踪和记录服务器行为.特别是针对出现异常时构建简单.统一的异常处理模式就显得尤为重要. 如果有一个基础的架构用来记录服务器端中日志和事件.那么对于调试和在问题的解决就变得更加简单直接.针对日志记录.可能针对大部分开

oracle安装故障:完美解决xhost +报错: unable to open display “”

oracle安装 先切换到root用户,执行xhost + 然后再切换到oracle用户,执行export DISPLAY=:0.0 出现乱码执行export LANG=US_en 在这里给大家介绍下两种情况的常见问题: 一种是本地运行的命令,另一种则是远程ssh命令安装. DISPLAY科普 DISPLAY变量是用来设置将图形显示到何处.比如CENTOS,你用图形界面登录进去,DISPLAY自动设置为DISPLAY=:0.0表示显式到本地监视器,那么通过终端工具(例如:xshell)进去,运行

Sqlserver通过链接服务器访问Oracle的解决办法

转自http://blog.sina.com.cn/s/blog_614b6f210100t80r.html 一.创建sqlserver链接服务(sqlserver链接oracle)  首先sqlserver 链接oracle可以通过两个访问接口: “MSDAORA” 和“OraOLEDB.Oracle” 1.“MSDAORA”访问接口是由Microsoft OLE DB Provider for Oracle提供的,这里建议不使用此接口进行链接.通过该访问接口建立的链接服务器在进行查询orac

win7 64位系统 PB连接oracle数据库出现“oracle library oci.dll could not be loaded”问题的解决方法

今天与大家分享一个自己的学习笔记,希望能给遇到同样问题的人带来帮助. 不知道大家在win7 64位系统下用 PB连接oracle数据库时,是否遇到过“oracle library oci.dll could not be loaded”问题. 今天,在win7 64位系统下用 PB连接oracle数据库时,一直出现上述错误,在百度上找了很久,都没有找到一个完整的解决方案,咨询了很多人,(他们都说是我的PB和oracle没装好,但我装的时候没出现任何问题,一切都很顺利,而且PB和oracle都能正

Oracle 10g通过创建物化视图实现不同数据库间表级别的数据同步

摘自:http://blog.csdn.net/javaee_sunny/article/details/53439980 目录(?)[-] Oracle 10g 物化视图语法如下 实例演示 主要步骤 在A节点创建原表和物化视图日志 在B节点创建连接A节点的远程链接 在B节点处创建目标表和与目标表名称相同的物化视图 在B节点处刷新物化视图 升级采用存储过程定时任务JOB方式定时刷新物化视图 进一步优化 文章更新记录 参考文章 Oracle 10g 物化视图语法如下: create materia