473,405 Members | 2,210 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,405 software developers and data experts.

Which transaction log files are obsoleted by BACKUP ONLINE?

Hello, all.

I can't figure out <subjectfrom documentation.

I had configured
LOGARCHMETH1 = DISK:/bak/logs

so all full log files are copied *out* of the active log path. Let I issue

| # DB2 BACKUP DB MYDB ONLINE TO '/bak/images'
| Backup successful. The timestamp for this backup image is : 20070507023935

Now I need to determine which log file should be read *first* by RESTORE when rolling forward from this backup. I need it to remove earlier (obsoleted) log files.

But how can I do this ? It's very likely that the log file in question is the one given by

| # DB2 GET DATABASE CONFIG FOR MYDB | sed -n 's/.*First active log file.*= *//gp'

issued just before backup. But this is not always true, because BACKUP procedure tries to flush dirty pages especially to reduce rollforward window, so the first active log file number could increase.

Of course, I could see the log file should be read *first* after database restore:

| # DB2 ROLLFORWARD DATABASE MYDB QUERY STATUS
| Rollforward Status
| Next log file to be read = S0000023.LOG

but I need this info after backup, not after restore. Also "db2ckbkp" does not help much.

Please, direct me.
--
Konstantin Andreev.
May 7 '07 #1
5 3599
Hello.

Look at the
LIST HISTORY BACKUP COMMAND

Sincerely,
Mark B.
Hello, all.

I can't figure out <subjectfrom documentation.

I had configured
LOGARCHMETH1 = DISK:/bak/logs

so all full log files are copied *out* of the active log path. Let I issue

| # DB2 BACKUP DB MYDB ONLINE TO '/bak/images'
| Backup successful. The timestamp for this backup image is : 20070507023935

Now I need to determine which log file should be read *first* by RESTORE when rolling forward from this backup. I need it to remove earlier (obsoleted) log files.

But how can I do this ? It's very likely that the log file in question is the one given by

| # DB2 GET DATABASE CONFIG FOR MYDB | sed -n 's/.*First active log file.*= *//gp'

issued just before backup. But this is not always true, because BACKUP procedure tries to flush dirty pages especially to reduce rollforward window, so the first active log file number could increase.

Of course, I could see the log file should be read *first* after database restore:

| # DB2 ROLLFORWARD DATABASE MYDB QUERY STATUS
| Rollforward Status
| Next log file to be read = S0000023.LOG

but I need this info after backup, not after restore. Also "db2ckbkp" does not help much.

Please, direct me.
--
Konstantin Andreev.

May 7 '07 #2
On May 7, 2:25 am, Konstantin Andreev <cictoucpham...@datatech.ru>
wrote:
Hello, all.

I can't figure out <subjectfrom documentation.

I had configured
LOGARCHMETH1 = DISK:/bak/logs

so all full log files are copied *out* of the active log path. Let I issue

| # DB2 BACKUP DB MYDB ONLINE TO '/bak/images'
| Backup successful. The timestamp for this backup image is : 20070507023935

Now I need to determine which log file should be read *first* by RESTORE when rolling forward from this backup. I need it to remove earlier (obsoleted) log files.

But how can I do this ? It's very likely that the log file in question is the one given by

| # DB2 GET DATABASE CONFIG FOR MYDB | sed -n 's/.*First active log file.*= *//gp'

issued just before backup. But this is not always true, because BACKUP procedure tries to flush dirty pages especially to reduce rollforward window, so the first active log file number could increase.

Of course, I could see the log file should be read *first* after database restore:

| # DB2 ROLLFORWARD DATABASE MYDB QUERY STATUS
| Rollforward Status
| Next log file to be read = S0000023.LOG

but I need this info after backup, not after restore. Also "db2ckbkp" does not help much.

Please, direct me.
--
Konstantin Andreev.

Have you considered option "INCLUDE LOGS" that was introduced in DB2
LUW 8.2 (I think)? You can add "COMPRESS" as well to save some space,
if needed. For example:

$ db2 backup database $DATABASE online to $BACKUPPATH compress include
logs

Darko Krstic

May 7 '07 #3
Darko Krstic wrote:
On May 7, 2:25 am, Konstantin Andreev <cictoucpham...@datatech.ruwrote:
>| # DB2 BACKUP DB MYDB ONLINE TO '/bak/images'
| Backup successful. The timestamp for this backup image is : 20070507023935

Now I need to determine which log file should be read *first* by RESTORE when rolling forward from this backup.
But how can I do this ?

Have you considered option "INCLUDE LOGS" that was introduced in DB2 LUW 8.2 (I think)? You can add "COMPRESS" as well to save some space, if needed. For example:
$ db2 backup database $DATABASE online to $BACKUPPATH compress include logs
Yes, I have. "INCLUDE LOGS" is good for a version backup/restore, whereas I need a point in time, restorable to any time in future (for the case of a disk fault). Using "INCLUDE LOGS" in my case would just replace the log file in question:

