Home » Developer & Programmer » Forms » Best way to record AUDIT - Forms or DB Trgr ?
icon5.gif  Best way to record AUDIT - Forms or DB Trgr ? [message #141744] Tue, 11 October 2005 22:07 Go to next message
ORADEV1011
Messages: 3
Registered: October 2005
Junior Member
Hi,
We are working on an application in which we need to record AUDIT LOG for certain columns in certain tables.
I see two ways to do this . One way is ,to add some additional code in Transactions Form to insert records into AUDIT tables also , when we are doing INSERT / UPDATE on trx tables.
Another way is by doing DB triggers on Trx tables.

Can you pl comment what is the best way of recording this log. Or are there any other better ways of doing this ??
Re: Best way to record AUDIT - Forms or DB Trgr ? [message #141754 is a reply to message #141744] Tue, 11 October 2005 23:32 Go to previous messageGo to next message
djmartin
Messages: 10181
Registered: March 2005
Location: Surges Bay TAS Australia
Senior Member
Account Moderator

Audit in Form or in Database[ 8 votes ]
1. It is best to have audit code in Form 0 / 0%
2. It is best to have audit code in Database 8 / 100%

David
Re: Best way to record AUDIT - Forms or DB Trgr ? [message #141755 is a reply to message #141754] Tue, 11 October 2005 23:34 Go to previous messageGo to next message
djmartin
Messages: 10181
Registered: March 2005
Location: Surges Bay TAS Australia
Senior Member
Account Moderator
I believe that audit code should be in the database so that when a script, batch job, or user via SQL*Plus or TOAD, etc, manipulates the data the audit still 'fires'.

David
Re: Best way to record AUDIT - Forms or DB Trgr ? [message #142349 is a reply to message #141755] Fri, 14 October 2005 04:54 Go to previous messageGo to next message
Maaher
Messages: 7065
Registered: December 2001
Senior Member
Yep, use the database for these kind of things.

I always tend (or tended - I'm not on a Forms project right now) to keep my forms as lightweight as possible.

MHE
Re: Best way to record AUDIT - Forms or DB Trgr ? [message #142501 is a reply to message #142349] Fri, 14 October 2005 23:12 Go to previous messageGo to next message
naveednt
Messages: 34
Registered: October 2005
Location: Karachi, Pakistan
Member
its better to record AUDIT at DB level for better performance, but what if I have to audit users which does not exist in DB?.
its like self-created users, authenticated from a [set of] tables.
Re: Best way to record AUDIT - Forms or DB Trgr ? [message #142511 is a reply to message #142501] Sat, 15 October 2005 00:20 Go to previous messageGo to next message
Maaher
Messages: 7065
Registered: December 2001
Senior Member
naveednt wrote on Sat, 15 October 2005 06:12

its better to record AUDIT at DB level for better performance, but what if I have to audit users which does not exist in DB?.
its like self-created users, authenticated from a [set of] tables.
I wouldn't advise such a thing, but the same goes here. All the data is in the database, audit it there.

Again, don't use such a mechanism Oracle can handle multiple users, you know.

MHE
Re: Best way to record AUDIT - Forms or DB Trgr ? [message #142604 is a reply to message #142501] Sun, 16 October 2005 18:22 Go to previous messageGo to next message
djmartin
Messages: 10181
Registered: March 2005
Location: Surges Bay TAS Australia
Senior Member
Account Moderator
In v$session there are numerous fields, one is USERNAME, another is OSUSER. Does this second field give you the 'resolution' that you need?

David
Re: Best way to record AUDIT - Forms or DB Trgr ? [message #142685 is a reply to message #141744] Mon, 17 October 2005 04:02 Go to previous messageGo to next message
manwadkar
Messages: 104
Registered: September 2005
Location: Washington DC
Senior Member

My two cents....

It is always better to audit at application level. You can assgin a particular user to access database through application. If other than this user is coonecting this database then you can audit it at database level
Re: Best way to record AUDIT - Forms or DB Trgr ? [message #142702 is a reply to message #142685] Mon, 17 October 2005 05:41 Go to previous messageGo to next message
Maaher
Messages: 7065
Registered: December 2001
Senior Member
manwadkar wrote on Mon, 17 October 2005 11:02

My two cents....

It is always better to audit at application level.

Why?
manwadkar wrote on Mon, 17 October 2005 11:02

You can assgin a particular user to access database through application.
I don't see what this has to do with auditing. All users should be defined in the database, hence you can perfectly audit on database level.
manwadkar wrote on Mon, 17 October 2005 11:02

If other than this user is coonecting this database then you can audit it at database level
I still don't get it.

Can you explain a little bit what you are stating here? I really don't see the use of application level auditing. You want to audit who has changed what data and when.

MHE
Re: Best way to record AUDIT - Forms or DB Trgr ? [message #142704 is a reply to message #142702] Mon, 17 October 2005 06:11 Go to previous messageGo to next message
manwadkar
Messages: 104
Registered: September 2005
Location: Washington DC
Senior Member

Lets take example of application which can be ported on Oracle, Informix and sqlserver.

If I keep all my code at client side and send all audit details (created_by, updated_by, creation_date, last_update_date details) to server side then my code (means client application) becomes generic. That's why I said that it is always recommended to keep audit code at client side. Otherwise you need to write triggers at database level. Oracle, Informix or other database may have different structure and features for triggers.

When client application talks with database server, usually it is recommended to use standard user to communicate with database (like APPS/APPLSYSPUB in E-Business Suite). In this case database audit may not help us because we do not have database user account for each separate connection. We are sharing the one user to commit data.

In above scnerio, if DBA/Application developer wants to do direct write on database ( like at sql prompt or using toad) then there should be separate account needed (like APSUPPORT for AP schema, POSUPPORT for PO schema, OESUPPORT for OE schema). Here database triggers will help you to audit the transactions. You can write database trigger in such a way that if call is other than client application database (suppose APPS) user then make created_by=CURRENT DATABASE USER.

I hope you got what I wanted to say. If you still have doubts then please send me an email to vmanwadkar@hotmail.com.
Re: Best way to record AUDIT - Forms or DB Trgr ? [message #142712 is a reply to message #142704] Mon, 17 October 2005 06:45 Go to previous message
Maaher
Messages: 7065
Registered: December 2001
Senior Member
manwadkar wrote on Mon, 17 October 2005 13:11

Lets take example of application which can be ported on Oracle, Informix and sqlserver.
We are talking Oracle Forms here. You will always have to rewrite the database side if you want to port.

manwadkar wrote on Mon, 17 October 2005 13:11

When client application talks with database server, usually it is recommended to use standard user to communicate with database (like APPS/APPLSYSPUB in E-Business Suite).
Not on my watch! It makes the entire security part unnecessary complex.

manwadkar wrote on Mon, 17 October 2005 13:11

In this case database audit may not help us because we do not have database user account for each separate connection.
Exactly, and is this a good thing? I don't think so. Now you are forced to write your own mechanism while Oracle has built-in AUDIT capacities. You do know that Oracle is perfectly able to cope with more than one user? I hate these kind of heavy forms applications. Do as much as you can on the database and keep your Forms as light as possible, that's my advise. You cannot convince me.

MHE
Previous Topic: how can i check for existing folder in any drive on forms (merged)
Next Topic: using host command (merged)
Goto Forum:
  


Current Time: Fri Apr 19 22:08:13 CDT 2024