views:

83

answers:

2

Hi all,

I'm using (have to) a badly designed Oracle(10) DB, for which I don't have admin rights (although I can create tables, triggers, etc in my scheme).

Now I had run into a problem: this DB connected with several users/programs. I must find out who updates a certain row, when, and if possible: with what kind of statement. Is it possible?

Thanks in advance!

A: 

I would create a journal table for the table you are working with. It will show you the operation type and the oracle user...as well as a bunch of other data if you need it.

northpole
Most probably, the oracle user will be 'SYSTEM' :-(
Zsolt Botykai
do you have any additional audit fields that store user info for your applications? We include this on our journal tables to determine users. Also, you can get the computer name of the connected PC, do you have that info?
northpole
AFAIK nope :-( so in my case, the when and how answers would be the most helpful.
Zsolt Botykai
+1  A: 

It would be easier to do this if you had admin rights to enable auditing. Without the power of auditing you are left with the use of triggers to handle the logging of inserts/updates/delete. In your case since you are interested in only update, you can put a trigger on the table to fire after the update which logs to another table what was changed, by whom, from where and to what and on what day.

MichaelN
I assume, it's the way. But I'm also interested in the update statement.
Zsolt Botykai
In your trigger, raise a "Come and talk to Zsolt" exception. :)
WW
make use of the sys_context package in your trigger to get the sql being excuted and any other information about the user you want to log into another table.
MichaelN