The following articles mainly describe the DB2 Online backup solution. The following describes the specific content of the DB2 Online backup solution and hope it will help you in your future studies. If you are interested in the actual operations, you can click to view the following articles.
Online, Solution
Modify database Parameters
# Modifying database DB2 Online backup Parameters
- db2 update db cfg using logretain recovery
- db2 update db cfg using userexit yes
- db2 update db cfg using trackmod yes
# Offline database backup
- 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
# Creating a path
- su – root
- mkdir /db2log/ QNCENTER/NODE0000
# Grant recursive permission to each directory in the directory structure
- chmod 777 /db2log
# Changing a group
- chown -R db2inst1:db2grp1 /db2log
4. Set backup script
# Online full DB2 Online 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
# Backing up Archive Log
- tar zcvf $`date +%Y%m%d`_arc.tar.gz /db2log/CEILING
5. database recovery plan
# Restore an Archive Log
- tar xvf $`date +%Y%m%d`_arc.tar.gz
# Make sure that the database has a full backup.
# Media recovery
- db2 restore db qncenter from /home/db2inst1 taken at Timestamp
# Archive Log rollback
- db2 rollforward database qncenter to end of logs and stop
# Archive logs for DB2 Online backups
- 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 an introduction to the DB2 Online backup solution. I hope you will have some gains.