db2培训(8)数据库备份恢复精品PPT课件
合集下载
相关主题
- 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
- 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
- 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。
Log size (LOGFILSIZ)
Log Buffer (LOGBUFSIZ)
Primary Log
Archive Method
Y
N
(LOGARCHMETH1)
E
DEFAULT
S
O
Secondary Log
Archive Method
(LOGARCHMETH2)
Number of commits
Requests for Reads and Writes
Externalized
TABLES
Commit Log Buffer Full
LOGS
循环日志(Circular logging)
1
"n" PRIMARY
2
3
1
"n"
SECONDARY
归档日志(Archival logging)
Manual or
newlogpath
S~3.LOG
S~4.LOG
S~5.LOG
SQL0000n SQLOGDIR
/2nd/choice
Different disk drive and potentially a different disk controller unit
mirrorlogpath S~3.LOG S~4.LOG S~5.LOG
S~0.LOG S~1.LOG S~2.LOG
数据库日志相关的一些参数
Primary log files (LOGPRIMARY)
Secondary log files (LOGSECOND)
?
+
?
New log path (NEWLOGPATH)
Mirror log path (MIRRORLOGPATH)
备份时点的选择?
三种恢复方法
VERSION -or-
RESTORE
Backup (1 AM)
LOG RECORDS . . .
CRASH Now (3 PM)
ROLLFORWARD
日志原理
Buffer Pool
Current Row
Log Buffer
Insert Update
Delete
New Row Old Row
• Update:
db2 update db cfg for musicdb using logprimary 15
Log retain for recovery status
= NO
User exit for logging status
= NO
Catalog cache size (4KB)
(CATALOGCACHE_SZ) = 260
Changed path to log files
(NEWLOGPATH) =
Path to log files
= C:\DB2\NODE0000\SQL0000Biblioteka Baidu\SQLOGDIR\
Overflow log path
(OVERFLOWLOGPATH) =
Mirror log path
(MIRRORLOGPATH) =
数据库备份恢复
单元目标
• 描述DB2备份恢复的原理和方法 • DB2的三种恢复类型 • 日志原理 • 循环日志和归档日志的使用 • BACKUP命令用法 • RESTORE命令用法 • ROLLFORWARD命令用法 • 相关的配置参数 • 恢复历史文件的使用
可能出现的错误类型
HARDWARE
MEDIA
OPERATIONAL
SOFTWARE
POWER
备份/恢复策略制定
备份对象:
✓ 数据库备份 ✓ 表空间备份
备份类型:
✓ 在线备份(online backup) ✓ 离线备份(offline backup)
备份数据:
✓ 全备(full backup) ✓ 增量备份(incremental backup) ✓ incremental delta backup
Automatic Archive
OFFLINE ARCHIVE — Archive moved from ACTIVE log subdirectory (may also be on other media
12
ACTIVE — Contains
information for non-
committed or non13 externalized transactions
14
ONLINE ARCHIVE —
Contains information
15
for committed and
externalized transactions.
Stored in the ACTIVE
16
log subdirectory.
日志存放位置
Instance
/your/choice
NODE0000
Log buffer size (4KB)
(LOGBUFSZ) = 98
Log (4KB)
(LOGFILSIZ) = 1024
Number of primary log files
(LOGPRIMARY) = 13
Number of secondary log files
(LOGSECOND) = 4
Log records to write
to group
before soft checkpoint
(MINCOMMIT)
?
-
?
(SOFTMAX)
通过命令行查看和配置数据库日志参数
• Windows: db2 get db cfg for musicdb | find /i "log"
• Linux/UNIX: db2 get db cfg for musicdb | grep –i log
Percent log before soft chckpt (SOFTMAX) = 520
Log retain for recovery enabled
(LOGRETAIN) = OFF
User exit for logging enabled
(USEREXIT) = OFF
HADR log write synchronization mode
First active log file
=
Block log on disk full
(BLK_LOG_DSK_FUL) = NO
Percent max primary log space by transaction (MAX_LOG) = 0
Num. of active log files for 1 active UOW(NUM_LOG_SPAN) = 0