DB2 online backup and redirection recovery practices!

Source: Internet
Author: User

The following articles mainly describe the DB2 online backup and the actual operation steps of the redirection recovery. I believe that if you have mastered the DB2 online backup and the actual operation steps of the redirection recovery, it will be of great help in future studies or work.

Objective: To back up the database server and redirect the backup to the local database.

1. First, execute the following command on the database server to perform full DB2 online backup (including logs) (db2? Backup allows you to view the backup help information)

 
 
  1. Db2 backup db wdcs online to E: \ Allan include logs timestamp is 20100420093345


Copy the backup image to the local C: \ temp path.

2. Run the following command on the database server to view the current tablespace in the database.

 
 
  1. db2 list tablespaces show detail 

3. Create a tablespace container for the original database locally. Run the following command in the cmd window:

 
 
  1. mkdir C:\DB2 \NODE0000\wdcs\syscatspace C:\DB2 \NODE0000\wdcs\indexspace1   
  2. C:\DB2 \NODE0000\wdcs\systoolspace C:\DB2 \NODE0000\wdcs\systoolstmpspace  
  3. C:\DB2 \NODE0000\wdcs\tablespace1 C:\DB2 \NODE0000\wdcs\tempspace1 C:\DB2 \NODE0000\wdcs\userspace1  

4. create a local empty database wdcs with the same name as the database server: create db wdcs

5. Start to execute the database recovery command on the local machine (the path specified for storing logs is:

 
 
  1. C:\db2workspace\wdcs_log)  
  2. db2 restore db wdcs from c:\temp taken at 20100420093345 into wdcs logtarget c:\db2workspace\wdcs_log redirect  

You are prompted to specify the storage container path.

6. specify the container for the tablespace of the local database to be restored and run the following commands (numbers:, and 8 are the tablespace IDs of the source database, the path after path is the path created in step 3rd above. The ID number and path correspond one to one. The final file "c: \ db2workspace \ wdcscontainer \ dms. dat "50000; file" c: \ db2workspace \ wdcscontainer \ index. dat "50000 is a tablespace container that recreates the DB2 online backup management class)

 
 
  1. db2 set tablespace containers for 0 using (path "c:\DB2\node0000\wdcs\syscatspace")  
  2. db2 set tablespace containers for 1 using (path "c:\DB2\node0000\wdcs\tempspace1")  
  3. db2 set tablespace containers for 2 using (path "c:\DB2\node0000\wdcs\userspace1")  
  4. db2 set tablespace containers for 3 using (path "c:\DB2\node0000\wdcs\systoolspace")  
  5. db2 set tablespace containers for 4 using (path "c:\DB2\node0000\wdcs\tablespace1")  
  6. db2 set tablespace containers for 5 using (path "c:\DB2\node0000\wdcs\indexspace1")  
  7. db2 set tablespace containers for 6 using (path "c:\DB2\node0000\wdcs\systoolstmpspace")  
  8. db2 set tablespace containers for 7 using (file "c:\db2workspace\wdcscontainer\dms.dat" 50000)  
  9. db2 set tablespace containers for 8 using (file "c:\db2workspace\wdcscontainer\index.dat" 50000) 

7. then proceed with the recovery:

 
 
  1. db2 restore db wdcs continue 

8. Finally, execute the prefix:


 

 
 
  1. db2 rollforward db wdcs to end of logs and stop overflow log path (C:\db2workspace\wdcs_log)  

The above content is an introduction to online DB2 backup and redirection recovery. I hope you will get some benefits.

Related Article

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.