Running DB2 9.1 on AIX 5.3
I would like to do a restore of a database from an online backup image
to December 21st with a backup that was taken using INLCUDE LOGS
Same box, not a redirected restore.
If I use the logtarget parameter on the restore db command
can I then simply do a rollfoward database to end of logs and stop
overflow logpath /fullpath ?
Since there are more recent logs present in the active log directory do
I have to specify NORETRIEVE to ensure that db2 only uses the logs from
the backup image in the log retreieve path to do the rollforward and
not use any other logs?
Thanks in advance.
Scott
Scott - 27 Dec 2007 00:33 GMT
I should state that the overflow log path would be the path specified
in the logtarget of the restore comand
So is NORETRIEVE required in that case?
> Running DB2 9.1 on AIX 5.3
>
[quoted text clipped - 16 lines]
>
> Scott
Mark A - 27 Dec 2007 00:37 GMT
> Running DB2 9.1 on AIX 5.3
>
[quoted text clipped - 16 lines]
>
> Scott
I don't have an exact answer to that question, but if you don't want to use
all the logs in the logpath, I would only rollforward to the minimum
rollforward time (which will use only the necessary included logs). To find
the minimum rollforward time, use a bogus time such as
1950-01-01-00:00:00.000000 (not sure about that format) and then DB2 will
tell you that it cannot use that time and give you the minimum rollforward
time. Then substitute the minimum rollforward time DB2 gives you and
resubmit the rollforward (with the NORETREIVE option). This will prevent
using all the more recent logs in the logpath.
aj - 02 Jan 2008 19:28 GMT
Scott:
Yes, it took me a while to get my brain wrapped around this...
Assuming you want to roll-forward only the logs stored w/ the online DB
backup:
Do the backup like so:
-backup database $db online to <wherever> include logs
Then:
-restore db $db taken at $pit logtarget /tmp
-db2 rollforward db $db to end of logs and stop overflow log path /tmp
noretrieve
$pit is the point in time referenced in the online backup file, ie:
<DB>.0.<instance>.NODE0000.CATN0000.20071228021205.001 would be
0071228021205
I happen to be using /tmp to store the logs that are extracted from
the backup, choose whatever dir you fancy.
I'm not familar w/ AIX, but on Linux this script will automate it. Feed
it the name of the database you want to restore+roll forward as the arg.
db=`echo $1 | tr '[a-z]' '[A-Z]'`
pit=`ls $<backup location>/$db.0.*.001 | awk -F. '{print $6}'`
cd $<backup location>
echo -e "Restoring database $db...\n"
db2 restore db $db taken at $pit logtarget /tmp
db2 rollforward db $db to end of logs and stop overflow log path
\(/tmp\) noretrieve
Careful w/ the left and right parens - they will trip up the shell
interpreter. Notice how I escaped them..
Good luck. HTH
cheers
aj
> Running DB2 9.1 on AIX 5.3
>
[quoted text clipped - 16 lines]
>
> Scott
Knut Stolze - 03 Jan 2008 11:17 GMT
> db2 rollforward db $db to end of logs and stop overflow log path
> \(/tmp\) noretrieve
>
> Careful w/ the left and right parens - they will trip up the shell
> interpreter. Notice how I escaped them..
I would put double-quotes around the DB2 command to avoid escaping:
db2 "rollforward db $db to end of logs and stop overflow log path (/tmp)
noretrieve"

Signature
Knut Stolze
DB2 z/OS Utilities Development
IBM Germany