views:

143

answers:

5

Im looking for a tool that can watch database(mysql and oracle) for changes.

When someone inserts or updates something in any(or chosen) table i want to get to know about it. It could be very useful for working with others people code that do some magic in database.

I know that it can be done using triggers (see this question), but im more interested in some tool that can do it. free tool.

+1  A: 

Not entirely sure if this is what you're after, but there's JetProfiler for MySQL, which'll let you inspect exactly what's happening on a database, query-wise. I'm quite sure there are equivalents for Oracle...

David Hedlund
i will take a look at it, thanks.
01
+1  A: 

Maybe you could quickly code your own tool. I'd start with a simple tool that could export to a CSV file basic data about each table for comparison: number of rows (i.e. a select count(*)), primary keys and a field with the last modification date if available. Then you could run a diff between the latest CSV with the previous one from time to time.

But I'm not sure if this is feasible - it depends on the amount of data in your database.

Bruno Rothgiesser
im thinking about it, but maybe there is something out there :) but you are right, some ranges should be use, because there can be a lot of data.
01
+1 the question looks for universal solution and this is universal
Unreason
+2  A: 

For Oracle, you are looking for the AUDIT command. This one writes audit records to the SYS.AUD$ table, which you can monitor.

More information about the AUDIT statement: http://download.oracle.com/docs/cd/B19306_01/server.102/b14200/statements_4007.htm#SQLRF01107

and about database auditing: http://download.oracle.com/docs/cd/B19306_01/server.102/b14220/security.htm#sthref2916

Regards, Rob.

Rob van Wijk
+1  A: 

If looking to validate 3rd party access to your database then reviewing logs (enable logging in mysql/oracle) in some controlled environment should help you test the 3rd party procedures.

Alternatively making snapshoots for comparison should work too.

If you want to audit 3rd party changes to the data, in terms of data validity, then you should make it specific to your business rules and it falls under application level (as the audit process will depend largely on the structure of your data; simply looking at the universally formatted diff is not going to be very efficient).

You could check TOAD (Data Diff Viewer).

Also you should ask yourself why do you let 3rd party access your database in a manner that is not controlled, but is only passively checked after the fact? Ideal situation is that external interfaces define and perform all the validation on integrity rules and business rules while processing the input to the system.

Unreason
its not really 3rd party just other teams use the same database and its easier for me to look at the data to understand what they are doing. i will try your suggestions.
01
+1  A: 

Turn on binary logging:

http://dev.mysql.com/doc/refman/5.0/en/binary-log.html

That will record every change to the database.

Marek