Enterprise Library 企业库 向Oracle数据库中 写日志的 存储过程
------先在 oracle中 创建表 如下----------------------
(备注 这个表是 从企业库自带的 sqlserver 中翻译过来的 ,在网上查了一下 好像还可以 自定义表 ,但是不知道怎么弄,希望后来的朋友 继续研究一下)
create table ORACLE_ENTLOG
(
ID NUMBER,
EVENTID NUMBER,
PRIORITY NUMBER,
TITLE NVARCHAR2(500),
MESSAGE NVARCHAR2(1000),
MACHINE NVARCHAR2(100),
TIMESTAMPS DATE,
SEVERITY NVARCHAR2(100),
APPLICATIONDOMAIN NVARCHAR2(1000),
PROCESSID NVARCHAR2(256),
PROCESSNAME NVARCHAR2(500),
WIN32THREADID NVARCHAR2(128),
THREADNAME NVARCHAR2(500),
EXTENDEDPROPERTIES NVARCHAR2(1000),
CATEGORY NVARCHAR2(1000)
)
---------------- 创建表的自增列--------
tablespace SYSTEM
pctfree 10
pctused 40
initrans 1
maxtrans 255
storage
(
initial 64K
next 8K
minextents 1
maxextents unlimited
pctincrease 50
);
----------------------------创建存储过程(1)--------------------------------------------------
备注: 这个存储过程 的用途不太明白 但是必须的!
create or replace procedure AddCategory
(
categoryName in nvarchar2,
logID in number
)
as
begin
UPDATE oracle_entlog SET Category=categoryName WHERE ID=logID;
commit;
end;
------------------------创建存储过程2---------------------------------------------------
备注:这个存储过程的用途 就是向 日志表 中添加日志了
CREATE OR REPLACE PROCEDURE WRITELOG
(
LogId out number,
EventId in number,
Priority in number,
Title in nvarchar2,
Message in nvarchar2,
machineName in nvarchar2,
timestamp in Date,
Severity in nvarchar2,
AppDomainName in nvarchar2,
ProcessId in nvarchar2,
ProcessName in nvarchar2,
Win32ThreadId in nvarchar2,
ThreadName in nvarchar2,
formattedmessage in nvarchar2
)
is
begin
insert into oracle_entlog
(
ID,
EventId,
Priority,
Title,
Message,
Machine,
Timestamps,
Severity,
ApplicationDomain,
ProcessId,
ProcessName,
Win32ThreadId,
ThreadName,
ExtendedProperties
)
values
(
seq_entlog.Nextval,
EventId,
Priority,
Title,
Message,
machineName,
timestamp,
Severity,
AppDomainName,
ProcessId,
ProcessName,
Win32ThreadId,
ThreadName,
formattedmessage
);
commit;
select seq_entlog.Currval into LogId from dual;
end WriteLog;
------------------------------未完 怎么 调用 和配置 我会在下面 详细 说明----------------------------------------------------------