473,790 Members | 2,805 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Auditing with an Oracle back end?

39 New Member
Hello,

I have a .net web app with an Oracle back end and I need to audit my database. I created this template trigger that I was using on inserts, edit & deletes however...

Expand|Select|Wrap|Line Numbers
  1. "CREATE OR REPLACE TRIGGER {0}.BIUD_{3} 
  2.   BEFORE INSERT OR UPDATE OR DELETE ON {0}.{2} 
  3.   REFERENCING OLD AS OLD NEW AS NEW 
  4.   FOR EACH ROW 
  5. BEGIN 
  6.   IF inserting THEN 
  7.     SELECT {0}.{1}.nextval 
  8.     INTO   :NEW.{4} 
  9.     FROM   dual; 
  10.  
  11.     INSERT INTO {0}.{5} 
  12.                ({4}{6}, 
  13.                 auditaction, 
  14.                 audituser, 
  15.                 auditdate) 
  16.     VALUES     (:NEW.{4}{7}, 
  17.                 'INSERT', 
  18.                 substr(sys_context('userenv','os_user'), INSTR(sys_context('userenv','os_user'),'\')+1), 
  19.                 SYSDATE); 
  20.   END IF; 
  21.  
  22.   IF updating THEN 
  23.     INSERT INTO {0}.{5} 
  24.                ({4}{6}, 
  25.                 auditaction, 
  26.                 audituser, 
  27.                 auditdate)
  28.     VALUES     (:OLD.{4}{7}, 
  29.                 'UPDATE', 
  30.                 substr(sys_context('userenv','os_user'), INSTR(sys_context('userenv','os_user'),'\')+1), 
  31.                 SYSDATE); 
  32.   END IF; 
  33.  
  34.   IF deleting THEN 
  35.     INSERT INTO {0}.{5} 
  36.                ({4}{6}, 
  37.                 auditaction, 
  38.                 audituser, 
  39.                 auditdate) 
  40.     VALUES     (:OLD.{4}{8},
  41.                 'DELETE', 
  42.                 substr(sys_context('userenv','os_user'), INSTR(sys_context('userenv','os_user'),'\')+1), 
  43.                 SYSDATE); 
  44.   END IF; 
  45. END;
  46. /"
  47.  
I only get the username if I use impersonation and I restrict the web app to a user group (no anonymous login).
I have 1 oracle question and 1 .Net question.
Is it possible to get the correct username in Oracle without using impersonation?
If not, is there anyway I can configure .net so I don't have to use impersonation to send the user name?
If not I'm going to have to do my auditing at the application level, boooo.
Jul 6 '09 #1
1 2557
BiffMaGriff
39 New Member
OK, to solve this I added ModifiedBy and IsDeleted Columns to all my tables.
In my DAL I set it up so that ModifiedBy is automatically set to the user I want.
I also changed my DAL to implement soft deletes and then my DAL automatically performs a hard delete after every soft delete. A soft delete is merely an update where the IsDeleted field is set to 1.
In my trigger I changed the audit username value to the modifiedby field that my dal passes. For deletes, I do the auditing on the soft delete that my DAL performs as that is the only opportunity to capture the user name.

This is a screwy fix to this problem, but it is a fix none the less.
Jul 8 '09 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

1
2048
by: cxw0106 | last post by:
Is there any way to implement File Auditing in .NET? Thanks.
4
7251
by: Roger Redford | last post by:
Dear Experts, I'm attempting to marry a system to an Oracle 817 datbase. Oracle is my specialty, the back end mainly, so I don't know much about java or javascript. The system uses javascript to make ODBC calls to the db. The particular system I'm working with, will not work with an Oracle stored procedure I'm told. However, it
10
2625
by: Paulo Jan | last post by:
Hi all: Let's say I'm designing a database (Postgres 7.3) with a list of all email accounts in a certain server: CREATE TABLE emails ( clienteid INT4, direccion VARCHAR(512) PRIMARY KEY, login varchar(128) NOT NULL,
0
1521
by: RdR | last post by:
Is it true that DB2 will have an auditing tool to be used for auditing requirements such as Sarbanes-Oxley, etc? Something called Websphere Compliance Auditing? Rumours have it that IBM has a new tool that will get useful data for auditing from the DB2 logs through a log analyzer or log scraping mechanism and feed it to a SQL based database Target, or a Q replication target or use Web Publishing. Any dates announced? Thanks, RdR
10
3536
by: Andrea M. Segovia | last post by:
Hello, I am a newbie to Oracle databases.... We have a visualization front-end tool connected to an Oracle back-end database on a Tru64 UNIX server. We also have clients with MS access databases who would like to share their data using this visualization tool but do not want to import their data into the Oracle server back-end.
4
1441
by: Ed Rauscher | last post by:
Does ayone know what Class is used to enable Registry Auditing? Any help would be great.
14
1894
by: Jonas | last post by:
Hi! I'm developing the middletiers of an ASP.NET application in VB.NET. I've got a business logic layer in which I would like to perform auditing to a database. Instead of making an auditing call in every method of my classes, would it be a workable way to implement IDisposable in the base class to all the BLL-classes and then in the Dispose method to do the audit call? Do I then have to make sure that all uses of the BLL-classes end...
6
5223
by: Rico | last post by:
Hello, I'm creating an audit table and associated triggers to be able to capture any updates and deletes from various tables in the database. I know how to capture the records that have been updated or deleted, but is there any way that I can cycle through a changed record, look at the old vs new values and capture only the values that have changed? To give you a better idea of what I'm trying to do, instead of creating a copy of the...
0
1874
by: dba | last post by:
Hi folks, I would just like to share with you SQL CodeSecure, a newly released database protection and auditing tool from SqlLabs: SQL CodeSecure provides ultimate protection from unauthorized creation, modification and deletion of database objects. It provides flexibility through various protection types and granularity at different protection levels. CodeSecure comes with a full-featured auditing tool that keeps track of all changes...
0
9666
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10413
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
10145
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9986
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9021
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7530
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5551
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4094
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3707
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.