DB2 tablespace redirection recovery database practice

Source: Internet
Author: User

DB2 tablespace redirection recovery database practice

DB2's backup recovery is a bit pitfall. When the path settings of the source and target systems are different, manual redirection recovery is required. This article is a summary process after my actual operations and is for reference only.

1. Issue A redirection recovery command

DB2 RESTORE DB OLDDB FROM "C:\OLDDBbak" TAKEN AT 20150717164847 TO "C:" INTO NEWDB REDIRECT

Here, OLDDB is the name of the old database and backup database, while NEWDB is the name of the new database, which can be created without prior creation. C: \ OLDDBbak is the directory where the backup file is stored, and 20150717164847 is

The timestamp of the backup file. For details, refer TO the backup file name OLDDB.0.DB2. node).catn2017.20150717164847.001. TO "C:" is the path of the new database, and REDIRECT is used TO restore the redirection.

2. Redirect tablespace

2.1 list tablespaces

DB2 LIST TABLESPACES

The tablespace status of the current database is displayed.

Tablespace id = 2
Name = paioolstmpspace
Type = system management space
Content = user temporary data
Status = 0x2000100
Explanation:
Recovery pending
Memory can be defined

Tablespace id = 3
Name = TBS_01
Type = database management space
Content = all persistent data. Large tablespace.
Status = 0x2001100
Explanation:
Recovery pending
Memory must be defined
Memory can be defined

We can see that table space 3 is in the "memory must be defined" state, which requires redirection.

2.2 view the details of the tablespace to be redirected

DB2 LIST TABLESPACE CONTAINERS FOR 3 SHOW DETAIL

The result is as follows:

Tablespace 3 tablespace container ID = 0 name = E: \ OLDDB \ TBS \ CONTAINER_01_01 type = total file pages = 25600 available pages = 25568 accessible = No container ID = 1 name = E: \ OLDDB \ TBS \ CONTAINER_01_02 type = total file pages = 25600 available pages = 25568 accessible = No

As you can see, the path of the tablespace is inaccessible in the target system and must be redirected.

2.3 redirection

The tablespace has two containers and can be redirected separately.

DB2 SET TABLESPACE CONTAINERS FOR 3 USING (FILE "C:\NEWDB\TBS\CONTAINER_01_01" 25600,FILE "C:\NEWDB\TBS\CONTAINER_01_02" 25600)

You can also merge redirects.

DB2 SET TABLESPACE CONTAINERS FOR 3 USING (FILE "C:\NEWDB\TBS\CONTAINER_01" 51200)

The page size must be greater than or equal to the original size.

This is a redirection of the database management space type. If it is of the system management space type, the command is as follows:

DB2 SET TABLESPACE CONTAINERS FOR 10 USING (PATH "C:\NEWDB\TBS\TBS_SYSTEM_04")

There may be many tablespaces to be redirected. According to the actual environment, the command to be executed is 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" 25600)
DB2 set tablespace containers for 5 USING (FILE "C: \ NEWDB \ TBS \ CONTAINER_03" 51200)
DB2 set tablespace containers for 6 USING (FILE "C: \ NEWDB \ TBS \ CONTAINER_04" 64000)
DB2 set tablespace containers for 7 USING (FILE "C: \ NEWDB \ TBS \ CONTAINER_05" 153600)
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 10 USING (PATH "C: \ NEWDB \ TBS \ TBS_SYSTEM_04 ")
DB2 set tablespace containers for 11 USING (PATH "C: \ NEWDB \ TBS \ TBS_SYSTEM_08 ")
DB2 set tablespace containers for 12 USING (PATH "C: \ NEWDB \ TBS \ TBS_USERTMP_04 ")
DB2 set tablespace containers for 13 USING (PATH "C: \ NEWDB \ TBS \ TBS_USERTMP_08 ")

Finally, re-Execute Step 2.1 to check whether there are any tablespaces with "memory must be defined ".

3. Complete redirect recovery

DB2 RESTORE DB OLDDB CONTINUE

This article permanently updates the link address:

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.