Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

DB2 database backup, cold backup, hot backup, incremental backup experiment

2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)06/01 Report--

Create a backup directory

mkdir archivelog

mkdir backup

2. Create a library, use that template library

db2star

3. tabulation,

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. Change database parameters

Enable archive logging

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

Enable incremental backups

db2 update db cfg for sample using trackmod on

After changing parameters, the database is suspended, and it needs to be backed up once.

db2 backup db ken to /home/db2inst1/backup

view the configuration

db2 get db cfg for sample | grep -i log

5. And build the data.

db2 connect to sample

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

6. Delete the library, don't run away

db2 drop db sample

7. recovery

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

8. roll forward

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

9. Check if the data is normal.

db2 "select * from test"

hot standby

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

incremental reserve

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

The test method is the same as above.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Database

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report