IBM / db2-samples

Db2 application code, configuration samples, and other examples
https://www.ibm.com/analytics/developing-with-db2
Apache License 2.0
85 stars 86 forks source link

DB2 C API to backup and restore only transaction logs #50

Closed hsc2013 closed 2 years ago

hsc2013 commented 2 years ago

With IBM DB2, is it possible to take only transaction logs backup and restore from C API? I know I can set the config from C CPI where LOGARCHMETH1 got set. After setting this, transaction logs got archived but if I need to take a backup of the active transaction only?

Does transaction logs backup supports Full, Incremental, and Delta also?

kdrodger commented 2 years ago

Only the transaction logs, no. It is definitely possible to create backup images which also include the minimum necessary set of transaction logs for a future recovery to a minimal point-in-time, but not only on their own.

What use-case do you have in mind? What are you trying to accomplish that would require a backup of only the logs?

Another way of looking at it though is that log archiving IS essentially a backup of the transaction logs, in an incremental fashion, although there are certainly some boundary cases that deserve advanced consideration depending on the requirements of the system being designed.

hsc2013 commented 2 years ago

Yes, right archiving is essentially a backup of transaction logs. I am looking for a feature through which I can take backup and restore of only logs through C API which is basically transaction logs backup. If we can not take this backup of only logs then do we have any reference from the IBM db2 side?

kdrodger commented 2 years ago

It might help if you can describe the overall workflow you have in mind. Which logs files (all, a subset for some purpose, or individual files)? Most importantly, what you plan to do with those log files later in the future and which use-cases you need to support?

One option, maybe perhaps the closest to what you described, is to create your own log archival 'user exit' program. https://www.ibm.com/docs/en/db2/11.5?topic=management-user-exit-programs-log-file-archiving-retrieval

There are simple samples pointed to in the documentation, including some implemented in C (any language is possible), as well as in the db2-samples repo: https://github.com/IBM/db2-samples/blob/8d71c80e1eac7817715fb56626486cdcc470890a/c/db2uext2.cdisk

kdrodger commented 2 years ago

Closing due to inactivity