1. .
  2.  
  3. <sectionGroup name="elmah">
  4. <section name="security" requirePermission="false" type="Elmah.SecuritySectionHandler, Elmah" />
  5. <section name="errorLog" requirePermission="false" type="Elmah.ErrorLogSectionHandler, Elmah" />
  6. <section name="errorMail" requirePermission="false" type="Elmah.ErrorMailSectionHandler, Elmah" />
  7. <section name="errorFilter" requirePermission="false" type="Elmah.ErrorFilterSectionHandler, Elmah" />
  8. </sectionGroup>
  9. .
  10. <httpModules>
  11. <add name="ErrorLog" type="Elmah.ErrorLogModule, Elmah" />
  12. <add name="ErrorMail" type="Elmah.ErrorMailModule, Elmah" />
  13. <add name="ErrorFilter" type="Elmah.ErrorFilterModule, Elmah" />
  14. </httpModules>
  15. .
  16. <modules runAllManagedModulesForAllRequests="true">
  17. <add name="ErrorLog" type="Elmah.ErrorLogModule, Elmah" preCondition="managedHandler" />
  18. <add name="ErrorMail" type="Elmah.ErrorMailModule, Elmah" preCondition="managedHandler" />
  19. <add name="ErrorFilter" type="Elmah.ErrorFilterModule, Elmah" preCondition="managedHandler" />
  20. </modules>
  21. .
  22. <elmah>
  23. <!--
  24. See http://code.google.com/p/elmah/wiki/SecuringErrorLogPages for
  25. more information on remote access and securing ELMAH.
  26. -->
  27. <security allowRemoteAccess="false" />
  28. <errorLog type="Elmah.OracleErrorLog, Elmah" connectionStringName="elmah-oracle" schemaOwner="" />
  29. </elmah>
  30. <location path="elmah.axd" inheritInChildApplications="false">
  31. <system.web>
  32. <httpHandlers>
  33. <add verb="POST,GET,HEAD" path="elmah.axd" type="Elmah.ErrorLogPageFactory, Elmah" />
  34. </httpHandlers>
  35. <!--
  36. See http://code.google.com/p/elmah/wiki/SecuringErrorLogPages for
  37. more information on using ASP.NET authorization securing ELMAH.
  38.  
  39. <authorization>
  40. <allow roles="admin" />
  41. <deny users="*" />
  42. </authorization>
  43. -->
  44. </system.web>
  45. <system.webServer>
  46. <handlers>
  47. <add name="ELMAH" verb="POST,GET,HEAD" path="elmah.axd" type="Elmah.ErrorLogPageFactory, Elmah" preCondition="integratedMode" />
  48. </handlers>
  49. </system.webServer>
  50. </location>
  51. .
  52. <connectionStrings>
  53. <!-- TODO: Replace the ****'s with the correct entries --> <add name="elmah-oracle" connectionString="Data Source=****;User ID=****;Password=****;" />
  54. </connectionStrings>
  55. .oracle脚本
  56. /*
  57.  
  58. ELMAH - Error Logging Modules and Handlers for ASP.NET
  59. Copyright (c) 2004-9 Atif Aziz. All rights reserved.
  60.  
  61. Author(s):
  62.  
  63. James Driscoll, mailto:jamesdriscoll@btinternet.com
  64.  
  65. Licensed under the Apache License, Version 2.0 (the "License");
  66. you may not use this file except in compliance with the License.
  67. You may obtain a copy of the License at
  68.  
  69. http://www.apache.org/licenses/LICENSE-2.0
  70.  
  71. Unless required by applicable law or agreed to in writing, software
  72. distributed under the License is distributed on an "AS IS" BASIS,
  73. WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  74. See the License for the specific language governing permissions and
  75. limitations under the License.
  76.  
  77. */
  78.  
  79. -- $Id: Oracle.sql -- ::34Z azizatif $
  80.  
  81. -- NB This script assumes you have logged on in the schema where you want to create the ELMAH objects
  82.  
  83. -- create a sequence for the errors (user to simulate an identity in SQL Server)
  84. CREATE SEQUENCE elmah$error_seq START WITH INCREMENT BY NOMAXVALUE NOCYCLE NOCACHE NOORDER;
  85.  
  86. -- create the table to store the data
  87. -- you can optionally specify tablespaces here too!
  88. CREATE TABLE elmah$error
  89. (
  90. -- if using Oracle 10g and above you can add DEFAULT SYS_GUID()
  91. -- to the errorid definition.
  92. -- Oracle 8i doesn't like it with an NVARCHAR2
  93. -- haven't tested it against 9i
  94. errorid NVARCHAR2() NOT NULL,
  95. application NVARCHAR2() NOT NULL,
  96. host NVARCHAR2() NOT NULL,
  97. type NVARCHAR2() NOT NULL,
  98. source NVARCHAR2(),
  99. message NVARCHAR2() NOT NULL,
  100. username NVARCHAR2(),
  101. statuscode NUMBER NOT NULL,
  102. timeutc DATE NOT NULL,
  103. sequencenumber NUMBER NOT NULL,
  104. allxml NCLOB NOT NULL,
  105. CONSTRAINT idx_elmah$error_pk
  106. PRIMARY KEY (errorid)
  107. USING INDEX -- TABLESPACE "TABLESPACE FOR INDEX"
  108. ) -- TABLESPACE "TABLESPACE FOR DATA"
  109. /
  110.  
  111. -- trigger to make sure we get our sequence number in the table
  112. CREATE TRIGGER trg_elmah$error_bi
  113. BEFORE INSERT ON elmah$error
  114. FOR EACH ROW
  115. BEGIN
  116. SELECT elmah$error_seq.NEXTVAL INTO :new.sequencenumber FROM dual;
  117. END trg_elmah$error_bi;
  118. /
  119.  
  120. -- create the index on the table
  121. CREATE INDEX idx_elmah$error_app_time_seq ON elmah$error(application, timeutc DESC, sequencenumber DESC)
  122. /
  123.  
  124. -- package containing the procedure we need for ELMAH to log errors
  125. CREATE OR REPLACE PACKAGE pkg_elmah$log_error
  126. IS
  127. PROCEDURE LogError
  128. (
  129. v_ErrorId IN elmah$error.errorid%TYPE,
  130. v_Application IN elmah$error.application%TYPE,
  131. v_Host IN elmah$error.host%TYPE,
  132. v_Type IN elmah$error.type%TYPE,
  133. v_Source IN elmah$error.source%TYPE,
  134. v_Message IN elmah$error.message%TYPE,
  135. v_User IN elmah$error.username%TYPE,
  136. v_AllXml IN elmah$error.allxml%TYPE,
  137. v_StatusCode IN elmah$error.statuscode%TYPE,
  138. v_TimeUtc IN elmah$error.timeutc%TYPE
  139. );
  140.  
  141. END pkg_elmah$log_error;
  142. /
  143.  
  144. CREATE OR REPLACE PACKAGE BODY pkg_elmah$log_error
  145. IS
  146. PROCEDURE LogError
  147. (
  148. v_ErrorId IN elmah$error.errorid%TYPE,
  149. v_Application IN elmah$error.application%TYPE,
  150. v_Host IN elmah$error.host%TYPE,
  151. v_Type IN elmah$error.type%TYPE,
  152. v_Source IN elmah$error.source%TYPE,
  153. v_Message IN elmah$error.message%TYPE,
  154. v_User IN elmah$error.username%TYPE,
  155. v_AllXml IN elmah$error.allxml%TYPE,
  156. v_StatusCode IN elmah$error.statuscode%TYPE,
  157. v_TimeUtc IN elmah$error.timeutc%TYPE
  158. )
  159. IS
  160. BEGIN
  161. INSERT INTO elmah$error
  162. (
  163. errorid,
  164. application,
  165. host,
  166. type,
  167. source,
  168. message,
  169. username,
  170. allxml,
  171. statuscode,
  172. timeutc
  173. )
  174. VALUES
  175. (
  176. UPPER(v_ErrorId),
  177. v_Application,
  178. v_Host,
  179. v_Type,
  180. v_Source,
  181. v_Message,
  182. v_User,
  183. v_AllXml,
  184. v_StatusCode,
  185. v_TimeUtc
  186. );
  187.  
  188. END LogError;
  189.  
  190. END pkg_elmah$log_error;
  191. /
  192.  
  193. -- package containing the procedure we need for ELMAH to retrieve errors
  194. CREATE OR REPLACE PACKAGE pkg_elmah$get_error
  195. IS
  196. -- NB this is for backwards compatibility with Oracle 8i
  197. TYPE t_cursor IS REF CURSOR;
  198.  
  199. PROCEDURE GetErrorXml
  200. (
  201. v_Application IN elmah$error.application%TYPE,
  202. v_ErrorId IN elmah$error.errorid%TYPE,
  203. v_AllXml OUT elmah$error.allxml%TYPE
  204. );
  205.  
  206. PROCEDURE GetErrorsXml
  207. (
  208. v_Application IN elmah$error.application%TYPE,
  209. v_PageIndex IN NUMBER DEFAULT ,
  210. v_PageSize IN NUMBER DEFAULT ,
  211. v_TotalCount OUT NUMBER,
  212. v_Results OUT t_cursor
  213. );
  214.  
  215. END pkg_elmah$get_error;
  216. /
  217.  
  218. CREATE OR REPLACE PACKAGE BODY pkg_elmah$get_error
  219. IS
  220. PROCEDURE GetErrorXml
  221. (
  222. v_Application IN elmah$error.application%TYPE,
  223. v_ErrorId IN elmah$error.errorid%TYPE,
  224. v_AllXml OUT elmah$error.allxml%TYPE
  225. )
  226. IS
  227. BEGIN
  228. SELECT allxml
  229. INTO v_AllXml
  230. FROM elmah$error
  231. WHERE errorid = UPPER(v_ErrorId)
  232. AND application = v_Application;
  233. EXCEPTION
  234. WHEN NO_DATA_FOUND THEN
  235. v_AllXml := NULL;
  236. END GetErrorXml;
  237.  
  238. PROCEDURE GetErrorsXml
  239. (
  240. v_Application IN elmah$error.application%TYPE,
  241. v_PageIndex IN NUMBER DEFAULT ,
  242. v_PageSize IN NUMBER DEFAULT ,
  243. v_TotalCount OUT NUMBER,
  244. v_Results OUT t_cursor
  245. )
  246. IS
  247. l_StartRowIndex NUMBER;
  248. l_EndRowIndex NUMBER;
  249. BEGIN
  250. -- Get the ID of the first error for the requested page
  251. l_StartRowIndex := v_PageIndex * v_PageSize + ;
  252. l_EndRowIndex := l_StartRowIndex + v_PageSize - ;
  253.  
  254. -- find out how many rows we've got in total
  255. SELECT COUNT(*)
  256. INTO v_TotalCount
  257. FROM elmah$error
  258. WHERE application = v_Application;
  259.  
  260. OPEN v_Results FOR
  261. SELECT *
  262. FROM
  263. (
  264. SELECT e.*,
  265. ROWNUM row_number
  266. FROM
  267. (
  268. SELECT /*+ INDEX(elmah$error, idx_elmah$error_app_time_seq) */
  269. errorid,
  270. application,
  271. host,
  272. type,
  273. source,
  274. message,
  275. username,
  276. statuscode,
  277. timeutc
  278. FROM elmah$error
  279. WHERE application = v_Application
  280. ORDER BY
  281. timeutc DESC,
  282. sequencenumber DESC
  283. ) e
  284. WHERE ROWNUM <= l_EndRowIndex
  285. )
  286. WHERE row_number >= l_StartRowIndex;
  287.  
  288. END GetErrorsXml;
  289.  
  290. END pkg_elmah$get_error;
  291. /
  292.  
  293. /*
  294. -- If you are securing the packages above, you will need to grant execute
  295. -- privileges on them so that they can be called by the user connecting to the database.
  296. -- NB As long as you use the schema owner for the connection string, this is not necessary,
  297. -- although this is generally discouraged by Best Practices.
  298.  
  299. -- Option 1) Allow any user to execute the package (not recommended)
  300. -- replace OWNER for the schema owner in the following statement
  301. GRANT EXECUTE ON OWNER.pkg_elmah$log_error TO PUBLIC;
  302. GRANT EXECUTE ON OWNER.pkg_elmah$get_error TO PUBLIC;
  303.  
  304. -- Option 2) Allow a single user to execute the package (better)
  305. -- replace OWNER for the schema owner in the following statement
  306. GRANT EXECUTE ON OWNER.pkg_elmah$log_error TO USER_NAME;
  307. GRANT EXECUTE ON OWNER.pkg_elmah$get_error TO USER_NAME;
  308.  
  309. -- Option 3) Lock things down so that one user can only log errors, while another user can read and log errors (most secure)
  310. -- replace OWNER for the schema owner in the following statement
  311. -- LOGGING_USER_NAME will be used to connect to the database in all sites which log errors to the database
  312. GRANT EXECUTE ON OWNER.pkg_elmah$log_error TO LOGGING_USER_NAME;
  313. -- ADMIN_USER_NAME will be used to connect to the database in an admin portal which allows users to read errors
  314. GRANT EXECUTE ON OWNER.pkg_elmah$log_error TO ADMIN_USER_NAME;
  315. GRANT EXECUTE ON OWNER.pkg_elmah$get_error TO ADMIN_USER_NAME;
  316.  
  317. -- NB if you do take this approach, be sure to set the schemaOwner parameter in your web.config
  318. */
  319.  
  320. Oracle创建表脚本

