Db2 – “SQL1042C An unexpected system error” when creating a database

db2mac os x

I installed DB2 Express-C 10.1 on OS X 10.8.4. I installed it in user mode, and it seems to have created an instance with my username (avernet). I checked the instance is indeed there by running db2ilist. The database manager is running, as when I run db2start, I get the message SQL1026N The database manager is already active.

Now, I am trying to create a database by running db2 from the command line, and typing the command create database orbeon, but it returns:

QL1042C  An unexpected system error occurred.  SQLSTATE=58004

What am I missing here? How can I create a simple database from the command line (I prefer not to bother with Data Studio as it isn't available for OS X)?

In db2dump/db2diag.log, I see the follwing error (full file, in case you're interested):

2013-06-29-15.31.38.948217-420 E159047E344          LEVEL: Error (OS)
PID     : 1766                 TID : 140735175762304PROC : db2star2
INSTANCE: avernet              NODE : 000
HOSTNAME: huashan.local
FUNCTION: DB2 UDB, SQO Memory Management, sqloMemCreateSingleSegment, probe:100
CALLED  : OS, -, shmget                           OSERR: 17

Note that for the install to go through, I increased the OS X shared memory, per this recommendation.

Best Answer

Try creating your database in a different directory: db2 create db orbeon on /datadir dbpath on /dbdir, where /datadir and /dbdir are directories where whoever runs the db2sysc process has full access.