Discussion:
Restore online backup and roll forward just the logs stored in it. How?
(too old to reply)
aj
2007-03-20 21:24:05 UTC
Permalink
DB2 LUW v8.2 FP 14 RHAS 2.1

I have a DB2 online DB backup that was done w/ the INCLUDE LOGS
option. I am interested in restoring that backup, and rolling
forward ONLY the logs contained in the backup and no more, then
bringing the DB online.

I do not want to use a userexit to try and retrieve additional
logs - I only want to roll forward the logs in the backup. (In
case you haven't guessed, I am restoring a test version of my
prod DB).

I have some questions about the commands I would use to accomplish
this. Lets say my DB name and instance name are foo.

My DB backup file is FOO.0.foo.NODE0000.CATN0000.20070319020726.001

First, the restore:
db2 restore db foo taken at 20070319020726 logtarget /tmp

If I were to use the LOGS option after the DB name in the restore
command, ONLY the logs would be retrieved from the backup image and
placed in /tmp, and the DB restore would not take place. Correct?

By specifying LOGTARGET (and not using LOGS), this will cause the
DB image to be restored AND the logs in the image to be placed
in /tmp. Correct?

Now I'm interested in doing the roll-forward. I can't just
db2 rollforward db foo to end of logs and stop
because my userexit will come into play, and the rollforward is
not being informed about the logs in /tmp. I need a PIT.

I need the minimum PIT for the roll-forward. So, I can do this:
db2 rollforward db foo stop
SQL1276N Database "FOO" cannot be brought out of rollforward pending
state until roll-forward has passed a point in time greater than or
equal to "2007-03-19-06.30.35.000000", because node "0" contains
information later than the specified time.

Is there another way to establish the minimum PIT? I'm trying to
automate the process of restoring and rolling forward. IBM is
assuming that eyes and fingers are issuing these commands.

So, armed w/ my PIT, I do this:
db2 "rollforward db foo to 2007-03-19-06.30.35.000000 overflow log path
/tmp)"

What is the purpose of overflow log path? Is it to indicate where logs
should be written when/if they are retrieved? OR is it to indicate
where to look for logs that are needed for the roll forward?

After I try this, DB2 complains about being unable to retrieve a log
that is outside the range of those stored w/ my online backup, and I
scratch my head for a few more minutes.....

Would using RECOVER DATABASE be a better idea for what I am trying to do?

Any help appreciated.

thanks
aj
Lennart
2007-03-21 03:06:40 UTC
Permalink
aj wrote:
[...]
Post by aj
db2 "rollforward db foo to 2007-03-19-06.30.35.000000 overflow log path
/tmp)"
I think it should be:

rollforward db foo to end of logs and stop overflow log path ( /tmp )

[...]


/Lennart
aj
2007-03-21 15:00:18 UTC
Permalink
OK - I'll give it a try.

The RESTORE command puts logs S0016355.LOG and S0016356.LOG in /tmp.
So apparently 16355 and 16356 are stored in the backup image.

db2 rollforward db foo to end of logs and stop overflow log path (/tmp)
SQL1268N Roll-forward recovery stopped due to error "1" while
retrieving log file "S0016357.LOG" for database "FOO" on node "0".

And the DB is still in rollforward pending mode...

WHY is it going after 16357?

Any other ideas?

thanks
aj
Post by Lennart
[...]
Post by aj
db2 "rollforward db foo to 2007-03-19-06.30.35.000000 overflow log path
/tmp)"
rollforward db foo to end of logs and stop overflow log path ( /tmp )
[...]
/Lennart
aj
2007-03-21 18:48:43 UTC
Permalink
Maybe this will help the next guy. This pretty much explains it:
http://www-1.ibm.com/support/docview.wss?uid=swg21209404

They key is to specify the NORETRIEVE option of the ROLLFORWARD
DATABASE command. This will prevent DB2 UDB from trying to
obtain potentially missing transaction logs elsewhere.

aj
Post by aj
OK - I'll give it a try.
The RESTORE command puts logs S0016355.LOG and S0016356.LOG in /tmp.
So apparently 16355 and 16356 are stored in the backup image.
db2 rollforward db foo to end of logs and stop overflow log path (/tmp)
SQL1268N Roll-forward recovery stopped due to error "1" while
retrieving log file "S0016357.LOG" for database "FOO" on node "0".
And the DB is still in rollforward pending mode...
WHY is it going after 16357?
Any other ideas?
thanks
aj
Post by Lennart
[...]
Post by aj
db2 "rollforward db foo to 2007-03-19-06.30.35.000000 overflow log path
/tmp)"
rollforward db foo to end of logs and stop overflow log path ( /tmp )
[...]
/Lennart
k***@hotmail.com
2007-03-22 10:01:26 UTC
Permalink
This post might be inappropriate. Click to display it.
Loading...