Professional Documents
Culture Documents
Information Management
Information Management
Common problems:
System outage
Power failure
Hardware failure
Transaction failure
Users may inadvertently corrupt the database
Media failure
Disk drive becomes unusable
Disaster
Database facility damaged by fire, flooding
or other catastrophe
Information Management
Database
at
t1
Database
at
logs
t1
Database continues to
process transactions.
Transactions are
recorded in log files
t1
Perform a
database
backup
database
Backup
t2
Disaster strikes, Database
is damaged
t3
Perform a database restore
using the backup image. The
restored database is
identical to the database at
t1
Image
Information Management
During the recovery process, DB2 examines these logs and decides which
changes to redo or undo
Package cache
Update
transaction
Log Buffer
Update
transaction
Bufferpool
Page indexes
Old
transactions
Information to be
updated is retrieved from
disk (if needed)
Information Management
Active logs
Transactions that have not been committed or rolled back
Log Buffer
Update
transaction
Bufferpool
Page
indexesto be
Information
Old
transactions
updated is retrieved
from disk (if needed)
Disk for
the
database
Active
Log
Directory
Information Management
Circular Logging
Primary log files used to record all transactions; reused when transactions are
committed
Secondary log files allocated when next primary log file is not available due to active
transactions
If both primary and secondary log limit are full and can not be reused, a log full
condition occurs and SQL0964C error message is returned
Transactions
DB2 Server
1
2
Active log
file
6
Primary
logs
3
4
Secondary logs
2010 IBM Corporation
Information Management
Archival Logging
Information Management
Infinite Logging
Secondary log files are allocated until the unit of work commits or
storage is exhausted
Control parameters
NUM_LOG_SPAN number of log files an active transaction can
span
MAX_LOG Percentage of active primary log file space that a
single transaction could consume
Information Management
Database Backup
Backup modes:
Offline Backup
Does not allow other applications or processes to access
the database
Only option when using circular logging
Online Backup
Allows other applications or processes to access the
database
Available to users during backup
Can backup to disk, tape, TSM and other storage vendors
2010 IBM Corporation
Information Management
10
Information Management
Alias
Instance
Catalog Node
Year
SAMPLE.0.DB2INST.NODE0000.CATN0000.20100314131259.001
Type
Node
Month
Hour Second
Backup Type:
0 = Full Backup
3 = Tablespace Backup
11
Information Management
Table space backup can run in both online and offline backup
12
Information Management
Incremental Backups
Sunday
Fu
ll
Fu
ll
13
Mon
Tue
Wed
Thu
Fri
Sat
Cumulative
Backups
Delta
Backups
Sunday
Fu
ll
Fu
ll
Incremental (a.k.a. cumulative) - Backup of all database data that has changed since the
most recent, successful, full backup operation
Incremental Delta - Backup of all database data that has changed since the last
successful backup (full, incremental, or delta) operation.
Information Management
Performance characteristics
CPU costs typically increased (due to compression computation)
Media I/O time typically decreased (due to decreased image size)
Overall backup/restore performance can increase or decrease; depending
on whether CPU or media I/O is a bottleneck
Example:
db2 backup database DS2 to /home/db2inst1/backups compress
14
Information Management
Stored procedure
AUTOMAINT_SET_POLICY system stored procedure
15
Information Management
16
Information Management
Database Recovery
17
Information Management
18
Information Management
19
Restored table space is in Roll Forward Pending state and can be either
rolled forward to End of Logs or a Point In Time.
In case of Point in Time roll forward, table space must be rolled forward to
at least the minimum Point in Time
Every time there is a DDL changed, minimum recovery time for the table
space is revised to indicate the last DDL change.
Recommended to take a table space backup after a table space has been
restore to a point in time.
Transactions that came after the point in time are lost, therefore take a
table space backup as new point of reference for future recoveries.
Information Management
Incremental Restore
20
Questions?
Summer/Fall 2010
E-mail: imschool@us.ibm.com
Subject: DB2 Academic Workshop
Information Management