您好,登錄后才能下訂單哦!
造備份目錄
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進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。