1.问题现象
实例异常宕机或者非正常停止DB2实例,第一次数据库连接慢,此类问题与实例类异常中实例崩溃Crash相关。

2.问题诊断

通过db2pd -db <db_name> -recovery验证数据的状态:
验证db2diag.log中存在如下信息:
FUNCTION: DB2 UDB, base sys utilities, sqledint, probe:30
MESSAGE : Crash Recovery is needed.
…………………………
MESSAGE : Crash recovery started. LowtranLSN 00000008DD8927E0 MinbuffLSN 00000008DD889A55

3.恢复步骤

可以通过db2 restart db 手工出发CrashRecovery,但无法加速recovery恢复,并等待完成,观察db2diag.log如下信息:
FUNCTION: DB2 UDB, recovery manager, sqlpresr, probe:3170
MESSAGE : ADM1531E Crash recovery has completed successfully.
…………………….
FUNCTION: DB2 UDB, recovery manager, sqlpresr, probe:3170
MESSAGE : Crash recovery completed. Next LSN is 00000008DD946F9A

注意:如果以上crash recovery无法正常完成,可能数据库日志控制文件已损坏,请检查db2diag.log信息。

在db2_kill之前,可以执行脏页刷新操作:

db2pdcfg -flushbp
db2_kill

显示如下输出:

State of the bufferpools:
Oldest LSN: 0000000003E80010
Newest LSN: 0000000003E901EA
Initiating background flush.
You can use "db2pdcfg -flushbp q" to monitor the progress of the flush operation.
When the oldest LSN reported by the q option is greater than the
newest LSN reported during the initial flush, then the flush has completed.

版权声明:本文为博主原创文章,未经博主允许不得转载。

DB2