DB2数据库备份,冷备份、热备份、增量备份实验
造备份目录
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"
测试方式同上.
免责声明:
① 本站未注明“稿件来源”的信息均来自网络整理。其文字、图片和音视频稿件的所属权归原作者所有。本站收集整理出于非商业性的教育和科研之目的,并不意味着本站赞同其观点或证实其内容的真实性。仅作为临时的测试数据,供内部测试之用。本站并未授权任何人以任何方式主动获取本站任何信息。
② 本站未注明“稿件来源”的临时测试数据将在测试完成后最终做删除处理。有问题或投稿请发送至: 邮箱/279061341@qq.com QQ/279061341