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... -
"CREATE OR REPLACE TRIGGER {0}.BIUD_{3}
-
BEFORE INSERT OR UPDATE OR DELETE ON {0}.{2}
-
REFERENCING OLD AS OLD NEW AS NEW
-
FOR EACH ROW
-
BEGIN
-
IF inserting THEN
-
SELECT {0}.{1}.nextval
-
INTO :NEW.{4}
-
FROM dual;
-
-
INSERT INTO {0}.{5}
-
({4}{6},
-
auditaction,
-
audituser,
-
auditdate)
-
VALUES (:NEW.{4}{7},
-
'INSERT',
-
substr(sys_context('userenv','os_user'), INSTR(sys_context('userenv','os_user'),'\')+1),
-
SYSDATE);
-
END IF;
-
-
IF updating THEN
-
INSERT INTO {0}.{5}
-
({4}{6},
-
auditaction,
-
audituser,
-
auditdate)
-
VALUES (:OLD.{4}{7},
-
'UPDATE',
-
substr(sys_context('userenv','os_user'), INSTR(sys_context('userenv','os_user'),'\')+1),
-
SYSDATE);
-
END IF;
-
-
IF deleting THEN
-
INSERT INTO {0}.{5}
-
({4}{6},
-
auditaction,
-
audituser,
-
auditdate)
-
VALUES (:OLD.{4}{8},
-
'DELETE',
-
substr(sys_context('userenv','os_user'), INSTR(sys_context('userenv','os_user'),'\')+1),
-
SYSDATE);
-
END IF;
-
END;
-
/"
-
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.
1 2540
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.
Sign in to post your reply or Sign up for a free account.
Similar topics
by: cxw0106 |
last post by:
Is there any way to implement File Auditing in .NET?
Thanks.
|
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...
|
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,...
|
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...
|
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...
|
by: Ed Rauscher |
last post by:
Does ayone know what Class is used to enable Registry Auditing? Any help
would be great.
|
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...
|
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...
|
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...
|
by: Faith0G |
last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...
|
by: ryjfgjl |
last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: aa123db |
last post by:
Variable and constants
Use var or let for variables and const fror constants.
Var foo ='bar';
Let foo ='bar';const baz ='bar';
Functions
function $name$ ($parameters$) {
}
...
|
by: ryjfgjl |
last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
|
by: ryjfgjl |
last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
|
by: Sonnysonu |
last post by:
This is the data of csv file
1 2 3
1 2 3
1 2 3
1 2 3
2 3
2 3
3
the lengths should be different i have to store the data by column-wise with in the specific length.
suppose the i have to...
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
| |