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

  • Data-Articles
    • Desa Nelayan Makmur (166) Fri02,20:43pm

      KALAUΒ dilihat Desa Bendar tidaklah berbeda dengan desa-desa lainnya. Berada di tepi sungai Juwana, kecamatan Juwana, kabupaten Pati, Jawa Tengah. Pun, tempat ini memiliki pelelangan ikan pula. Yang membedakan dengan desa-desa nelayan lainnya adalah rumah-rumah kokoh dan besar. Ya, desa nelayan ini bukanlah sembarangan desa nelayan. Kebanyakan warga desa ini adalah pengusaha kapal penangkap ikan.…

      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