您好,登录后才能下订单哦!
造备份目录
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"
测试方式同上.
免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。