DB2 Backup Recovery 2

Source: Internet
Author: User

########## Prepare for backup ########################## #######

*********** Create a directory for storing archiving logs and backups ****************
[Root @ Yan ~] # Su-db2inst1
[Db2inst1 @ Yan ~] $ Mkdir archivelog
[Db2inst1 @ Yan ~] $ Mkdir log
[Db2inst1 @ Yan ~] $ Mkdir backup ************ create a test database and test table ******************** *******
DB2 => Create dB Yan
DB2 => connect to Yan
DB2 => Create Table Test (ID int, name varchar (20), password varchar (20 ))
DB2 => insert into test values (1, 'zhu', 'any ') ************************* *************
DB2 => Update dB CFG for Yan using export logpath/home/db2inst1/archivelog -- enable mirror logdb2 => Update dB CFG for Yan using userexit on -- enable user export DB2 => Update dB cfg for Yan using logretain on -- enable archive log DB2 => Update dB CFG for Yan using trackmod on -- enable Incremental backup function DB2 => Backup dB Yan to/home/db2inst1/backup database suspended, you must back up the database once. Otherwise, backup successful cannot be used. the timestamp for this backup image is: 20090807082 755 ############### start backup and restoration #################### ########## ****************** cold backup and restoration ********** * ******************** DB2 => Backup dB Yan to/home/db2inst1/backupbackup successful. the timestamp for this backup image is: 20090807083306db2 => insert into test values (2, 'hui', 'hui') [db2inst1 @ Yan ~] $ CP archivelog/node0000/* log -- copy the archive log to DB2 => drop dB Yan -- manually delete the database, simulate disaster recovery DB2 => restore dB Yan from/home/db2inst1/backup taken at 20090807083306 -- restore the database
Db20000i the Restore database command completed successfully. DB2 => rollforward dB Yan to end of logs and complete overflow Log Path (/home/db2inst1/log) -- roll forward log rollforward STATUS input database alias = Yan
Number of nodes have returned status = 1 node number = 0
Rollforward status = not pending
Next log file to be read =
Log files processed = s0000000.log-s0000000.log
Last committed transaction = 2009-07-7-12.34.41.000000 utcdb20000i the rollforward command completed successfully. DB2 => select * from test -- all data in the test table can be found to prove that ******************** hot backup and restoration ** * ***************************** DB2 => insert into test values (3, 'java', 'db') -- insert test data DB2 => Backup dB Yan online to/home/db2inst1/backup -- Hot Backup successful. the timestamp for this backup image is: 20090807084 334 DB2 => insert into test values (4, 'db2 ', 'jsp') -- insert test data [db2inst1 @ Yan ~] $ CP-RF archivelog/node0000/* log -- copy the log DB2 => drop dB Yan -- manually delete the database and simulate disaster recovery
Db20000i the drop database Command completed successfully. DB2 => restore dB Yan from/home/db2inst1/backup taken at 20090807084334 -- restore the database
Db20000i the Restore database command completed successfully. DB2 => rollforward dB Yan to end of logs and complete overflow Log Path (/home/db2inst1/log) -- roll forward log rollforward STATUS input database alias = Yan
Number of nodes have returned status = 1 node number = 0
Rollforward status = not pending
Next log file to be read =
Log files processed = s0000002.log-s0000002.log
Last committed transaction = 2009-07-7-12.43.35.000000 utcdb20000i the rollforward command completed successfully. DB2 => select * from test -- check that all test data has been successfully verified. **************** Incremental backup and restoration **** * ************************** DB2 => insert into test values (5, 'oracle ', 'mysql') -- insert test data DB2 => Backup dB Yan Online Incremental to/home/db2inst1/backup -- backup database backup successful. the timestamp for this backup image is : 20090807085501 [db2inst1 @ Yan ~] $ CP-RF archivelog/node0000/* log -- copy the log DB2 => drop dB Yan -- manually delete the database and simulate disaster recovery
Db20000i the drop database Command completed successfully. DB2 => restore dB Yan incremental automation from/home/db2inst1/backup taken at 20090807085501
Db20000i the Restore database command completed successfully. -- Restore database DB2 => rollforward dB Yan to end of logs and complete overflow Log Path (/home/db2inst1/log) rollforward STATUS input database alias = Yan
Number of nodes have returned status = 1 node number = 0
Rollforward status = not pending
Next log file to be read =
Log files processed = s0000004.log-s0000004.log
Last committed transaction = 2009-07-7-12.55.01.000000 utcdb20000i the rollforward command completed successfully. DB2 => select * from test -- all the test data has been verified.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.