DB2备份恢复流程

数据库的归档日志设置和数据库前滚恢复

1.设置归档日志 可以有多种设置方法,具体参考InfoCenter CMD: login (user: db2inst1) db2 connect to sample db2 update db cfg using LOGARCHMETH1 logretain

2.设置成归档日志后的备份 设置成归档日志后的数据库处在备份暂挂(BACKUP PENDING)状态,需要进行备份 CMD: db2 connect to sample SQL1116N A connection to or activation of database “SAMPLE” cannot be made because of BACKUP PENDING. SQLSTATE=57019 CMD: db2 backup database sample to /mnt/hgfs/F/backup/ Backup successful. The timestamp for this backup image is : 20100624210336 备份后数据库恢复正常。

3.数据修改 CMD: db2 “insert into act values(999, ‘TEST’, ‘TESTDESC’)” db2 “select * from act” ACTNO ACTKWD ACTDESC —— —— ——————– 10 MANAGE MANAGE/ADVISE 20 ECOST ESTIMATE COST 30 DEFINE DEFINE SPECS 40 LEADPR LEAD PROGRAM/DESIGN 50 SPECS WRITE SPECS 60 LOGIC DESCRIBE LOGIC 70 CODE CODE PROGRAMS 80 TEST TEST PROGRAMS 90 ADMQS ADM QUERY SYSTEM 100 TEACH TEACH CLASSES 110 COURSE DEVELOP COURSES 120 STAFF PERS AND STAFFING 130 OPERAT OPER COMPUTER SYS 140 MAINT MAINT SOFTWARE SYS 150 ADMSYS ADM OPERATING SYS 160 ADMDB ADM DATA BASES 170 ADMDC ADM DATA COMM 180 DOC DOCUMENT 999 TEST TESTDESC

4.误操作删除表空间 CMD: cd /home/db2inst1/db2inst1/NODE0000/SAMPLE mv * /mnt/hgfs/F/TS ls db2 connect reset db2 connect to sample SQL0293N Error accessing a table space container. SQLSTATE=57048

5.备份中恢复 db2 restore database sample from /mnt/hgfs/F/backup/ SQL2539W Warning! Restoring to an existing database that is the same as the backup image database. The database files will be deleted. Do you want to continue ? (y/n) Y DB20000I The RESTORE DATABASE command completed successfully. 6.回复后数据库处于前滚暂挂(ROLL-FORWARD PENDING)状态 db2 connect to sample SQL1117N A connection to or activation of database “SAMPLE” cannot be made because of ROLL-FORWARD PENDING. SQLSTATE=57019

7.执行前滚恢复 CMD: db2 rollforward database sample to end of logs and stop Rollforward Status

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

Node number = 0 Rollforward status = not pending Next log file to be read = Log files processed = S0000000.LOG – S0000000.LOG Last committed transaction = 2010-06-25-04.28.39.000000 UTC

DB20000I The ROLLFORWARD command completed successfully.

8.数据确认 CMD: db2 connect to sample db2 “select * from act” ACTNO ACTKWD ACTDESC —— —— ——————– 10 MANAGE MANAGE/ADVISE 20 ECOST ESTIMATE COST 30 DEFINE DEFINE SPECS 40 LEADPR LEAD PROGRAM/DESIGN 50 SPECS WRITE SPECS 60 LOGIC DESCRIBE LOGIC 70 CODE CODE PROGRAMS 80 TEST TEST PROGRAMS 90 ADMQS ADM QUERY SYSTEM 100 TEACH TEACH CLASSES 110 COURSE DEVELOP COURSES 120 STAFF PERS AND STAFFING 130 OPERAT OPER COMPUTER SYS 140 MAINT MAINT SOFTWARE SYS 150 ADMSYS ADM OPERATING SYS 160 ADMDB ADM DATA BASES 170 ADMDC ADM DATA COMM 180 DOC DOCUMENT 999 TEST TESTDESC

备份后的数据变化被前滚恢复了。

转载自:http://blog.sina.com.cn/s/blog_68bd10c701014zou.html

本文参与腾讯云自媒体分享计划,欢迎正在阅读的你也加入,一起分享。

发表于

我来说两句

0 条评论
登录 后参与评论

相关文章

来自专栏落花落雨不落叶

canvas画简单电路图

62111
来自专栏菩提树下的杨过

Flash/Flex学习笔记(23):运动学原理

先写一个公用的小球类Ball: package{ import flash.display.Sprite; //小球 类 public class B...

25310
来自专栏张善友的专栏

Silverlight + Model-View-ViewModel (MVVM)

     早在2005年,John Gossman写了一篇关于Model-View-ViewModel模式的博文,这种模式被他所在的微软的项目组用来创建Expr...

2978
来自专栏大内老A

The .NET of Tomorrow

Ed Charbeneau(http://developer.telerik.com/featured/the-net-of-tomorrow/) Exciti...

31810
来自专栏Ceph对象存储方案

Luminous版本PG 分布调优

Luminous版本开始新增的balancer模块在PG分布优化方面效果非常明显,操作也非常简便,强烈推荐各位在集群上线之前进行这一操作,能够极大的提升整个集群...

3145
来自专栏陈仁松博客

ASP.NET Core 'Microsoft.Win32.Registry' 错误修复

今天在发布Asp.net Core应用到Azure的时候出现错误InvalidOperationException: Cannot find compilati...

4868
来自专栏我和未来有约会

Kit 3D 更新

Kit3D is a 3D graphics engine written for Microsoft Silverlight. Kit3D was inita...

2546
来自专栏闻道于事

js登录滑动验证,不滑动无法登陆

js的判断这里是根据滑块的位置进行判断,应该是用一个flag判断 <%@ page language="java" contentType="text/html...

6858
来自专栏ASP.NETCore

ASP.NET Core 整合Autofac和Castle实现自动AOP拦截

除了ASP.NETCore自带的IOC容器外,我们还可以使用其他成熟的DI框架,如Autofac,StructureMap等(笔者只用过Unity,Ninjec...

674
来自专栏我和未来有约会

Silverlight第三方控件专题

这里我收集整理了目前网上silverlight第三方控件的专题,若果有所遗漏请告知我一下。 名称 简介 截图 telerik 商 RadC...

4035

扫码关注云+社区