DB2数据库备份,冷备份、热备份、增量备份实验

  1. 造备份目录

    成都创新互联主要从事成都做网站、成都网站建设、网页设计、企业做网站、公司建网站等业务。立足成都服务永吉,10年网站建设经验,价格优惠、服务专业,欢迎来电咨询建站服务:13518219792

mkdir archivelog

mkdir backup

2.造库,用那个模板库

db2star 

3.造表,

db2 connect to sample

db2 "create table test (id int,name varchar(20),password varchar(20))"

db2 "insert into test values (1,'cto','51')"

4.改数据库参数

启用归档日志

db2 update db cfg for sample using LOGARCHMETH1 disk:/home/db2inst1/archivelog

启用增量备份

db2 update db cfg for sample using trackmod on

改完参数以后数据库处于挂起状态,需要备份一次数据库

db2 backup db ken to /home/db2inst1/backup

查看配置

db2 get db cfg for sample | grep -i log

5.接着造数据

db2 connect to sample

db2 "insert into test values (2,'51','cto')"

6.删库,不跑路

db2 drop db sample

7.恢复

db2 restore db sample from /home/db2inst1/backup taken at 20181012094410

8.前滚

db2 rollforward db sample to end of logs and complete overflow log path '(/home/db2inst1/archivelog)'

9.查看数据是否正常.

db2 "select * from test"

热备

db2 "backup db sample online to /home/db2inst1/backup"

增量备

db2 "backup db sample online incremental to /home/db2inst1/backup"

测试方式同上.


当前名称:DB2数据库备份,冷备份、热备份、增量备份实验
转载注明:http://pwwzsj.com/article/ipeshi.html