虚位以待(AD)
虚位以待(AD)
首页 > 数据库 > MongoDB数据库 > DB2数据库在线备份和恢复的操作步骤

DB2数据库在线备份和恢复的操作步骤
类别:MongoDB数据库   作者:码皇   来源:<a href="http://blog.csdn.net/tony7706" target="_blank" rel="nofollow&qu   点击:

DB2数据库在线备份和恢复的操作步骤。

DB2数据库在线备份和恢复的操作步骤。

1、数据库在线备份操作命令如下:

DB2 backup db 数据库名 online to 备份路径

例如:db2 backup db tony online to /home/db2inst/db2backup

2、数据库恢复操作命令如下:

Db2 restore db 旧数据库名 taken at 时间戳 into 恢复数据库名

例如:要把这个备份的数据库恢复到TONY这个数据库HBJRZL.0.db2inst.DBPART000.20160619201225.001

db2 restore db HBJRZL taken at 20160619201225 into TONY

备注:还原数据库时如果数据库名相同可以把into TONY省略不写

3、如果执行恢复数据库命令时出现如下提示:

http://www.ibm.com/developerworks/cn/data/library/techarticle/dm-1011db2purescalefeature/

SQL1117N A connection to or activation of database "TONY" cannot be made

because of ROLL-FORWARD PENDING. SQLSTATE=57019

4、执行以下命令:

db2 rollforward db tonydev to end of logs and complete

5、如果执行第4步,没有成功,出现以下提示:则执行第6步

SQL1273N An operation reading the logs on database "TONY" cannot continue

because of a missing log file "S0000020.LOG" on database partition "0" and log

stream "0".

6、获取 db2数据库管理配置环境信息

db2 get db cfg for 数据库名

例如:db2 get db cfg for TONY

 

7、执行第6步出现如下信息:

Database Configuration for Database tony

Database configuration release level = 0x0f00

……..........(其他内容省略)

Changed path to log files (NEWLOGPATH) =

Path to log files /home/db2inst/db2inst/NODE0000/SQL00001/LOGSTREAM0000/

Overflow log path (OVERFLOWLOGPATH) =

Mirror log path (MIRRORLOGPATH) =

First active log file = S0000020.LOG

Block log on disk full (BLK_LOG_DSK_FUL) = NO

………….. (其他内容省略)

8、找到S0000020.LOG (此日志文件根据查询出来的日志文件为准)这个日志文件,然后把此日志文件在备份的那个数据库服务器下载下来,然后上传到需要备份的数据库服务器所对应的目录下,如

/home/db2inst/db2inst/NODE0000/SQL00001/LOGSTREAM0000/

最后再次执行以下命令即可完成本次数据库恢复操作

db2 rollforward db tony to end of logs and complete


相关热词搜索: