IBM Support

The DB2 connect to database returns the SQL5005C error when running chfs and db2stmm

Question & Answer


Question

During a backup, the DB2® connect to database command was executed and returned the SQL5005C error. Why is this error returned when the command is run in the DB2 product?

Cause

The following outlines an example backup that might encounter the SQL5005C error:

The DB2 set write command suspends the database.
chfs -a freeze=xxx /db2 (which is stored database files and configuration files).

During the backup, the db2 connect to database command was executed in the terminal, which returned the SQL5005C error. The db2diag.log file now has a message that is similar to the following example output:


2014-02-07-11.29.42.059557+540 E1110313A1131 LEVEL: Error (OS)
PID : 6357332 TID : 11100 PROC : db2sysc 0
INSTANCE: db2inst1 NODE : 000 DB : SAMPLE
APPHDL : 0-29670 APPID: *LOCAL.db2inst1.140207022817
AUTHID : db2inst1
EDUID : 11100 EDUNAME: db2agent (SAMPLE) 0
FUNCTION: DB2 UDB, oper system services, sqloopenp, probe:80
MESSAGE : ZRC=0x870F0016=-2029060074=SQLO_SHAR "File sharing violation."
DIA8519C A file sharing violation has occurred, filename was "".
CALLED : OS, -, open
OSERR : ETXTBSY (26) "Text file busy"
DATA #1 : Codepath, 8 bytes
4:9:15:16:22:36:37
DATA #2 : File name, 58 bytes
/home/db2inst1/db2inst1/NODE0000/SQL00001/SQLDBCONF
DATA #3 : SQO Open File Options, PD_TYPE_SQO_FILE_OPEN_OPTIONS, 4 bytes
SQLO_REVISE, SQLO_READONLY, SQLO_SHAREREAD, SQLO_WRITETHRU
DATA #4 : Hex integer, 4 bytes
0x000001A0
DATA #5 : signed integer, 4 bytes
50
DATA #6 : signed integer, 4 bytes
0
DATA #7 : String, 105 bytes


Search for the ossError*Analysis probe point in this log entry for further
self-diagnosis of this problem.

Answer

A db2stmm process is blocked from writing data to the SQLDBCONF file due to freezing file system.

When the chfs -a freeze=TIME command was executed, the file system is read only and attempts to write to the system and must wait for the freeze to end.

In this case, file system is frozen and db2stmm is modifying the parameter and writing to the SQLDBCONF file. db2stmm is waiting for the freeze to end.

Another DB2 instance is executing the connect to database command. This means that the db2agent process is attempting to read from the SQLDBCONF file with a shared lock.

Since db2stmm has an EXCLUSIVE lock on the SQLDBCONF file, other processes cannot obtain access to the other locks (share/exclusive).

The db2agent process is failing to obtain a lock and record file sharing violations in the db2diag.log file.

The db2agent process has tried to obtain lock several times but has failed to do so.

Finally, the DB2 instance will return the SQL5005C error in the command line prompt:


SQL5005C System Error.

Explanation:

A system error, probably an I/O error, was encountered while accessing a
configuration file.

The command cannot be processed.

This might occur if anti-virus software is locking the SQLDBCONF file for extended periods of time. This error can also occur if the db2agent process cannot obtain a lock against the SQLDBCONF file.

Related Information

[{"Product":{"code":"SSEPGG","label":"Db2 for Linux, UNIX and Windows"},"Business Unit":{"code":"BU058","label":"IBM Infrastructure w\/TPS"},"Component":"Database Objects\/Config - Database","Platform":[{"code":"PF002","label":"AIX"}],"Version":"9.8;9.7;9.5;10.1;10.5","Edition":"","Line of Business":{"code":"LOB10","label":"Data and AI"}}]

Document Information

Modified date:
16 June 2018

UID

swg21664145