[DB2]db2重定向恢復
概要:恢復檔案原資料庫名:TEST,恢復目標資料庫名:TEST123,恢復檔案目錄:/home/db2inst1下,恢復方式:重定向(REDIRECT)
1.將TEST資料庫的備份檔案恢復到TEST123庫
[root@db2 ~]# su - db2inst1
[db2inst1@db2 ~]$db2 RESTORE DATABASE TEST FROM '/home/db2inst1' TAKEN AT 20140910164553 INTO TEST123 REDIRECT WITHOUT ROLLING FORWARD
SQL1277W A redirected restore operation is being performed. Table space
configuration can now be viewed and table spaces that do not use automatic
storage can have their containers reconfigured.
DB20000I The RESTORE DATABASE command completed successfully.
[db2inst1@db2 ~]$ db2pd -db TEST123 -tablespaces
Database Partition 0 -- Database TEST123 -- Active -- Up 0 days 00:36:04 -- Date 06/02/2015 05:15:24
Tablespace Configuration:
Address Id Type Content PageSz ExtentSz Auto Prefetch BufID BufIDDisk FSC NumCntrs MaxStripe LastConsecPg Name
0x00002AAB2B1D4B20 0 DMS Regular 8192 4 Yes 4 1 1 Off 1 0 3 SYSCATSPACE
0x00002AAB2B1D6220 1 SMS SysTmp 8192 128 Yes 128 1 1 On 1 0 127 TEMPSPACE1
0x00002AAB2B1D9940 2 DMS Large 8192 128 Yes 128 1 1 Off 1 0 127 USERSPACE1
0x00002AAB2B1DB040 3 SMS UsrTmp 8192 128 Yes 128 1 1 On 1 0 127 USER_TMP_TBS
0x00002AAB2B1DE520 4 DMS Large 8192 128 Yes 128 2 2 Off 1 0 127 HIS_TBS_DATA
0x00002AAB2B1DFE60 5 DMS Large 8192 128 Yes 128 2 2 Off 1 0 127 HIS_TBS_INDEX
0x00002AAB2B1E1560 6 SMS SysTmp 16384 128 No 128 3 3 On 1 0 127 TMP_16
0x00002AAB2B1E4A40 7 SMS SysTmp 32768 128 No 128 4 4 On 1 0 127 TMPSYS32
Tablespace Statistics:
Address Id TotalPgs UsablePgs UsedPgs PndFreePgs FreePgs HWM Max HWM State MinRecTime NQuiescers PathsDropped
0x00002AAB2B1D4B20 0 184320 184316 0 0 0 0 0 0x02000100 0 0 No
0x00002AAB2B1D6220 1 1 1 1 0 0 0 0 0x02000100 0 0 No
0x00002AAB2B1D9940 2 606208 606080 0 0 0 0 0 0x02000100 0 0 No
0x00002AAB2B1DB040 3 0 0 0 0 0 0 0 0x02001100 0 0 No
0x00002AAB2B1DE520 4 2097152 2097024 0 0 0 0 0 0x02000100 0 0 No
0x00002AAB2B1DFE60 5 1310720 1310592 0 0 0 0 0 0x02000100 0 0 No
0x00002AAB2B1E1560 6 1 1 1 0 0 0 0 0x02001100 0 0 No
0x00002AAB2B1E4A40 7 0 0 0 0 0 0 0 0x02001100 0 0 No
Tablespace Autoresize Statistics:
Address Id AS AR InitSize IncSize IIP MaxSize LastResize LRF
0x00002AAB2B1D4B20 0 Yes Yes 33554432 -1 No None None No
0x00002AAB2B1D6220 1 Yes No 0 0 No 0 None No
0x00002AAB2B1D9940 2 Yes Yes 33554432 -1 No None None No
0x00002AAB2B1DB040 3 No No 0 0 No 0 None No
0x00002AAB2B1DE520 4 Yes Yes -2147483648 2147483648 No None None No
0x00002AAB2B1DFE60 5 Yes Yes 1073741824 1073741824 No None None No
0x00002AAB2B1E1560 6 No No 0 0 No 0 None No
0x00002AAB2B1E4A40 7 No No 0 0 No 0 None No
Containers:
Address TspId ContainNum Type TotalPgs UseablePgs PathID StripeSet Container
0x00002AAB2B1D5FE0 0 0 File 184320 184316 0 0 /home/db2inst1/db2inst1/NODE0000/TEST123/T0000000/C0000000.CAT
0x00002AAB2B1D9700 1 0 Path 1 1 0 0 /home/db2inst1/db2inst1/NODE0000/TEST123/T0000001/C0000000.TMP
0x00002AAB2B1DAE00 2 0 File 606208 606080 0 0 /home/db2inst1/db2inst1/NODE0000/TEST123/T0000002/C0000000.LRG
0x00002AAB2B0E8BC0 3 0 Path 0 0 - 0 /home/db2inst1/db2inst1/NODE0000/SQL00003/USER_TMP_TBS
0x00002AAB2B1DFC20 4 0 File 2097152 2097024 0 0 /home/db2inst1/db2inst1/NODE0000/TEST123/T0000004/C0000000.LRG
0x00002AAB2B1E1320 5 0 File 1310720 1310592 0 0 /home/db2inst1/db2inst1/NODE0000/TEST123/T0000005/C0000000.LRG
0x00002AAB2B1DF9E0 6 0 Path 1 1 - 0 /home/db2inst1/db2inst1/NODE0000/TEST/T0000001/TMP_16
0x00002AAB2B1E5F00 7 0 Path 0 0 - 0 /home/db2inst1/db2inst1/NODE0000/SQL00003/TMPSYS32
--注意這裡ContainNum為容器標識,Type為容器型別,在重定向容器時要用到這2個引數,可以看出ContainNum為0,1,2,4,5指向為TEST123目錄,其餘3,6,7產生到其他目錄,可能會造成衝突導致無法建立表空間問題,故重建容器位置,如下:
[db2inst1@db2 ~]$ db2 "set tablespace containers for 3 USING (PATH '/home/db2inst1/db2inst1/NODE0000/TEST123/T0000003/USER_TMP_TBS')"
DB20000I The SET TABLESPACE CONTAINERS command completed successfully.
[db2inst1@db2 ~]$ db2 "set tablespace containers for 6 USING (PATH '/home/db2inst1/db2inst1/NODE0000/TEST123/T0000006/TMP_16')"
DB20000I The SET TABLESPACE CONTAINERS command completed successfully.
[db2inst1@db2 ~]$ db2 "set tablespace containers for 7 USING (PATH '/home/db2inst1/db2inst1/NODE0000/TEST123/T0000007/TMPSYS32')"
DB20000I The SET TABLESPACE CONTAINERS command completed successfully.
[db2inst1@db2 ~]$ db2 RESTORE DATABASE TEST CONTINUE;
--注意這裡是TEST而不是TEST123,否則會報 DB21080E No previous RESTORE DATABASE command with REDIRECT option was issued for this database alias, or the information about that command is lost.
1.將TEST資料庫的備份檔案恢復到TEST123庫
[root@db2 ~]# su - db2inst1
[db2inst1@db2 ~]$db2 RESTORE DATABASE TEST FROM '/home/db2inst1' TAKEN AT 20140910164553 INTO TEST123 REDIRECT WITHOUT ROLLING FORWARD
SQL1277W A redirected restore operation is being performed. Table space
configuration can now be viewed and table spaces that do not use automatic
storage can have their containers reconfigured.
DB20000I The RESTORE DATABASE command completed successfully.
[db2inst1@db2 ~]$ db2pd -db TEST123 -tablespaces
Database Partition 0 -- Database TEST123 -- Active -- Up 0 days 00:36:04 -- Date 06/02/2015 05:15:24
Tablespace Configuration:
Address Id Type Content PageSz ExtentSz Auto Prefetch BufID BufIDDisk FSC NumCntrs MaxStripe LastConsecPg Name
0x00002AAB2B1D4B20 0 DMS Regular 8192 4 Yes 4 1 1 Off 1 0 3 SYSCATSPACE
0x00002AAB2B1D6220 1 SMS SysTmp 8192 128 Yes 128 1 1 On 1 0 127 TEMPSPACE1
0x00002AAB2B1D9940 2 DMS Large 8192 128 Yes 128 1 1 Off 1 0 127 USERSPACE1
0x00002AAB2B1DB040 3 SMS UsrTmp 8192 128 Yes 128 1 1 On 1 0 127 USER_TMP_TBS
0x00002AAB2B1DE520 4 DMS Large 8192 128 Yes 128 2 2 Off 1 0 127 HIS_TBS_DATA
0x00002AAB2B1DFE60 5 DMS Large 8192 128 Yes 128 2 2 Off 1 0 127 HIS_TBS_INDEX
0x00002AAB2B1E1560 6 SMS SysTmp 16384 128 No 128 3 3 On 1 0 127 TMP_16
0x00002AAB2B1E4A40 7 SMS SysTmp 32768 128 No 128 4 4 On 1 0 127 TMPSYS32
Tablespace Statistics:
Address Id TotalPgs UsablePgs UsedPgs PndFreePgs FreePgs HWM Max HWM State MinRecTime NQuiescers PathsDropped
0x00002AAB2B1D4B20 0 184320 184316 0 0 0 0 0 0x02000100 0 0 No
0x00002AAB2B1D6220 1 1 1 1 0 0 0 0 0x02000100 0 0 No
0x00002AAB2B1D9940 2 606208 606080 0 0 0 0 0 0x02000100 0 0 No
0x00002AAB2B1DB040 3 0 0 0 0 0 0 0 0x02001100 0 0 No
0x00002AAB2B1DE520 4 2097152 2097024 0 0 0 0 0 0x02000100 0 0 No
0x00002AAB2B1DFE60 5 1310720 1310592 0 0 0 0 0 0x02000100 0 0 No
0x00002AAB2B1E1560 6 1 1 1 0 0 0 0 0x02001100 0 0 No
0x00002AAB2B1E4A40 7 0 0 0 0 0 0 0 0x02001100 0 0 No
Tablespace Autoresize Statistics:
Address Id AS AR InitSize IncSize IIP MaxSize LastResize LRF
0x00002AAB2B1D4B20 0 Yes Yes 33554432 -1 No None None No
0x00002AAB2B1D6220 1 Yes No 0 0 No 0 None No
0x00002AAB2B1D9940 2 Yes Yes 33554432 -1 No None None No
0x00002AAB2B1DB040 3 No No 0 0 No 0 None No
0x00002AAB2B1DE520 4 Yes Yes -2147483648 2147483648 No None None No
0x00002AAB2B1DFE60 5 Yes Yes 1073741824 1073741824 No None None No
0x00002AAB2B1E1560 6 No No 0 0 No 0 None No
0x00002AAB2B1E4A40 7 No No 0 0 No 0 None No
Containers:
Address TspId ContainNum Type TotalPgs UseablePgs PathID StripeSet Container
0x00002AAB2B1D5FE0 0 0 File 184320 184316 0 0 /home/db2inst1/db2inst1/NODE0000/TEST123/T0000000/C0000000.CAT
0x00002AAB2B1D9700 1 0 Path 1 1 0 0 /home/db2inst1/db2inst1/NODE0000/TEST123/T0000001/C0000000.TMP
0x00002AAB2B1DAE00 2 0 File 606208 606080 0 0 /home/db2inst1/db2inst1/NODE0000/TEST123/T0000002/C0000000.LRG
0x00002AAB2B0E8BC0 3 0 Path 0 0 - 0 /home/db2inst1/db2inst1/NODE0000/SQL00003/USER_TMP_TBS
0x00002AAB2B1DFC20 4 0 File 2097152 2097024 0 0 /home/db2inst1/db2inst1/NODE0000/TEST123/T0000004/C0000000.LRG
0x00002AAB2B1E1320 5 0 File 1310720 1310592 0 0 /home/db2inst1/db2inst1/NODE0000/TEST123/T0000005/C0000000.LRG
0x00002AAB2B1DF9E0 6 0 Path 1 1 - 0 /home/db2inst1/db2inst1/NODE0000/TEST/T0000001/TMP_16
0x00002AAB2B1E5F00 7 0 Path 0 0 - 0 /home/db2inst1/db2inst1/NODE0000/SQL00003/TMPSYS32
--注意這裡ContainNum為容器標識,Type為容器型別,在重定向容器時要用到這2個引數,可以看出ContainNum為0,1,2,4,5指向為TEST123目錄,其餘3,6,7產生到其他目錄,可能會造成衝突導致無法建立表空間問題,故重建容器位置,如下:
[db2inst1@db2 ~]$ db2 "set tablespace containers for 3 USING (PATH '/home/db2inst1/db2inst1/NODE0000/TEST123/T0000003/USER_TMP_TBS')"
DB20000I The SET TABLESPACE CONTAINERS command completed successfully.
[db2inst1@db2 ~]$ db2 "set tablespace containers for 6 USING (PATH '/home/db2inst1/db2inst1/NODE0000/TEST123/T0000006/TMP_16')"
DB20000I The SET TABLESPACE CONTAINERS command completed successfully.
[db2inst1@db2 ~]$ db2 "set tablespace containers for 7 USING (PATH '/home/db2inst1/db2inst1/NODE0000/TEST123/T0000007/TMPSYS32')"
DB20000I The SET TABLESPACE CONTAINERS command completed successfully.
[db2inst1@db2 ~]$ db2 RESTORE DATABASE TEST CONTINUE;
--注意這裡是TEST而不是TEST123,否則會報 DB21080E No previous RESTORE DATABASE command with REDIRECT option was issued for this database alias, or the information about that command is lost.
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/29812844/viewspace-1988783/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- DB2恢復DB2
- [DB2]DB2備份和恢復DB2
- DB2備份與恢復DB2
- Db2恢復注意事項DB2
- db2備份恢復(backup restore)DB2REST
- DB2線上備份與恢復DB2
- DB2備份恢復測試DB2
- db2恢復有關說明DB2
- db2 命令列備份和恢復DB2命令列
- DB2 恢復誤刪除的表DB2
- db2恢復到指定時間點DB2
- db2備份和恢復資料庫DB2資料庫
- DB2的資料庫備份與恢復DB2資料庫
- DB2資料庫的備份和恢復DB2資料庫
- DB2 使用表空間備份恢復庫DB2
- DB2傻瓜1000問(十二)12、DB2資料庫的備份和恢復DB2資料庫
- db2 恢復drop後的表的一個操作DB2
- oracle,db2,mysql類比之九備份與恢復OracleDB2MySql
- DB2資料庫的備份測試--開始恢復DB2資料庫
- db2 前滾最小恢復時間和時間戳問題DB2時間戳
- 淺談DB2資料庫的備份與恢復(下) (轉)DB2資料庫
- DB2:ksh: db2: not found.DB2
- DB2系列之DB2安裝DB2
- DB2 WLMDB2
- DB2 explainDB2AI
- DB2 listenerDB2
- db2概念DB2
- DB2 INFOCENTERDB2
- join (db2)DB2
- DB2 CLPDB2
- The DB2 environmentDB2
- DB2 CRASHDB2
- 轉:DB2離線和線上全備、增量備份及恢復的操作步驟DB2
- db2 -attribute of key are miss in result set . db2 錯誤DB2
- [DB2]linux下安裝db2 v9.7DB2Linux
- db2 資訊中心DB2
- db2 reorg,runstatsDB2
- DB2 安裝DB2