如果DB2数据库遭受断电或者异常关闭,数据库没有干净的关闭,那么数据库在启动的时候将会
进行crash recovery. 但是如果数据库参数AUTORESTART设置为OFF的话,在启动数据库后DB2不会
进行CRASH RECOVERY。我们在连接到数据库的时候将会报SQL1015N 错误。
[yansp@db2server ~]$ db2 get db cfg for oracle | grep AUTORESTART
Auto restart enabled (AUTORESTART) = OFF
db2 => connect to oracle @
SQL1015N The database is in an inconsistent state. SQLSTATE=55025
这个时候需要我们手工进行CRASH RECOVERY。
db2 => restart database oracle @
DB20000I The RESTART DATABASE command completed successfully.
db2 => connect to oracle @
Database Connection Information
Database server = DB2/LINUX 9.7.0
SQL authorization ID = YANSP
Local database alias = ORACLE
通过日志文件我们看一下DB2 CRASH RECOVERY的过程。
2013-02-03-06.27.22.704092+480 I1529901G434 LEVEL: Warning
PID : 9899 TID : 2947541904 PROC : db2sysc 0
INSTANCE: yansp NODE : 000 DB : ORACLE
APPHDL : 0-15 APPID: *LOCAL.yansp.130202222719
AUTHID : YANSP
EDUID : 35 EDUNAME: db2agent (ORACLE) 0
FUNCTION: DB2 UDB, base sys utilities, sqledint, probe:30
MESSAGE : Crash Recovery is needed.
<-- 需要进行crash recovery
2013-02-03-06.27.31.389376+480 I1530336G497 LEVEL: Warning
PID : 9899 TID : 2947541904 PROC : db2sysc 0
INSTANCE: yansp NODE : 000 DB : ORACLE
APPHDL : 0-15 APPID: *LOCAL.yansp.130202222719
AUTHID : YANSP
EDUID : 35 EDUNAME: db2agent (ORACLE) 0
FUNCTION: DB2 UDB, recovery manager, sqlpresr, probe:410
MESSAGE : Crash recovery started. LowtranLSN 00000000252E0010 MinbuffLSN
<--启动 Crash recovery
00000000252E0010
2013-02-03-06.27.31.463994+480 E1530834G451 LEVEL: Warning
PID : 9899 TID : 2947541904 PROC : db2sysc 0
INSTANCE: yansp NODE : 000 DB : ORACLE
APPHDL : 0-15 APPID: *LOCAL.yansp.130202222719
AUTHID : YANSP
EDUID : 35 EDUNAME: db2agent (ORACLE) 0
FUNCTION: DB2 UDB, recovery manager, sqlpresr, probe:410
MESSAGE : ADM1530E Crash recovery has been initiated.
<-初始化 Crash recovery
2013-02-03-06.27.31.643060+480 I1531286G492 LEVEL: Warning
PID : 9899 TID : 2947541904 PROC : db2sysc 0
INSTANCE: yansp NODE : 000 DB : ORACLE
APPHDL : 0-15 APPID: *LOCAL.yansp.130202222719
AUTHID : YANSP
EDUID : 35 EDUNAME: db2agent (ORACLE) 0
FUNCTION: DB2 UDB, recovery manager, sqlprecm, probe:2000
DATA #1 :
Using parallel recovery with 3 agents 8 QSets 24 queues and 16 chunks <- 启动并行进程来进行Crash recovery
2013-02-03-06.27.31.933175+480 I1531779G351 LEVEL: Warning
PID : 9899 TID : 2945444752 PROC : db2sysc 0
INSTANCE: yansp NODE : 000
EDUID : 40 EDUNAME: db2lfr (ORACLE) 0
FUNCTION: DB2 UDB, data protection services, sqlpgarl, probe:99
MESSAGE : INFO ONLY: Found an old page in the log file <-DB2发现日志文件中有OLD PAGE
2013-02-03-06.27.32.700437+480 I1532131G507 LEVEL: Warning
PID : 9899 TID : 2947541904 PROC : db2sysc 0
INSTANCE: yansp NODE : 000 DB : ORACLE
APPHDL : 0-15 APPID: *LOCAL.yansp.130202222719
AUTHID : YANSP
EDUID : 35 EDUNAME: db2agent (ORACLE) 0
FUNCTION: DB2 UDB, recovery manager, sqlprecm, probe:4000
MESSAGE : DIA2051W Forward phase of crash recovery has completed. Next LSN is <--前滚恢复完成
"00000000252E7400".
2013-02-03-06.27.33.293191+480 E1532639G460 LEVEL: Warning
PID : 9899 TID : 2947541904 PROC : db2sysc 0
INSTANCE: yansp NODE : 000 DB : ORACLE
APPHDL : 0-15 APPID: *LOCAL.yansp.130202222719
AUTHID : YANSP
EDUID : 35 EDUNAME: db2agent (ORACLE) 0
FUNCTION: DB2 UDB, recovery manager, sqlpresr, probe:3170
MESSAGE : ADM1531E Crash recovery has completed successfully. <--CRASH RECOVERY成功完成
2013-02-03-06.27.33.294698+480 I1533100G462 LEVEL: Warning
PID : 9899 TID : 2947541904 PROC : db2sysc 0
INSTANCE: yansp NODE : 000 DB : ORACLE
APPHDL : 0-15 APPID: *LOCAL.yansp.130202222719
AUTHID : YANSP
EDUID : 35 EDUNAME: db2agent (ORACLE) 0
FUNCTION: DB2 UDB, recovery manager, sqlpresr, probe:3170
MESSAGE : Crash recovery completed. Next LSN is 00000000252E7400
2013-02-03-06.27.34.627484+480 E1533563G464 LEVEL: Event
PID : 9899 TID : 2949639056 PROC : db2sysc 0
INSTANCE: yansp NODE : 000 DB : ORACLE
APPHDL : 0-16 APPID: *LOCAL.DB2.130202222734
AUTHID : YANSP
EDUID : 34 EDUNAME: db2stmm (ORACLE) 0
FUNCTION: DB2 UDB, Self tuning memory manager, stmmLog, probe:1008
DATA #1 :
Starting STMM log from file number 0
整个恢复过程都是有主控进程PID=9899 DB2SYSC进程来完成的。
[yansp@db2server ~]$ ps -ef | grep 9899
yansp 9899 9897 0 06:16 pts/0 00:00:06 db2sysc 0
root 9900 9899 0 06:16 pts/0 00:00:00 db2ckpwd 0
root 9901 9899 0 06:16 pts/0 00:00:00 db2ckpwd 0
root 9902 9899 0 06:16 pts/0 00:00:00 db2ckpwd 0
yansp 12571 11322 1 06:33 pts/2 00:00:00 grep 9899
阅读(10002) | 评论(0) | 转发(0) |