Get the App
SLTechnology News&Howtos  ›  Database  › 

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

Shulou Source: shulou.com Published: 2022-06-01 09:26:12 09月14日 Update

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.

Tags: Data backup database increment parameter method log template status directory test configuration experiment Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Xiaomi Linux NVidia MariaDB Huawei