?
Solved

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

Posted on 2003-03-24
6
Medium Priority
?
1,919 Views
Last Modified: 2008-02-01
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
Comment
Question by:minjiezen
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 2
6 Comments
 

Author Comment

by:minjiezen
ID: 8198708
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
 
LVL 9

Accepted Solution

by:
mglxxx earned 300 total points
ID: 8201016
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
 

Author Comment

by:minjiezen
ID: 8203335
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
 [eBook] Windows Nano Server

Download this FREE eBook and learn all you need to get started with Windows Nano Server, including deployment options, remote management
and troubleshooting tips and tricks

 

Author Comment

by:minjiezen
ID: 8203403
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
 
LVL 9

Expert Comment

by:mglxxx
ID: 8203881
"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
 

Author Comment

by:minjiezen
ID: 8204744
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: 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.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Recursive SQL in UDB/LUW (you can use 'recursive' and 'SQL' in the same sentence) A growing number of database queries lend themselves to recursive solutions.  It's not always easy to spot when recursion is called for, especially for people una…
Recursive SQL in UDB/LUW (it really isn't that hard to do) Recursive SQL is most often used to convert columns to rows or rows to columns.  A previous article described the process of converting rows to columns.  This article will build off of th…
This is my first video review of Microsoft Bookings, I will be doing a part two with a bit more information, but wanted to get this out to you folks.
In this video, Percona Solution Engineer Rick Golba discuss how (and why) you implement high availability in a database environment. To discuss how Percona Consulting can help with your design and architecture needs for your database and infrastr…
Suggested Courses
Course of the Month10 days, 21 hours left to enroll

770 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question