Lin Hong's TECH Blog! 刀不磨要生锈,人不学习要落后 - Thinking ahead

[原创]CentOS安装db2后启动异常SQL1042C

2016-05-31
DB2
 

碰到SQL1042C,有时让人无从下手,而在Linux下启动实例碰到SQL1042C错误,很常见的的一个原因是此种类型的错误!

db2inst1:/dbhome/db2inst1$ db2start 05/31/2016 11:16:27 0 0 SQL1042C An unexpected system error occurred. SQL1032N No start database manager command was issued. SQLSTATE=57019 db2inst1:/dbhome/db2inst1$

问题描述

环境

  • 平台:CentOS 7/64bit

  • DB2版本:DB2 v10.5.0.3

安装完之后启动实例报:SQL1042C错误(这种错误比较头疼,涉及到OS层面的错误)

db2inst1:/dbhome/db2inst1$ db2start
05/31/2016 11:16:27     0   0   SQL1042C  An unexpected system error occurred.
SQL1032N  No start database manager command was issued.  SQLSTATE=57019
db2inst1:/dbhome/db2inst1$

再看看详细的db2diag日志信息

如下

db2inst1:/dbhome/db2inst1$ db2diag -H 10
2016-05-31-11.16.27.436043+540 I32148E397            LEVEL: Event
PID     : 29776                TID : 140633656588064 PROC : db2start
INSTANCE: db2inst1             NODE : 000
HOSTNAME: mydb2server
FUNCTION: DB2 UDB, base sys utilities, sqleGetStStLockFile, probe:14303
MESSAGE : Obtained exclusive mode lock on the file:
DATA #1 : String, 41 bytes
/dbhome/db2inst1/sqllib/ctrl/db2strst.lck

2016-05-31-11.16.27.462687+540 I32546E1668           LEVEL: Event
PID     : 29776                TID : 140633656588064 PROC : db2start
INSTANCE: db2inst1             NODE : 000
HOSTNAME: mydb2server
FUNCTION: DB2 UDB, base sys utilities, sqleStartStopSingleNode, probe:1130
DATA #1 : String, 36 bytes
/dbhome/db2inst1/sqllib/adm/db2star2
DATA #2 : Hexdump, 256 bytes
0x00007FFEBF991160 : 2F64 6268 6F6D 652F 6462 3269 6E73 7431    /dbhome/db2inst1
0x00007FFEBF991170 : 2F73 716C 6C69 622F 6164 6D2F 6462 3273    /sqllib/adm/db2s
0x00007FFEBF991180 : 7461 7232 004E 4F4D 5347 0000 0000 0000    tar2.NOMSG......
0x00007FFEBF991190 : 0000 0000 0000 0000 0000 0000 0000 0000    ................
0x00007FFEBF9911A0 : 0000 0000 0000 0000 0000 0000 0000 0000    ................
0x00007FFEBF9911B0 : 0000 0000 0000 0000 0000 0000 0000 0000    ................
0x00007FFEBF9911C0 : 0000 0000 0000 0000 0000 0000 0000 0000    ................
0x00007FFEBF9911D0 : 0000 0000 0000 0000 0000 0000 0000 0000    ................
0x00007FFEBF9911E0 : 0000 0000 0000 0000 0000 0000 0000 0000    ................
0x00007FFEBF9911F0 : 0000 0000 0000 0000 0000 0000 0000 0000    ................
0x00007FFEBF991200 : 0000 0000 0000 0000 0000 0000 0000 0000    ................
0x00007FFEBF991210 : 0000 0000 0000 0000 0000 0000 0000 0000    ................
0x00007FFEBF991220 : 0000 0000 0000 0000 0000 0000 0000 0000    ................
0x00007FFEBF991230 : 0000 0000 0000 0000 0000 0000 0000 0000    ................
0x00007FFEBF991240 : 0000 0000 0000 0000 0000 0000 0000 0000    ................
0x00007FFEBF991250 : 0000 0000 0000 0000 0000 0000 0000 0000    ................

2016-05-31-11.16.27.590636+540 I34215E397            LEVEL: Event
PID     : 29778                TID : 140241521518368 PROC : db2star2
INSTANCE: db2inst1             NODE : 000
HOSTNAME: mydb2server
FUNCTION: DB2 UDB, base sys utilities, sqleGetStStLockFile, probe:14303
MESSAGE : Obtained exclusive mode lock on the file:
DATA #1 : String, 41 bytes
/dbhome/db2inst1/sqllib/ctrl/db2stst.0000

