已经做过全库备份
Db2 list history backup all for sample
如果没有做过全库备份报错为:
$db2 connect to 数据库名
SQL1116N A connection to or activation of database "dbname" cannot be made because of BACKUP PENDING. SQLSTATE=56019
日志模式:归档日志log retain for recovery enabled logretain=recovery
Db2 update db cfg for dbname using logarchmeth1 logretain
1、 online 备份表空间、数据库
Db2 backup database dbname tablespace 表空间名 online to "/home/db2inst1"(备份到哪个路径下)
Db2 backup database dbname online to "/home/db2inst1" with 2 buffers buffer 1024 parallelism 1 include logs without prompting
2、将备份的数据和日志转移到测试库中
3、删除测试库中存在的相同的库
4、建立空库
5、restore数据库(注意选择的路径)
Db2 restore database dbname from "/home/db2inst1" taken at 时间点 to "/home/db2inst1" into arrail with 2 buffers buffer 1024 parallelism 1 without prompting
6、前滚日志(注意选择的路径)
Db2 rollforward db sample to end of logs and complete overflow log path(/home/db2inst1)
7、恢复表空间、前滚
Restore database dbname tablespace(表空间名) online from "/home/db2inst1" taken at 时间点 with 2 buffers buffer 1024 parallelism 1 without prompting
Rollforward database dbname sample to 时间点 using local time and complete tablespace(表空间名) online
如果觉得我的文章对您有用,请点赞。您的支持将鼓励我继续创作!
赞0
添加新评论2 条评论
2012-02-02 16:01
2012-02-02 11:18