• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1932
  • Last Modified:

Cannot run db2sampl, Errored on 'DB2INSTANCE' not set or set incorrectly.

I just installed DB2 Personal Edition Version 8.1 on a Linux machine. I was following the instruction and got to the step on 'Verifying the installation using the command line processor (CLP)', i.e., enter the db2sampl command to create the SAMPLE database. But I got the following error:
'SQL10007N Message "-1390" could not be retrieved'.

I checked the meaning of SQL10007N message, and it says:
'The environment variable “DB2INSTANCE” is either not set, or is set to an invalid instance. Correct it and try again.'

I did the following to setup DB2INSTANCE:
set DB2INSTANCE=TEST db2inst1
(I had created db2inst1 after having installed DB2 PE). The set command went through without error. But running 'db2sampl' again got me the same error. Then I tried
set DB2INSTANCE db2inst1
and ran 'db2sampl' again but got the same error still.

Note: I have setup the following after having installed DB2:
groupadd id=999 dbiadm1
groupadd id=998 db2fadm1
groupadd id=997 db2asgrp

useradd -u 1004 -g db2iadm1 -G db2iadm1 -m -d /home/db2inst1 db2inst1 -p mypasswrd
useradd -u 1003 -g db2fadm1 -G dbfadm1 -m -d /home/db2fenc1 db2fenc1 -p mypasswrd
useradd -u 1002 -g db2asgrp -G db2asgrp -m -d /home/db2as db2as -p mypasswrd

Do I need to set up anything else before running db2sampl? Or should I not set up the above before I run db2sampl?

Thanks.
0
minjiezen
Asked:
minjiezen
  • 4
  • 2
1 Solution
 
minjiezenAuthor Commented:
I just deleted all the setups for groups and users (see above), and tried to run db2smapl, but got the same error. So the error is not related to the user and group setups.
0
 
mglxxxCommented:
If you did not create an instance during installation,
the steps are as follows:

First create the users and groups as you already did:
db2as for the admin server
db2inst1 for the instance owner
db2fenc1 for the fenced user

Add entries for the connect and interrupt port for
the instance to /etc/services, e.g.
db2inst1c 50000/tcp # DB2 instance db2inst1 connect
db2inst1i 50001/tcp # DB2 instance db2inst1 interrupt

Then create the instance:
As root cd to /opt/IBM/db2/V8.1/instance.
Run:
./db2icrt -p db2inst1c -u db2fenc1 db2inst1

This creates the 'sqllib' directory tree under db2inst1's
home directory.

Now become the instance owner: su - db2inst1
Check whether db2icrt set up your .profile correctly:
echo $DB2INSTANCE should return db2inst1. If it doesn't,
do a
. sqllib/db2profile

You should now be able to run db2sampl without any errors.
Set up the DB2 environment:
. sqllib/db2profile
0
 
minjiezenAuthor Commented:
Excellent instructions! It worked out very nicely. I was able to verify the installation.

One more question (I'll add more points): when I do
useradd -u 1002 -g db2asgrp -G db2asgrp -m -d /home/db2as db2as -p mypasswrd
I got the following message:
useradd: uid 1002 is not unique
Will this pose a problem later on? If so, how do I fix this? Thanks.
0
Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

 
minjiezenAuthor Commented:
Excellent instructions! It worked out very nicely. I was able to verify the installation.

One more question (I'll add more points): when I do
useradd -u 1002 -g db2asgrp -G db2asgrp -m -d /home/db2as db2as -p mypasswrd
I got the following message:
useradd: uid 1002 is not unique
Will this pose a problem later on? If so, how do I fix this? Thanks.
0
 
mglxxxCommented:
"uid 1002 is not unique" means that there is already a
user with that uid -- this means that the useradd did not
work.

Do a 'grep 1002 /etc/passwd' in order to find out who is
using that uid.

You need db2as for the DB2 admin server. If I remember
correctly, the 8.x installer creates the admin server
automatically. As root go to /opt/IBM/db2/V8.1/instance
and execute ./daslist
This should print the name of any admin servers.

You need the admin server for the GUI tools.
If you don't have an admin server, first create the admin
server user (choose a different uid).
Then, as root, go to /opt/IBM/db2/V8.1/instance.
Execute
./dasicrt db2as

Become the admin server user: su - db2as
and start the server: db2admin start
0
 
minjiezenAuthor Commented:
mqlxxx, thanks so much for the directions. It worked. I used 1005 as the uid for db2as and started db2admin.

The installation was done by someone else using ./db2_install and some setups are not done during installation. So I'm seeing all these problems. Thank you very much for the help.
0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

  • 4
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now