Results 1 to 8 of 8
  1. #1
    Join Date
    Jul 2012
    Posts
    2

    Unanswered: how DB2 Recovery Expert works, when extracting logs?

    I am writing a sql2nosql synchronizing tool by java. I gotta to extract DB2 history archived transaction logs, however not like Oracle logmnr, DB2 has no suitable API or method, except her own tool 'Recovery Expert'.Don't mention snapshot or event monitor for me, because I am analyzing history archived logs.

    Does anyone help me how DB2 Recovery Expert works, when extracting logs?

    Regards Deyin from China

  2. #2
    Join Date
    Aug 2001
    Location
    UK
    Posts
    4,650
    Have you checked the following APIs ?

    db2HistoryCloseScan - End the history file scan
    db2HistoryGetEntry - Get the next entry in the history file
    db2HistoryOpenScan - Start a history file scan
    db2HistoryUpdate - Update a history file entry

    More info at

    DB2 APIs

    There are also readlog apis on the page, you may want to check.

    You have to use C/C++ to call these APIs and use JNI(or similar) to access from Java.

    If these are not suitable, provide more details of what you are after.
    Visit the new-look IDUG Website , register to gain access to the excellent content.

  3. #3
    Join Date
    Apr 2006
    Location
    Belgium
    Posts
    2,514
    Provided Answers: 11
    no log formatter is not available
    recovery expert has a builtin module to analyze the doc - but this is not documented..
    support center sometimes provides a similar tool for debugging
    Best Regards, Guy Przytula
    Database Software Consultant
    Good DBAs are not formed in a week or a month. They are created little by little, day by day. Protracted and patient effort is needed to develop good DBAs.
    Spoon feeding : To treat (another) in a way that discourages independent thought or action, as by overindulgence.
    DB2 UDB LUW Certified V7-V8-V9-V9.7-V10.1-V10.5 DB Admin - Advanced DBA -Dprop..
    Information Server Datastage Certified
    http://www.infocura.be

  4. #4
    Join Date
    Jan 2007
    Location
    Jena, Germany
    Posts
    2,721
    Here is a link that describes the binary structure of the log records written by DB2 LUW: DB2 log records - IBM DB2 9.7 for Linux, UNIX, and Windows
    It was not complete about 7-8 years ago with DB2 V8; and probably it hasn't been completed now - I'm not sure.

    My question is what you actually want to do with this information? Aside from replication and recovery, there is usually no need to access this internal information.
    Knut Stolze
    IBM DB2 Analytics Accelerator
    IBM Germany Research & Development

  5. #5
    Join Date
    Jul 2012
    Posts
    2
    Quote Originally Posted by stolze View Post
    Here is a link that describes the binary structure of the log records written by DB2 LUW: DB2 log records - IBM DB2 9.7 for Linux, UNIX, and Windows
    It was not complete about 7-8 years ago with DB2 V8; and probably it hasn't been completed now - I'm not sure.

    My question is what you actually want to do with this information? Aside from replication and recovery, there is usually no need to access this internal information.
    Hi, guys, thanks for all of your advice above.

    My requirement is writing a program to get DB2 insert, update, delete transaction data whenever it happens or get the transaction 'sql_redo' like oracle logmnr mines. Because of transactions has occured or will occur, the only way is to analyze the logs(archived, online, or both, depends on the timestamp range)
    In fact, there isn't an easy way or tool to debug the "db2logconn.sqc" line by line, to understand the log structure, however, I compiled out the 'exe' by VC++ 2010.
    Also I tried to make use of the DB2 sql replication's capture program, reading the CD table to get the changed data, it goals, however, this way is not scalable, because y have to create a separate tabspace and a CD table for every table you want to analyze, and the capture program is actually based on 'readlog'.

    Can anyone completely analyze the binary structure of log records, or tell how DB2 Recovery Expert extracts log or put forward your better ideas?

    BTW, don't mention DB2 snapshot, event monitor for me, because my log mining is from the past to now or later. This way is only for online log and y have to start it first.

    Always regargs from Deyin.

  6. #6
    Join Date
    Jan 2007
    Location
    Jena, Germany
    Posts
    2,721
    If SQL Replication is not working for you, how about Q Rep? This gives you the changes in message queues. There is also a 3rd alternative, but the name eludes me right now...

    If you really want to do the log reading by yourself, it will be a challenging task. Since the logs are DB2 internal, they may - and do - change from release to release.
    Knut Stolze
    IBM DB2 Analytics Accelerator
    IBM Germany Research & Development

  7. #7
    Join Date
    Jun 2003
    Location
    Toronto, Canada
    Posts
    5,516
    Provided Answers: 1
    Quote Originally Posted by stolze View Post
    There is also a 3rd alternative, but the name eludes me right now...
    Do you mean Infosphere CDC, by chance? I doubt that it will work, as they don't expose the change stream. Besides, Deyin wants to be able to read past transactions, and I suspect neither of the replication options can do that.
    ---
    "It does not work" is not a valid problem statement.

  8. #8
    Join Date
    Jan 2007
    Location
    Jena, Germany
    Posts
    2,721
    I was actually referring to "event publishing". DB2 Database for Linux, UNIX, and Windows

    All replication tools do read past transactions and return the provide the corresponding records of committed transactions. You have to know the LRSN or RBA/LSN so that the tool knows where to start reading in the log.

    p.s: You're right about CDC.
    Knut Stolze
    IBM DB2 Analytics Accelerator
    IBM Germany Research & Development

Tags for this Thread

Posting Permissions

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