Results 1 to 7 of 7
  1. #1
    Join Date
    Jun 2008
    Posts
    9

    Question Unanswered: Reading DB2 Transaction Log files on Windows XP using DB2 API

    Hi,

    I need to read the DB2 transaction log files on Windows XP using DB2 API in a program. I need to read the log files for INSERT/UPDATE/DELETE operations. Can anyone please help me with this.

    Its very urgent and its a very critical issue.


    Thanks for any help.

  2. #2
    Join Date
    Jan 2003
    Posts
    4,292
    Provided Answers: 5
    I do not believe that there is any api to the logs.

    Andy

  3. #3
    Join Date
    Jan 2007
    Location
    Jena, Germany
    Posts
    2,721
    Actually, there is an API (db2ReadLog and DB2 log records). There is also an API that you can use to read log records without being connected to the database that wrote those records.

    However, the description of log records is not complete and log records change from version to version of DB2. So relying on that is either a lot of work due to the necessary re-engineering and/or it is bound to fail at some point in the future.

    Hence, my question would be why you (the OP) think that you need to read the log records. What's the problem that you really want to solve?
    Knut Stolze
    IBM DB2 Analytics Accelerator
    IBM Germany Research & Development

  4. #4
    Join Date
    Jun 2008
    Posts
    9

    Question

    Hi,

    I want to read the transaction logs for any INSERT/UPDATE/DELETE operations that have taken place in the underlying database and then I will convert those changes to a table and will then appy that table on my database for a restore. I dont want to restore the entire database but want only to apply the changes on my database. Its actually similar to replication.

    But I want to do it programmatically as per the requirement.

    Can u guide me regarding this ?

    Also, I have few other questions:

    In remote logging, is it possible to generate the logs of my database on a remote location ?

    And is it possible to apply the logs of my database on another remote consolidated database which has the same structure as my database?

    Thanks.

  5. #5
    Join Date
    Jan 2007
    Location
    Jena, Germany
    Posts
    2,721
    Just use the "capture" part of SQL replication to write all data changes to so-called change data tables (CD tables). Then you can query those CD tables in whichever way you like.

    Using Replication has a few advantages
    • It is a product that is developed and supported by IBM. It makes your development much easier.
    • You don't have to guess at the log record structure.
    • You don't have to worry about transaction-consistency, i.e. only processing already committed log records.
    • You don't have to worry about your process falling down and then has to pick up reading the log records at the correct point.
    Knut Stolze
    IBM DB2 Analytics Accelerator
    IBM Germany Research & Development

  6. #6
    Join Date
    Jun 2008
    Posts
    9

    Question

    Hi,

    Thanks for the reply.

    I had other questions too ( in my previous email):

    In remote logging, is it possible to generate the logs of my database on a remote location ?

    And is it possible to apply the logs of my database on another remote consolidated database which has the same structure as my database?

    Could you please answer them ?

    Thanks.

  7. #7
    Join Date
    May 2003
    Location
    USA
    Posts
    5,737
    Quote Originally Posted by db2query
    In remote logging, is it possible to generate the logs of my database on a remote location ?

    And is it possible to apply the logs of my database on another remote consolidated database which has the same structure as my database?
    Yes, it is called HADR. Just google it and read all about it.
    M. A. Feldman
    IBM Certified DBA on DB2 for Linux, UNIX, and Windows
    IBM Certified DBA on DB2 for z/OS and OS/390

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •