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 the redirection recovery command DB2 restore db olddb from "C: \ OLDDBbak" taken at 20150717164847 TO "C:" into newdb redirect where OLDDB is the name of the old database and backup database, NEWDB is the name of the new database, which can be created without prior use. C: \ OLDDBbak is the directory where the backup file is stored. 20150717164847 is the timestamp of the backup file. For details, see the name of the backup file OLDDB.0.DB2. node).catn2017.20150717164847.001, TO "C:" is the path of the new database, and REDIRECT is the redirection recovery. 2. Redirect tablespace 2.1 LIST tablespace DB2 list tablespaces you can see the tablespace status tablespace ID of the current database = 2 name = SYSTOOLSTMPSPACE type = system management space content = user temporary data status = 0x2000100 details explanation: for temporary recovery, you can define the tablespace ID in the storage space = 3 name = TBS_01 type = database management space content = all persistent data. Large tablespace. Status = 0x2001100 detailed explanation: restoring the temporary suspension must define the storage. You can define the storage. You can see that table space 3 is a "must define the storage" status, which requires redirection. 2.2 view the details of the TABLESPACE to be redirected DB2 list tablespace containers for 3 show detail result: the TABLESPACE container ID of table space 3 = 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, the path of the tablespace is inaccessible to the target system and must be redirected. 2.3 redirect this TABLESPACE has two CONTAINERS. You can redirect 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 and redirect 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. FOR system management space type, run the following command: 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 still tablespaces with no memory defined. 3. Complete the redirection and RESTORE DB2 restore db olddb continue.