DB2 Table Space Redirection Recovery Database combat

Source: Internet
Author: User
Tags db2

DB2 Backup recovery A bit of a pit, when the source system and target system path settings are not the same, to manually redirect recovery, this is my first practical operation after the summary of the process, for reference only.

First, Issue redirect restore command

olddb From "C:\OLDDBbak20150717164847 to"C:newdbREDIRECT

Where OLDDB is the old database, the database name of the backup, NEWDB is the new database name, do not have to be created in advance, C:\OLDDBbak is the directory where the backup files are placed, 20150717164847 is

The timestamp of the backup file, depending on the name of the backup file Olddb.0.db2.node0000.catn0000.20150717164847.001,to "C:" is the path to the new database, and redirect is the redirect recovery.

Second, redirect table space

2.1 Listing Table Spaces

DB2 LIST tablespaces

You can see the table space status of the current database

Tablespace identity                          = 2 name                                = systoolstmpspace type =                                System admin Space content                                = user temporary data state                   = 0x2000100   Detailed explanation:     recovery hold     You can define the memory table space Identity                          = 3 name                                = tbs_01 Type                                = database management space Content                                = ALL persistent data. Large table space. Status                   = 0x2001100   Detailed explanation:     resilient suspend     must define memory     to define storage

You can see that table Space 3 is a "must-define storage" state, which requires redirection.

2.2 Viewing the tablespace details for redirection

DB2 LIST tablespace CONTAINERS for 3 SHOW DETAIL

The results are as follows

Tablespace container container Identity                            = 0 name =                                E:\OLDDB\TBS\CONTAINER_01_01 Type                                = File Total pages =                            25600 available pages                            = 25568 accessible                              = no Container id                            = 1 name                                = E:\OLDDB\TBS\CONTAINER_01_02 Type                                = File Total pages                            = 25600 available pages                            = 25568 accessible                              = no

As you can see, the path to this tablespace is inaccessible to the target system and is redirected.

2.3 redirect

This table space has two containers that can be redirected individually

25600)

You can also merge redirects

51200)
Page size is greater than or equal to the original size

This is the redirection of the database management space type, if the system manages the spatial type, the command is as follows:

DB2 SET tablespace CONTAINERS for USING (PATH "C:\NEWDB\TBS\TBS_SYSTEM_04")

There may be a lot of tablespaces to redirect, and the last command to execute is, in the real world, similar to the following:

 db2 SET tablespace CONTAINERS for 3 USING (FILE "C:\NEWDB\TBS\CONTAINER_01_01" 25600, File "C:\NEWDB\TBS\CONTAINER_01_02" 25600) DB2 SET tablespace CONTAINERS for 4 USING (file "C:\NEWDB\TBS\CONTAINER_02" 256 XX) DB2 set tablespace CONTAINERS for 5 USING (FILE "C:\NEWDB\TBS\CONTAINER_03" 51200) DB2 set tablespace CONTAINERS for 6 U SING (file "C:\NEWDB\TBS\CONTAINER_04" 64000) DB2 SET tablespace CONTAINERS for 7 USING (file "C:\NEWDB\TBS\CONTAINER_05" 1 53600) DB2 set tablespace CONTAINERS for 8 USING (FILE "C:\NEWDB\TBS\CONTAINER_06" 51200) DB2 set tablespace CONTAINERS for 9 using (FILE "C:\NEWDB\TBS\CONTAINER_07" 25600) DB2 SET tablespace CONTAINERS for ten using (PATH "C:\NEWDB\TBS\TBS_SYSTEM_ ") DB2 set tablespace CONTAINERS for one USING (PATH" C:\NEWDB\TBS\TBS_SYSTEM_08 ") DB2 set tablespace CONTAINERS for USI NG (path "C:\NEWDB\TBS\TBS_USERTMP_04") DB2 SET tablespace CONTAINERS for the USING (path "C:\NEWDB\TBS\TBS_USERTMP_08") 
     

Finally, perform a 2.1-step check to see if there's a tablespace that "must define storage."

Iii. Completion of REDIRECT recovery

DB2 RESTORE DB olddb CONTINUE

DB2 Table Space Redirection Recovery Database combat

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.