The following articles mainly describe the actual operation solution of DB2 Online backup. This article describes how to modify Database parameters and modify the relevant parameters of database online backup, the following describes the main content of the text.
Online, solution Online, Solution
Modify database Parameters
Modify online database backup Parameters
- db2 update db cfg using logretain recovery
- db2 update db cfg using userexit yes
- db2 update db cfg using trackmod yes
Offline DB2 Online backup database
- db2 terminate
- db2 backup db qncenter to /home/db2inst1
2. modify the program
Copy source program
- cp /home/db2inst1/sqllib/samples/c/ db2uext2.cdisk /home/db2inst1/sqllib/adm/db2uext2.c
- vi /home/db2inst1/sqllib/adm/db2uext2.c
Modify content
- define ARCHIVE_PATH "/db2log/"
- define RETRIEVE_PATH "/db2log/"
- define AUDIT_ACTIVE 1
- define ERROR_ACTIVE 1
- define AUDIT_ERROR_PATH "/db2log/"
- define AUDIT_ERROR_ATTR "a"
- define BUFFER_SIZE 32
Compile
- cc -D_INCLUDE_POSIX_SOURCE db2uext2.c -o db2uext2
3. Configure the Archive Log Path
Create path
- su – root
- mkdir /db2log/ QNCENTER/NODE0000
Grant recursive permission to each directory in the directory structure
- chmod 777 /db2log
Change Group
- chown -R db2inst1:db2grp1 /db2log
4. Set the DB2 Online backup script
Online full backup
- db2 backup db qncenter online to /home/db2inst1/ >`date +%Y%m%d`.bklog 2>&1
Online Incremental Backup
- db2 backup db qncenter online incremental delta to /home/db2inst1 >`date +%Y%m%d`.bklog 2>&1
Back up Archive Log
- tar zcvf $`date +%Y%m%d`_arc.tar.gz /db2log/CEILING
5. database recovery plan
Restore Archive Log
Tar xvf $ 'date when policyuncdomaind'_arc.tar.gz
To recover the database, you must ensure that the database has a full backup.
Media recovery
- db2 restore db qncenter from /home/db2inst1 taken at Timestamp
Perform Archive Log rollback
- db2 rollforward database qncenter to end of logs and stop
If archive logs are backed up offline
- db2 restore db qncenter from /home/db2inst1 taken at Timestamp
- db2 rollforward database qncenter to end of logs and stop
Offline backup
- db2 backup db qncenter to /home/db2inst1/
If there is no archive log for offline backup
- db2 restore db qncenter from /home/db2inst1 taken at Timestamp without rolling forward
The above content is a description of the DB2 Online backup solution, hoping to help you in this regard.