Personal tools
You are here: Home DB2 Scripts DB2 Mirror online DB with automated rollforward.
Navigation
Log in


Forgot your password?
 
Document Actions

Mirror online DB with automated rollforward.

Imagine you have a huge DB which cannot be stopped to mirror with db2inidb or alter instance parameters, maybe this little script will help you.

Create a new server similar (identical would be better, right?) to the production one.

Grant permissions to the new TSM node in order to be able to extract logs and restore db images from the production node.

db2adutl grant all on nodename db2prod2 for db myhugedb

Restore the production db on the new server from the last full online backup you have.

Insert this script in your crontab to execute hourly (or less, it's up to you):

#!/bin/bash

. /home/db2inst1/sqllib/db2profile

LOG1=$( db2 rollforward db myhugedb query status | grep "Next log file to be read" | cut -f 2 -d "=" | cut -f 1 -d "." )
LOG2=S9999999

cd /db2/db2inst1/failarch

$( db2adutl extract logs between $LOG1 and $LOG2 db myhugedb nodename db2prod1 owner db2inst1 without prompting > /dev/null )

$( db2 "rollforward db myhugedb to end of logs overflow log path ('/db2/db2inst1/failarch/NODE0000/MYHUGEDB/C0000001')" > /dev/null )

rm /db2/db2inst1/failarch/NODE0000/MYHUGEDB/C0000001/*
Security Awareness
Would you like your company to implement gamification into your security awareness program?





Polls