Chinaunix首页 | 论坛 | 博客
  • 博客访问: 1604948
  • 博文数量: 184
  • 博客积分: 3044
  • 博客等级: 中校
  • 技术积分: 2467
  • 用 户 组: 普通用户
  • 注册时间: 2006-03-25 15:04
文章分类

全部博文(184)

文章存档

2022年(4)

2021年(3)

2020年(1)

2019年(5)

2018年(13)

2017年(6)

2016年(10)

2015年(11)

2014年(11)

2013年(13)

2012年(23)

2011年(25)

2010年(2)

2008年(1)

2007年(5)

2006年(51)

分类:

2006-11-17 00:31:41

1>首先,对源数据库(Source Database)进行备份。
$db2 backup database qq online to /dev/rmt0

2>下面开始介绍备份的相关操作。
$db2 restore database qq from /dev/rmt0 redirect 

(其中的redirect表示进行重定向恢复)

SQL1277N  Restore has detected that one or more table space containers are
inaccessible, or has set their state to 'storage must be defined'.
DB20000I  The RESTORE DATABASE command completed successfully.

$db2 "set tablespace containers for 0 using (path '/db2sys/db2inst2/db2inst2/NODE0000/SQL00001/SQLT0000.0')"

DB20000I  The SET TABLESPACE CONTAINERS command completed successfully.

$db2 "set tablespace containers for 1 using (path '/db2sys/db2inst2/db2inst2/NODE0000/SQL00001/SQLT0001.0')"

$db2 "set tablespace containers for 2 using (path '/db2sys/db2inst2/db2inst2/NODE0000/SQL00001/SQLT0002.0')"

(使用set tablespace containers命令对表空间容器进行新的定义,这里可以根据目标数据库的实际规划对目标表空间进行空间调整)

3>重定向设置完成后,继续进行恢复。
$db2 restore database qq continue

continue表示继续,还可以使用abort来中止恢复操作)

DB20000I  The RESTORE DATABASE command completed successfully.

4>到这里数据库的恢复操作已经完成,接下来还需要将相关的日志copy到目标数据库的日志目录下

5>最后进行数据库的前滚恢复操作
$db2 rollforward db qq to end of logs and complete

                               Rollforward Status

 Input database alias                   = qq
 Number of nodes have returned status   = 1

 Node number                            = 0
 Rollforward status                     = not pending
 Next log file to be read               =
 Log files processed                    = S0000016.LOG - S0000016.LOG
 Last committed transaction             = 2005-06-09-01.34.59.000000

DB20000I  The ROLLFORWARD command completed successfully.

此时数据库已经成功的被重定向恢复。

6>进行一些后续的操作进行相关检验。
$ db2 connect to qq

   Database Connection Information

 Database server        = DB2/AIX64 8.1.6
 SQL authorization ID   = DB2INST5
 Local database alias   = QQ

阅读(1373) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~