elmah oracle的更多相关文章

  1. Elmah 日志记录组件

    http://www.cnblogs.com/jys509/p/4571298.html 简介 ELMAH(Error Logging Modules and Handlers)错误日志记录模块和处理 ...

  2. ELMAH入门

    简介 ELMAH(Error Logging Modules and Handlers)错误日志记录模块和处理程序,是一种应用广泛的错误日志工具是完全可插拔.它可以动态添加到一个正在运行的ASP.NE ...

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

    今天看到一篇文章(构建ASP.NET网站十大必备工具(2)),里面介绍了一个ELMAH的错误日志工具,于是研究了一下. ELMAH 是 Error Logging Modules and Handle ...

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

    elmah(英文):https://code.google.com/p/elmah/   写作思路:先看结果,然后再说原理   elmah文章基本内容如下   1.安装 2.基本使用 3.详细配置讲解 ...

  5. ELMAH 使用

    之前大部分系统日志记录是使用log4net.ObjectGuy Framework.NLog 等工具记录到文本或数据库. 更强大的工具可以使用 ELMAH. ELMAH(The Error Loggi ...

  6. 【工具推荐】ELMAH——可插拔错误日志工具(转)

    出处:http://www.cnblogs.com/liping13599168/archive/2011/02/23/1962625.html 今天看到一篇文章(构建ASP.NET网站十大必备工具( ...

  7. Oracle分析函数入门

    一.Oracle分析函数入门 分析函数是什么?分析函数是Oracle专门用于解决复杂报表统计需求的功能强大的函数,它可以在数据中进行分组然后计算基于组的某种统计值,并且每一组的每一行都可以返回一个统计 ...

  8. Linux平台 Oracle 10gR2(10.2.0.5)RAC安装 Part3:db安装和升级

    Linux平台 Oracle 10gR2(10.2.0.5)RAC安装 Part3:db安装和升级 环境:OEL 5.7 + Oracle 10.2.0.5 RAC 5.安装Database软件 5. ...

  9. Linux平台 Oracle 10gR2(10.2.0.5)RAC安装 Part1:准备工作

    Linux平台 Oracle 10gR2(10.2.0.5)RAC安装 Part1:准备工作 环境:OEL 5.7 + Oracle 10.2.0.5 RAC 1.实施前准备工作 1.1 服务器安装操 ...

随机推荐

  1. java代码----FileInputStream 和File

    总结:程序运行后,发现新建的两个文件里的东西突然i清空了.以为是程序出错了. 然后慌了,之后我再运行时,发现可以了.是电脑的问题吧 一如既往的打扰他,只因为他优秀 package com.a.b; i ...

  2. 字符串的问题(substr,find用法)

    链接:https://www.nowcoder.com/acm/contest/77/C来源:牛客网 字符串的问题 时间限制:C/C++ 2秒,其他语言4秒 空间限制:C/C++ 262144K,其他 ...

  3. MySQL Connector/NET 使用小结(踩坑之路)

    背景描述 根据项目的需要,需连接MySQL获取数据. 首先,先了解一下项目的情况: 之前的代码是C#编写的的, 运行时:.NETFramework3.5. 由于项目已经部署上线,因此不能升级运行时,这 ...

  4. node的socket.io类库概述

    socket.io是一个简单的小类库,该类库实现的功能类似于node中的net模块所实现的功能. 这些功能包括websocket通信,xhr轮询,jsonp轮询等. socket类库可以接受所有与服务 ...

  5. socket_udp客户端循环输入

    server--------------#!/usr/bin/env python # encoding: utf-8  # Date: 2018/6/7 from socket import * s ...

  6. linux加程序是否当掉检测脚本

    cd $(dirname $) source ~/.bash_profile SYSTEM_TIME=`date '+%Y-%m-%d %T'` count=`ps -ef |grep "p ...

  7. toString()和toLocaleString()的区别

    在数字转换成字符串的时候,并没有感觉这两个方法有什么区别,如下: 1 2 3 4 5 6 7 8 var e=123     e.toString() "123"   e.toLo ...

  8. angualr 之 $$phase

    对于angular, $$phase 是 作为angular 内部状态表示位,用来标示当前是处于哪个阶段. 用有的阶段有 $digest $apply 在使用的是例如你想调用scope.$apply的 ...

  9. 一个简单的异常/条件重试类(C#)

    单个类,简单好用 using System; using System.Linq.Expressions; using System.Threading; using System.Threading ...

  10. 5.Redis 发布订阅

    转自:http://www.runoob.com/redis/redis-tutorial.html Redis 发布订阅(pub/sub)是一种消息通信模式:发送者(pub)发送消息,订阅者(sub ...