Thread: Logging at DB2
08-08-08, 04:46 #1Registered User
- Join Date
- Aug 2008
Unanswered: Logging at DB2
Hello, I'm kinda confused in logging method at DB2. There is circular logging and archive logging, but, when I searched archive logging, there's not much info I could get.
Does archive logging have the same mechanism as circular logging, which is constantly writing online logs in circular mode ?
And, I don't understand the meaning of the archive log, since I saw the manual which explains that archive logs contain changes after the backup was taken, but when I searched it again, an article tells me that archive logs contain old data that aren't fit on the active log, which means, it's old data that doesn't contain changes, right ?
Oh yeah, log buffer has to do something with those mechanisms, right ? When exactly data from log buffer transferred to the log files ? Which one is the log buffer's writing destination ? Active log ? Or online log ?
I'm so confused by the logging mechanism in DB2...
Last edited by linakichi; 08-08-08 at 05:00.
08-08-08, 05:46 #2Registered User
Provided Answers: 11
- Join Date
- Apr 2006
active/online log is the same
whenever there is a commit or logbuffer full data gets flushed to logfiles
for circular logging, the log files are re-used and forward recovery after restore is not possible. with archive logging, whenever a log file is closed, this file will be copied to disk/tape/tsm.. with this archived copy, you can always rollforward after restore to recover data
check some admin guides for details..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
08-08-08, 17:48 #3Registered User
- Join Date
- May 2003
For "archive logging" (aka "log retain") you define how many active logs will be kept (primary and secondary). Secondary active logs are only used when a UOW goes beyond the primary log allocation without a commit.
Once the active logs are filled, they are archived to the archive log location (specified in an exit program or using LOGARCHMETH1 & 2 (spelling may be wrong). Certain other kinds of events may cause the logs to be truncated (start a new log file) or archived.
You must manually prune the archive logs or they will stay on the archive log path forever.
The log buffer is not specifically associated with archiving or circular logs (all logs are written to a memory buffer before they are written to disk). Logs are flushed to disk when:
- A commit is issued (so that DB2 gurantees UOW recovery),
- The log buffer is full, or
- About one second has elapsed since the last logs were flushed to disk.
There are some exceptions to what is said above, especially with TSM, but given that you are apparently new to DB2 internals, don't try to understand everything at once. Also, I would suggest you read the Administraton Guides for more information.M. A. Feldman
IBM Certified DBA on DB2 for Linux, UNIX, and Windows
IBM Certified DBA on DB2 for z/OS and OS/390