2016-05-31-11.16.27.627037+540 E34613E1038           LEVEL: Error (OS)
PID     : 29778                TID : 140241521518368 PROC : db2star2
INSTANCE: db2inst1             NODE : 000
HOSTNAME: mydb2server
FUNCTION: DB2 UDB, oper system services, sqloopenp, probe:80
MESSAGE : ZRC=0x870F0002=-2029060094=SQLO_BPSE "Debug logic error detected"
	  DIA8501C A buffer pool logic error has occurred.
CALLED  : OS, -, open                             OSERR: EINVAL (22)
DATA #1 : Codepath, 8 bytes
5:6:11:18:20:24:40
DATA #2 : File name, 61 bytes
/dbhome/db2inst1/sqllib/ctrlha/.db2.000.mydb2server.pgrp
DATA #3 : SQO Open File Options, PD_TYPE_SQO_FILE_OPEN_OPTIONS, 4 bytes
SQLO_CRTREV, SQLO_READWRITE, SQLO_SHAREWRITE, SQLO_FORCE_NON_BUFFERED, SQLO_WRITETHRU, SQLO_SECURE
DATA #4 : Hex integer, 4 bytes
0x000001B4
DATA #5 : signed integer, 4 bytes
0
DATA #6 : Hex integer, 4 bytes
0x00004000
DATA #7 : String, 105 bytes
Search for ossError*Analysis probe point after this log entry for further
self-diagnosis of this problem.

2016-05-31-11.16.27.628040+540 E35652E1038           LEVEL: Error (OS)
PID     : 29778                TID : 140241521518368 PROC : db2star2
INSTANCE: db2inst1             NODE : 000
HOSTNAME: mydb2server
FUNCTION: DB2 UDB, oper system services, sqloopenp, probe:80
MESSAGE : ZRC=0x870F0002=-2029060094=SQLO_BPSE "Debug logic error detected"
	  DIA8501C A buffer pool logic error has occurred.
CALLED  : OS, -, open                             OSERR: EINVAL (22)
DATA #1 : Codepath, 8 bytes
5:6:11:18:20:24:40
DATA #2 : File name, 61 bytes
/dbhome/db2inst1/sqllib/ctrlha/.db2.000.mydb2server.pgrp
DATA #3 : SQO Open File Options, PD_TYPE_SQO_FILE_OPEN_OPTIONS, 4 bytes
SQLO_CRTREV, SQLO_READWRITE, SQLO_SHAREWRITE, SQLO_FORCE_NON_BUFFERED, SQLO_WRITETHRU, SQLO_SECURE
DATA #4 : Hex integer, 4 bytes
0x000001B4
DATA #5 : signed integer, 4 bytes
0
DATA #6 : Hex integer, 4 bytes
0x00004000
DATA #7 : String, 105 bytes
Search for ossError*Analysis probe point after this log entry for further
self-diagnosis of this problem.

2016-05-31-11.16.27.628710+540 E36691E1051           LEVEL: Error (OS)
PID     : 29778                TID : 140241521518368 PROC : db2star2
INSTANCE: db2inst1             NODE : 000
HOSTNAME: mydb2server
FUNCTION: DB2 UDB, oper system services, sqloopenp, probe:80
MESSAGE : ZRC=0x870F0002=-2029060094=SQLO_BPSE "Debug logic error detected"
	  DIA8501C A buffer pool logic error has occurred.
CALLED  : OS, -, open                             OSERR: EINVAL (22)
DATA #1 : Codepath, 8 bytes
5:6:11:18:20:24:40
DATA #2 : File name, 74 bytes
/dbhome/db2inst1/sqllib/ctrlhamirror/.db2.000.mydb2server.pgrp.mirror
DATA #3 : SQO Open File Options, PD_TYPE_SQO_FILE_OPEN_OPTIONS, 4 bytes
SQLO_CRTREV, SQLO_READWRITE, SQLO_SHAREWRITE, SQLO_FORCE_NON_BUFFERED, SQLO_WRITETHRU, SQLO_SECURE
DATA #4 : Hex integer, 4 bytes
0x000001B4
DATA #5 : signed integer, 4 bytes
0
DATA #6 : Hex integer, 4 bytes
0x00004000
DATA #7 : String, 105 bytes
Search for ossError*Analysis probe point after this log entry for further
self-diagnosis of this problem.

2016-05-31-11.16.27.629342+540 E37743E1051           LEVEL: Error (OS)
PID     : 29778                TID : 140241521518368 PROC : db2star2
INSTANCE: db2inst1             NODE : 000
HOSTNAME: mydb2server
FUNCTION: DB2 UDB, oper system services, sqloopenp, probe:80
MESSAGE : ZRC=0x870F0002=-2029060094=SQLO_BPSE "Debug logic error detected"
	  DIA8501C A buffer pool logic error has occurred.
