What are the tips for using redirection to restore a DB2 database?

Source: Internet
Author: User

Today we are going to discuss with you the practical operation skills for recovering DB2 databases through redirection. If you are curious about the practical operation skills for recovering DB2 databases through redirection, the following articles, do not miss the following text.

The DB2 database Restoration Operation uses the database backup image to recreate the database. To clone a database from one machine to another, the simplest way is to restore the database from the backup image. The file system path used by the database is also included in the backup image. Therefore, the redirection recovery operation is required unless the file system and physical devices referenced by the database on the source system are set in the same way as those of the target system.

Tip: If DB2 V8 is available, you can obtain a backup from any high-priority server and restore it to any other high-priority server. For example, you can restore a backup image from DB2 for HP-UX to DB2 for AIX®Or Sun Solaris. However, this does not apply to Windows and Linux.

The redirection DB2 recovery operation involves two steps to recover the database, and there is a tablespace container definition step in the middle:

Issue the restore database command with the REDIRECT option.

Use the set tablespace containers command to define the TABLESPACE container of the recovered database (DB2 needs to know where you want the TABLESPACE to reside on the target system ).

Issue the restore database command again, and specify the CONTINUE option this time.

The entire redirection to recover DB2 operation must be called in the same session; otherwise, SQL0900N will be returned, and the Restoration Operation will fail. Remember this is important. One way to avoid this is to create and run a script that contains all three parts of the Redirect recovery process.

The following (Windows) example shows how to successfully perform the redirection to restore DB2. I will demonstrate how to restore a backup image from different instances, rather than from another server. The principle is the same, and the details are the same.

The source Instance name in this example is PROD. The name of the target instance is MYINST. The name of the existing database on the PROD to be restored (created) on MYINST is MOVIES. The MOVIES database is on the D disk.

Create a complete database backup image for the MOVIES database on PROD:

 
 
  1. setDB2INSTANCE=PRODdb2   
  2. startdb2   
  3. backupdbmovies  

The time stamp of this image is 20021006213640, and the image is in D: movies?prodnode=catn=20021006. DB2 creates this subdirectory tree in the directory where the backup database command is issued. The subdirectory name indicates the following meanings:

In this subdirectory tree, there will be a file (213640.0) indicating the actual backup image ). The file name indicates the time when the backup was obtained.

Create a similar path (replace PROD with MYINST ):

 
 
  1. md MOVIES.0MYINSTNODE0000CATN000020021006 

This is a key step: If this path is not correctly created, subsequent database recovery operations will fail. If you are re-locating the backup image to another machine, create the above path on the target machine (replace MYINST with the appropriate target Instance name ), and copy the backup image (213640.0 in this case) to this directory. You can also use a compression tool to package backup images when maintaining the directory tree for transmission. The above content is an introduction to the use of redirection to restore the DB2 database. I hope you will have some gains.

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.