IBM Support

Receiving "SQL1390C The environment variable DB2INSTANCE is not defined or is
invalid." on db2start

Troubleshooting


Problem

Attempting to do a 'db2start' throws an error message, "SQL1390C The environment variable DB2INSTANCE is not defined or is invalid." db2inst1@foo:~> db2start SQL1390C The environment variable DB2INSTANCE is not defined or is invalid. 10/24/2014 17:01:32 443 0 SQL1390C The environment variable DB2INSTANCE is not defined or is invalid. SQL1032N No start database manager command was issued. SQLSTATE=57019

Cause

Instance owner's primary group not being the SYSADM_GROUP in the dbm cfg may cause this issue.

For example,

We have the group 'dialout' as the primary group for the instance owner 'db2inst1'.

host1:~/ese_en.v101fp4 # id db2inst1
uid=1007(db2inst1) gid=16(dialout) groups=114(db2iadm1),16(dialout)

But, we have db2iadm1 as the sysadm group.

db2inst1@host1:~> db2 get dbm cfg | grep SYSADM
SYSADM group name (SYSADM_GROUP) = DB2IADM1


Diagnosing The Problem

Analyzing the db2diag.log will show the following entries:


2014-10-27-14.09.43.326015-240 I136665E687 LEVEL: Severe
PID : 4200 TID : 139736919590688 PROC : db2star2
INSTANCE: db2inst1 NODE : 000
HOSTNAME: host1
FUNCTION: DB2 UDB, base sys utilities, DB2StartMain, probe:2843
MESSAGE : ZRC=0xFFFFFA92=-1390
SQL1390C The environment variable DB2INSTANCE is not defined or is
invalid.

DATA #1 : String, 86 bytes
Primary group id of DB2INSTANCE does not match effect primary group id of this process
DATA #2 : String, 28 bytes
DB2INSTANCE primary group id
DATA #3 : Group id, 4 bytes
16
DATA #4 : String, 36 bytes
Effective primary id of this process
DATA #5 : Group id, 4 bytes
114

Then, doing an 'id' on the instance owner will verify that user doesn't belong to the primary group.

Resolving The Problem

On a Linux system, you can use the 'usermod' command to modify the instance owner's primary group. On other OS, use the equivalent command to make sure instance owner belongs to the correct primary group.

You also have the option to run the command example below as "root" on Linux.
Of course substitute the $db2installdir with the full path to where the db2 instance is installed (E.g. /opt/ibm/db2/v10fp7/) and replace db2inst1 with the login id of the instance owner:


$db2installdir/instance/db2iupdt db2inst1

[{"Product":{"code":"SSEPGG","label":"Db2 for Linux, UNIX and Windows"},"Business Unit":{"code":"BU058","label":"IBM Infrastructure w\/TPS"},"Component":"HADR - Setup","Platform":[{"code":"PF002","label":"AIX"},{"code":"PF010","label":"HP-UX"},{"code":"PF016","label":"Linux"},{"code":"PF027","label":"Solaris"}],"Version":"9.7;9.5;10.1;10.5","Edition":"Advanced Enterprise Server;Advanced Workgroup Server;Enterprise Server;Workgroup Server","Line of Business":{"code":"LOB10","label":"Data and AI"}}]

Document Information

Modified date:
16 June 2018

UID

swg21688368