CALLED  : OS, -, open                             OSERR: EINVAL (22)
DATA #1 : Codepath, 8 bytes
5:6:11:18:20:24:40
DATA #2 : File name, 74 bytes
/dbhome/db2inst1/sqllib/ctrlhamirror/.db2.000.mydb2server.pgrp.mirror
DATA #3 : SQO Open File Options, PD_TYPE_SQO_FILE_OPEN_OPTIONS, 4 bytes
SQLO_CRTREV, SQLO_READWRITE, SQLO_SHAREWRITE, SQLO_FORCE_NON_BUFFERED, SQLO_WRITETHRU, SQLO_SECURE
DATA #4 : Hex integer, 4 bytes
0x000001B4
DATA #5 : signed integer, 4 bytes
0
DATA #6 : Hex integer, 4 bytes
0x00004000
DATA #7 : String, 105 bytes
Search for ossError*Analysis probe point after this log entry for further
self-diagnosis of this problem.

2016-05-31-11.16.27.629936+540 E38795E1525           LEVEL: Severe
PID     : 29778                TID : 140241521518368 PROC : db2star2
INSTANCE: db2inst1             NODE : 000
HOSTNAME: mydb2server
FUNCTION: DB2 UDB, oper system services, sqloCreatePGRPFileInternal, probe:959
MESSAGE : ZRC=0x870F0002=-2029060094=SQLO_BPSE "Debug logic error detected"
	  DIA8501C A buffer pool logic error has occurred.
DATA #1 : String, 34 bytes
Error openning process group file.
DATA #2 : SQLHA Mirrored File Pair Structure, PD_TYPE_SQLHA_MIRROR_IO, 8280 bytes
mirrorIO->left.path: /dbhome/db2inst1/sqllib/ctrlha/.db2.000.mydb2server.pgrp
mirrorIO->left.handle:0x00007FFED06C01D8 : FFFF FFFF 0001 0072                        .......r
/dbhome/db2inst1/sqllib/ctrlha/.db2.000.mydb2server.pgrp->state: CLOSED
/dbhome/db2inst1/sqllib/ctrlha/.db2.000.mydb2server.pgrp->state: UNLOCKED
/dbhome/db2inst1/sqllib/ctrlha/.db2.000.mydb2server.pgrp->state: BAD
mirrorIO->right.path: /dbhome/db2inst1/sqllib/ctrlhamirror/.db2.000.mydb2server.pgrp.mirror
mirrorIO->right.handle:0x00007FFED06C1200 : FFFF FFFF 0001 0072                        .......r
/dbhome/db2inst1/sqllib/ctrlhamirror/.db2.000.mydb2server.pgrp.mirror->state: CLOSED
/dbhome/db2inst1/sqllib/ctrlhamirror/.db2.000.mydb2server.pgrp.mirror->state: UNLOCKED
/dbhome/db2inst1/sqllib/ctrlhamirror/.db2.000.mydb2server.pgrp.mirror->state: BAD
File Open Options: 0x00007FFED06C1220 : 0000 0000 0000 0000                        ........

2016-05-31-11.16.27.630301+540 E40321E481            LEVEL: Severe
PID     : 29778                TID : 140241521518368 PROC : db2star2
INSTANCE: db2inst1             NODE : 000
HOSTNAME: mydb2server
FUNCTION: DB2 UDB, oper system services, sqloCreatePGRPFile, probe:1114
MESSAGE : ZRC=0x870F0002=-2029060094=SQLO_BPSE "Debug logic error detected"
	  DIA8501C A buffer pool logic error has occurred.
DATA #1 : String, 41 bytes
Error to create GRouP file on local path.

2016-05-31-11.16.27.630614+540 E40803E474            LEVEL: Severe
PID     : 29778                TID : 140241521518368 PROC : db2star2
INSTANCE: db2inst1             NODE : 000
HOSTNAME: mydb2server
FUNCTION: DB2 UDB, oper system services, sqloInitPGRPFile, probe:250
MESSAGE : ZRC=0x870F0002=-2029060094=SQLO_BPSE "Debug logic error detected"
	  DIA8501C A buffer pool logic error has occurred.
DATA #1 : String, 37 bytes
Error initializing process group file

2016-05-31-11.16.27.630920+540 I41278E404            LEVEL: Severe
PID     : 29778                TID : 140241521518368 PROC : db2star2
INSTANCE: db2inst1             NODE : 000
HOSTNAME: mydb2server
FUNCTION: DB2 UDB, base sys utilities, DB2StartMain, probe:5197
MESSAGE : ZRC=0x870F0002=-2029060094=SQLO_BPSE "Debug logic error detected"
	  DIA8501C A buffer pool logic error has occurred.

