If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > DB2 > inserts, updates, deletes log?

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 12-17-08, 11:31
MarkhamDBA MarkhamDBA is offline
Registered User
 
Join Date: Dec 2008
Location: Toronto, Canada
Posts: 381
inserts, updates, deletes log?

Need to trace insert, update, delete on tables (highly critical DB2 db). My questions are:
- how and where the history of inserts, updates, deletes on a table recorded?
- where else but in log files they are recorded?
- how to access those records?

I found an API called 'db2ReadLog' which does it but can not figure out how to run it from CLP. Please help
__________________
DB2 v9.5 ESE on AIX v6.1/ v9./10 on z/OS
Reply With Quote
  #2 (permalink)  
Old 12-17-08, 11:36
n_i n_i is offline
:-)
 
Join Date: Jun 2003
Location: Toronto, Canada
Posts: 4,449
Read about the DB2 audit facility
Reply With Quote
  #3 (permalink)  
Old 12-17-08, 11:39
nick.ncs nick.ncs is offline
Registered User
 
Join Date: May 2007
Location: somewhere in dbforums
Posts: 221
An easier way would be to define triggers on the table which will capture the insert / delete / update requests in a separate table which can then be easily analyzed.... as per convenience

As for the logs, the data is ordered in the sequence in which the transactions are carried out and hence even if you were able to extract the data formatting the same for each table would be a real pain ......

Comparing both the scenarios, there will be a little overhead in triggers but then you have to consider the trade-off between ease of use and overhead.... Also you'll have to note the I / U / D frequency to get a better picture.
__________________
IBM Certified Database Associate, DB2 9 for LUW
Reply With Quote
  #4 (permalink)  
Old 12-17-08, 12:03
MarkhamDBA MarkhamDBA is offline
Registered User
 
Join Date: Dec 2008
Location: Toronto, Canada
Posts: 381
thx Nick, audit facility looks like a good way to do it but these 3 (insert, update, delete) are not 'auditable events'.

http://publib.boulder.ibm.com/infoce...db.doc/toc.xml

Any other thoughts besides audit or triggers?
__________________
DB2 v9.5 ESE on AIX v6.1/ v9./10 on z/OS

Last edited by MarkhamDBA; 12-17-08 at 12:13.
Reply With Quote
  #5 (permalink)  
Old 12-17-08, 12:46
n_i n_i is offline
:-)
 
Join Date: Jun 2003
Location: Toronto, Canada
Posts: 4,449
Quote:
Originally Posted by MarkhamDBA
(insert, update, delete) are not 'auditable events'.
They are in DB2 9.5, to which you are planning to migrate. In v. 8 I guess you are stuck with triggers.
Reply With Quote
  #6 (permalink)  
Old 12-17-08, 13:14
MarkhamDBA MarkhamDBA is offline
Registered User
 
Join Date: Dec 2008
Location: Toronto, Canada
Posts: 381
Quote:
Originally Posted by n_i
They are in DB2 9.5, to which you are planning to migrate. In v. 8 I guess you are stuck with triggers.
Nick, I can not find them on the list in 9.5 either? Am I looking at the right place:

http://publib.boulder.ibm.com/infoce.../r0053355.html
__________________
DB2 v9.5 ESE on AIX v6.1/ v9./10 on z/OS
Reply With Quote
  #7 (permalink)  
Old 12-17-08, 13:42
n_i n_i is offline
:-)
 
Join Date: Jun 2003
Location: Toronto, Canada
Posts: 4,449
Quote:
Events for the EXECUTE category

* COMMIT Execution of a COMMIT statement
* CONNECT Establishment of a database connection
* CONNECT RESET Termination of a database connection
* DATA A host variable or parameter marker data values for the statement

This event is repeated for each host variable or parameter marker that is part of the statement. It is only present in a delimited extract of an audit log.
* GLOBAL COMMIT Execution of a COMMIT within a global transaction
* GLOBAL ROLLBACK Execution of a ROLLBACK within a global transaction
* RELEASE SAVEPOINT Execution of a RELEASE SAVEPOINT statement
* ROLLBACK Execution of a ROLLBACK statement
* SAVEPOINT Execution of a SAVEPOINT statement
* STATEMENT Execution of an SQL statement
* SWITCH USER Switching of a user within a trusted connection
.......................
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On