Saminnet-Search Article Wiki Forum Piwigo SNS Cloud vtiger Sugar
DB2 recovery rollforward

  • Oracle
    • WebLogic Reset (211) Tue04,11:01am

      WebLogic起動するたびにユーザ名とパスワードを聞いてきて煩わしかったので回避したメモ。     securityフォルダを作成     $ mkdir $DOMAIN_HOME/servers/AdminServer/security     boot.propertiesを作成    boot.properties     username=weblogic    password=password     ※平文でOK     nohup & でWeblogicを起動     $ nohup sh $DOMAIN_HOME/startWebLogic.sh &     ※nohup.outに吐かれるのがいやだったら適当にリダイレクトさせる     boot.propertiesが暗号化されてることを確認     $ ca…

      Read More...

DB2 recovery rollforward

DB2 Database Recovery

List the contents of the Database Direcorty to determine which database image to resover

ls -la /db2backups/onlinebackups/

-rw-------. 1 db2inst1 db2iadm1 167845888 Jun 23 14:20 DATABASENAME.0.db2inst1.DBPART000.20140623142019.001
-rw-------. 1 db2inst1 db2iadm1  29560832 Jun 23 14:39 DATABASENAME.0.db2inst1.DBPART000.20140623143855.001
-rw-------. 1 db2inst1 db2iadm1  29560832 Jun 23 14:55 DATABASENAME.0.db2inst1.DBPART000.20140623145524.001
-rw-------. 1 db2inst1 db2iadm1  29560832 Jun 23 15:29 DATABASENAME.0.db2inst1.DBPART000.20140623152924.001

Restore the database that you which to recover using the TAKEN AT option

db2 restore database DATABASENAME from /db2backups/onlinebackups/ TAKEN AT 20140623142019
SQL2539W  The specified name of the backup image to restore is the same as the 
name of the target database.  Restoring to an existing database that is the 
same as the backup image database will cause the current database to be 
overwritten by the backup version.
Do you want to continue ? (y/n) y

DB20000I  The RESTORE DATABASE command completed successfully.

The database is now restored, but we still need to apply the archive logs to make the database consistent.
Query the rollforward status of the database issue the command

db2 rollforward database DATABASENAME  query status
                                 Rollforward Status

Input database alias                   = DATABASENAME
Number of members have returned status = 1

Member ID                              = 0
Rollforward status                     = DB  pending  <----- NEEDS TO ROLL FORWARD
Next log file to be read               = S0000004.LOG
Log files processed                    =  -
Last committed transaction             = 2014-06-23-22.29.33.000000 UTC

Apply all the transaction logs and rollforward the database

db2 "rollforward database DATABASENAME to end of logs overflow log path (/db2backups/db2inst1/DATABASENAME/)"
                                 Rollforward Status

Input database alias                   = DATABASENAME
Number of members have returned status = 1

Member ID                              = 0
Rollforward status                     = DB  working   <----- ALMOST THERE
Next log file to be read               = S0000006.LOG
Log files processed                    = S0000004.LOG - S0000005.LOG
Last committed transaction             = 2014-06-23-22.29.33.000000 UTC

DB20000I  The ROLLFORWARD command completed successfully.

Once you have restored the database to the desired state, the rollforward process can be completed by issuing the command

db2 rollforward database DATABASENAME complete
                                 Rollforward Status

Input database alias                   = DATABASENAME
Number of members have returned status = 1

Member ID                              = 0
Rollforward status                     = not pending   <----- COMPLETED
Next log file to be read               =
Log files processed                    = S0000004.LOG - S0000005.LOG
Last committed transaction             = 2014-06-23-22.29.33.000000 UTC

DB20000I  The ROLLFORWARD command completed successfully.

Add comment


Category Database

TweetTweet Share on LinkedInShare on LinkedIn Share on Google+Google+ Submit to RedditReddit Publish on WordPress WordPress Send emailSend email