2016-05-31-11.16.27.631597+540 I41683E388            LEVEL: Warning
PID     : 29778                TID : 140241521518368 PROC : db2star2
INSTANCE: db2inst1             NODE : 000
HOSTNAME: mydb2server
FUNCTION: DB2 UDB, base sys utilities, sqleReleaseStStLockFile, probe:14016
MESSAGE : Released lock on the file:
DATA #1 : String, 41 bytes
/dbhome/db2inst1/sqllib/ctrl/db2stst.0000

2016-05-31-11.16.27.654888+540 I42072E1274           LEVEL: Event
PID     : 29776                TID : 140633656588064 PROC : db2start
INSTANCE: db2inst1             NODE : 000
HOSTNAME: mydb2server
FUNCTION: DB2 UDB, base sys utilities, sqleIssueStartStop, probe:10120
DATA #1 : SQLCA, PD_DB2_TYPE_SQLCA, 136 bytes
 sqlcaid : SQLCA     sqlcabc: 136   sqlcode: 0   sqlerrml: 0
 sqlerrmc: 
 sqlerrp : SQL10053
 sqlerrd : (1) 0x00000000      (2) 0x00000000      (3) 0x00000000
	   (4) 0x00000000      (5) 0x00000000      (6) 0x00000000
 sqlwarn : (1)      (2)      (3)      (4)        (5)       (6)    
	   (7)      (8)      (9)      (10)        (11)     
 sqlstate:      
DATA #2 : SQLCA, PD_DB2_TYPE_SQLCA, 136 bytes
 sqlcaid : SQLCA     sqlcabc: 136   sqlcode: -1032   sqlerrml: 0
 sqlerrmc: 
 sqlerrp : SQLEPFIN
 sqlerrd : (1) 0x00000000      (2) 0x00000000      (3) 0x00000000
	   (4) 0x00000000      (5) 0x00000000      (6) 0x00000000
 sqlwarn : (1)      (2)      (3)      (4)        (5)       (6)    
	   (7)      (8)      (9)      (10)        (11)     
 sqlstate:      
DATA #3 : Boolean, 1 bytes
false
DATA #4 : Boolean, 1 bytes
false
DATA #5 : Boolean, 1 bytes
false
DATA #6 : Boolean, 1 bytes
false
DATA #7 : Boolean, 1 bytes
false

2016-05-31-11.16.27.655445+540 I43347E388            LEVEL: Warning
PID     : 29776                TID : 140633656588064 PROC : db2start
INSTANCE: db2inst1             NODE : 000
HOSTNAME: mydb2server
FUNCTION: DB2 UDB, base sys utilities, sqleReleaseStStLockFile, probe:14016
MESSAGE : Released lock on the file:
DATA #1 : String, 41 bytes
/dbhome/db2inst1/sqllib/ctrl/db2strst.lck

db2inst1:/dbhome/db2inst1$ 

又是buffer问题,又有SQO Open File Options打开文件问题…其实之前在linux平台下有碰到过类似问题。

原因很简单…实例目录对应的文件系统打开了data=journal,只要禁止掉重新mount即可解决!

确认

db2inst1:/dbhome/db2inst1$ df -m .
Filesystem           1M-blocks  Used Available Use% Mounted on
/dev/mapper/datavg-dbhomelv
	                  4912    41      4616   1% /dbhome
db2inst1:/dbhome/db2inst1$ mount | grep -i datavg-dbhomelv
/dev/mapper/datavg-dbhomelv on /dbhome type ext4 (rw,data=journal)
db2inst1:/dbhome/db2inst1$ 

描述如下:

Cause

When trying to open a file located on an EXT3 filesystem, and the flag O_DIRECT is passed to open(3) call, the call may fail and return the error code EINVAL (22).

Resolving the problem

You need to ensure that no journal is enabled on an EXT3 mounted directory where DB2 instance is located. This can be done with mount(1) command just as follows:


$ mount
/dev/sda2 on /home type ext3 (rw,noatime,data=journal,acl,user_xattr)

In the example above, the journal is enabled (data=journal), thus look to re-mount the file system with that option omitted. Please note that you may need to un-mount a file system explicitly instead of simple remount, for example:

# umount /dev/sda2
# mount -t ext3 -o rw, noatime, acl, user_xattr /dev/sda2 /home

参考资料

db2start fails on Linux with SQL1042C due to journal enabled on EXT3 mounted directory

Can’t start DB2 10.5 Express-C in a Linux Container



上一篇 Osquery 初体验

Comments