For now, I am looking which file RESTORE would read lst for rolling forward "this" backup image. When using "INCLUDE LOGS" I will look for the log file RESTORE would read lst *after* rolling forward all logs stored in the backup image. It's very likely that it will be "First active log file" at the moment of backup completion, but I can't be sure: there is a race condition between the moment when backup completes, and the moment when "GET DB CFG" command issued.
--
Konstantin Andreev.
May 7 '07 #4
Mark B. wrote:
Look at the
LIST HISTORY BACKUP COMMAND
>| # DB2 BACKUP DB MYDB ONLINE TO '/bak/images'
| Backup successful. The timestamp for this backup image is : 20070507023935

Now I need to determine which log file should be read *first* by RESTORE when rolling forward from this backup.
But how can I do this ?
Thank you, this is a helpful hint. I'm just unpleasantly surprised, that information returned by 'LIST HISTORY' command is not documented neither 'LIST HISTORY' nor 'SYSIBMADM.DB_HISTORY' information center topics. The only place it's documented is 'db2HistoryData' data structure of the DB2 API. For those who care:

| FirstLog - The earliest log file ID (ranging from S0000000 to S9999999): - Required to apply rollforward recovery for an online backup

So, 'LIST HISTORY' is a solution.

But... looking at the 'history' table is an oblique method to associate the backup image with the earliest log file ID. For instance, history may be pruned or unavailable (by either condition) at the moment when I am trying to create association.

I'm still interested in straightforward method of finding earliest log file ID: by looking only at the backup image file and set of log files. Something like retrieving and comparing LSN's and/or timestamps.
--
Konstantin Andreev.
May 7 '07 #5
Look at the output of the db2ckbkp with "-l" option.
It seems (but may be it's not correct) that number of the first active
log is in the row with phrase "Initial extent number".
I've never seen detailed description of the output of the db2ckbkp
command with different options and I'll appreciate if somebody gives
me links to such info.
Mark B. wrote:
Look at the
LIST HISTORY BACKUP COMMAND
| # DB2 BACKUP DB MYDB ONLINE TO '/bak/images'
| Backup successful. The timestamp for this backup image is : 20070507023935
Now I need to determine which log file should be read *first* by RESTORE when rolling forward from this backup.
But how can I do this ?

Thank you, this is a helpful hint. I'm just unpleasantly surprised, that information returned by 'LIST HISTORY' command is not documented neither 'LIST HISTORY' nor 'SYSIBMADM.DB_HISTORY' information center topics. The only place it's documented is 'db2HistoryData' data structure of the DB2 API. For those who care:

| FirstLog - The earliest log file ID (ranging from S0000000 to S9999999): - Required to apply rollforward recovery for an online backup

So, 'LIST HISTORY' is a solution.

But... looking at the 'history' table is an oblique method to associate the backup image with the earliest log file ID. For instance, history may be pruned or unavailable (by either condition) at the moment when I am trying to create association.

I'm still interested in straightforward method of finding earliest log file ID: by looking only at the backup image file and set of log files. Something like retrieving and comparing LSN's and/or timestamps.
--
Konstantin Andreev.

May 8 '07 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

10
by: TZoner | last post by:
1) Can one find the location of the 'Transaction Log' at: <Hard Disk>\Program Files\Microsoft SQL Server\MSSQL\Data\MyDb_Log.ldf? 2) Is it safe to delete it, as SQL will create a new Transaction...
3
by: t2581 | last post by:
Hi , I run restore with rollforward In job in output, last commited transaction time less then backup image time Is it normal ? RESTORE DATABASE PRICE_V8 FROM "E:\BACKUP" TAKEN AT...
5
by: laststubborn | last post by:
Hi All, I have a dillema that I created 2 transaction file before I started to take log back. Now I changed my recovery model from simple to full. Do I still need to keep my second transaction...
3
by: TG | last post by:
Coming from a (mostly) Oracle shop, I am unclear how SS transaction logs work as far as up to point of failure recovery goes. I have the few MSSQL databases I look after in full recovery mode,...
2
by: Charles MacLean | last post by:
How can I truncate and shrink the transaction log under SQL 2000? My log is 10 GB in size and I assume most of the transactions are committed. Thanks
3
by: sifrah | last post by:
Hi All, My SQL server transaction log is getting bigger every day and my HDD if running out of space. So i follow the MS KB about how to Shrinking the Transaction Log. After doing so the log is...
4
by: Brian D | last post by:
In MS SQL 2005 when you do a Full Backup does it also backup and truncate the transaction logs or do I need to back the transaction logs up separately? Thanks. Brian
5
by: Kruton | last post by:
Hello everyone, This is more of an architectural question about SQL Server. Can someone please explain why when I perform a query such as the one below that updates a table using begin and end...
0
by: DanInTacoma | last post by:
We have a fairly straightforward maint plan on one of our servers (MSSQL 2K)...it backs up several DB's to a folder on another server (the one with the tape drive) so they can be archived to tape. ...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.