现在的位置: 首页 > 综合 > 正文

DB2中的重定向恢复(Restore Redirect)

2018年04月26日 ⁄ 综合 ⁄ 共 2333字 ⁄ 字号 评论关闭

DB2中的重定向恢复(Restore Redirect)

新设备到了,现有的TKDW库要进行迁移。由于是新设备到货,所以在系统规划方面做了一些调整。所以在数据库RESTORE的时候需要进行重定向恢复。
下面是我在正式恢复前做的测试
1>首先在目标系统上安装DB2和fixpak。然后按照存储规划创建好相应的lv,并对Raw Device进行必要的赋权(chown)
2>在原系统上查询必要的信息
$ db2 list history backup all for tkdw
Op Obj Timestamp+Sequence Type Dev Earliest Log Current Log Backup ID
-- --- ------------------ ---- --- ------------ ------------ --------------
B D 20061030083328001 O D S0090452.LOG S0090453.LOG
----------------------------------------------------------------------------
Contains 6 tablespace(s):
00001 SYSCATSPACE
00002 USERSPACE1
00003 DATASPACE1
00004 INDEXSPACE1
00005 DATASPACE2
00006 INDEXSPACE2
----------------------------------------------------------------------------
Comment: DB2 BACKUP TKDW ONLINE
Start Time: 20061030083328
End Time: 20061030095312
----------------------------------------------------------------------------
00080 Location: /ds4100/tkdw/20061030
$ db2ckrst -d tkdw -t 20061030083328 -r database
Suggested restore order of images using timestamp 20061030083328 for
database tkdw.
====================================================================
restore db tkdw incremental taken at 20061030083328
restore db tkdw incremental taken at 20061015180935
restore db tkdw incremental taken at 20061030083328
====================================================================
$
再用list tablespaces和list tablespace containers查询表空间的信息,因为在重定向恢复的时候需要涉及到这些信息
3>等信息都收集好了之后就可以开始恢复了
db2 "restore database tkdw incremental taken at 20061030083328 redirect"
告知系统开始restore redirect
下面根据系统需要对表空间进行定义
db2 "set tablespace containers for 0 using (path '/db2sys/db2inst1/db2inst1/NODE0000/SQL00001/SQLT0000.0')"
...
定义完成后,使用restore continue完成恢复
db2 "restore database tkdw continue"
4>等必要的恢复都完成后,查询前滚恢复需要的信息
$ db2 rollforward db tkdw query status
Rollforward Status
Input database alias = tkdw
Number of nodes have returned status = 1
Node number = 0
Rollforward status = DB pending
Next log file to be read = S0090452.LOG
Log files processed = -
Last committed transaction = 2006-10-30-01.53.11.000000
$
5>将生产系统的日志FTP到目标系统,执行前滚恢复之后将库打开

$ db2 "rollforward db tkdw to end of logs and stop"

Rollforward Status
Input database alias = tkdw
Number of nodes have returned status = 1
Node number = 0
Rollforward status = not pending
Next log file to be read =
Log files processed = S0090452.LOG - S0090999.LOG
Last committed transaction = 2006-11-03-08.41.05.000000
DB20000I The ROLLFORWARD command completed successfully.
$
$ db2 connect to tkdw
Database Connection Information
Database server = DB2/AIX64 8.2.6
SQL authorization ID = DB2INST1
Local database alias = TKDW
$

抱歉!评论已关闭.