| |
|
If this is your first visit, be sure to check out the FAQ by clicking the link above.
You may have to register before you can post: click the register link above to proceed.
To start viewing messages, select the forum that you want to visit from the selection below.
|
 |

03-30-09, 01:19
|
|
Registered User
|
|
Join Date: Jun 2008
Posts: 40
|
|
|
executing db2 commands as a root !
|
|
Hi all,
I have installed db2 ese on aix server using root authority ,
but when ever i try to execute any db2 command as a root user it throws me error db2 not found . i have added root user id to my dbadmin group by modifying the /etc/groups file .
Kindly help
|
|

03-30-09, 02:15
|
|
Registered User
|
|
Join Date: May 2003
Location: USA
Posts: 5,196
|
|
You have to execute the profile of the instance owner user id. I don't use AIX much anymore (use Linux) so I don't remember the file name, but probably .profile in the home directory of the instance owner.
In a shell script, execute it as:
. /home/db2inst1/.profile
where home directory of of instance owner is /home/db2inst1 and profile file name is .profile. Note the space between the first dot and the first slash.
__________________
M. A. Feldman
IBM Certified DBA on DB2 for Linux, UNIX, and Windows
IBM Certified DBA on DB2 for z/OS and OS/390
|
|

03-30-09, 05:33
|
|
Registered User
|
|
Join Date: May 2007
Location: somewhere in dbforums
Posts: 221
|
|
|
|
As said by Marcus.... add the following into the .profile file of root
Quote:
# The following three lines have been added by UDB DB2.
if [ -f /home/db2inst1/sqllib/db2profile ];then
. /home/db2inst1/sqllib/db2profile
fi
|
this is considering the fact that db2inst1 is an instance available in your system....
The above mentioned script will also be available in the.profile file of your db2 instance which you can directly copy paste into the .profile of root user
__________________
IBM Certified Database Associate, DB2 9 for LUW
|
|

03-30-09, 07:22
|
|
Registered User
|
|
Join Date: Apr 2006
Location: Belgium
Posts: 1,159
|
|
i would never recommend this because you depend on setting for other user
never use root for db2 and create dedicate user and create db2 user instance with your proper settings;;;;
__________________
Best Regards, Guy Przytula
Database Software Consultant
DB2 UDB LUW Certified V7-V8-V9-V9.7 DB Admin - Dprop..
Information Server Datastage Certified
http://www.infocura.be
|
|

03-30-09, 08:48
|
|
Registered User
|
|
Join Date: May 2003
Location: USA
Posts: 5,196
|
|
Quote:
|
Originally Posted by przytula_guy
i would never recommend this because you depend on setting for other user
never use root for db2 and create dedicate user and create db2 user instance with your proper settings;;;;
|
If the user in question is the instance owner, I don't see the problem if the command is part of a shell script. This is especially useful if you have a standard in the company as to where the home directory is located for the instance owner.
__________________
M. A. Feldman
IBM Certified DBA on DB2 for Linux, UNIX, and Windows
IBM Certified DBA on DB2 for z/OS and OS/390
|
|

03-30-09, 08:53
|
|
Registered User
|
|
Join Date: Jun 2008
Posts: 40
|
|
Hi All,
i did try to execute the .profile of the instance owner user id but it did not work and at the root i dont find .profile file of the root user .At the root i typed ls -a but i dont find any .profile file . The reason i am trying to execute db2 command with root authority is because i want to drop and create new instance which i guess i can do with only root access
|
|

03-30-09, 09:56
|
|
Registered User
|
|
Join Date: Jan 2003
Posts: 3,575
|
|
If you just want to drop and create instances, you do not need the instance profile loaded to do that. Just run the db2idrop and db2icrt commands as root. You will have to fully qualify the names when executing them. Also run them from the installation directory of DB2 and not the instance directories.
Andy
|
|

03-30-09, 10:25
|
|
Registered User
|
|
Join Date: Apr 2006
Location: Belgium
Posts: 1,159
|
|
for db2icrt and db2idrop you d not need any db2 settings
just cd /opt/ibm/db2/V9.5/instance or where db2 was installed and execute
./db2icrt ....
another remark : .profile is located in /home/db2inst1 or home directory of db2inst1
you should specify the full path or cd first to the home of db2inst1
as documented, this should do..
__________________
Best Regards, Guy Przytula
Database Software Consultant
DB2 UDB LUW Certified V7-V8-V9-V9.7 DB Admin - Dprop..
Information Server Datastage Certified
http://www.infocura.be
|
|

03-30-09, 10:41
|
|
Registered User
|
|
Join Date: Jun 2008
Posts: 40
|
|
I tried this and got the following result .
/opt/IBM/db2/V9.5/instance
# db2icrt -u db2fenc1 db2inst2
ksh: db2icrt: not found.
|
|

03-30-09, 10:52
|
|
Registered User
|
|
Join Date: Jan 2003
Posts: 3,575
|
|
Quote:
|
Originally Posted by jayawant01
I tried this and got the following result .
/opt/IBM/db2/V9.5/instance
# db2icrt -u db2fenc1 db2inst2
ksh: db2icrt: not found.
|
If you working directory is /opt/IBM/db2/V9.5/instance then you need to execute:
# ./db2icrt -u db2fenc1 db2inst2
Andy
|
|

03-30-09, 13:16
|
|
Registered User
|
|
Join Date: May 2003
Location: USA
Posts: 5,196
|
|
Or you can do the following:
/opt/IBM/db2/V9.5/instance/db2icrt -u db2fenc1 db2inst2
however you did not specify a port number, so try this:
/opt/IBM/db2/V9.5/instance/db2icrt -u db2fenc1 -p 50100 db2inst2
Where 50100 is your port number.
Edit: Last time I worked on AIX (DB2 V8), IBM did not install DB2 on /opt directory, so you need to find out where DB2 is installed. Maybe they changed it so all Linux/UNIX is now on /opt but check first.
Edit2: Directory on Linux for 9.5 is (case sensitive): /opt/ibm/db2/V9.5/instance
This could be different if a new fix pack was installed, or if installer chose a different directory.
__________________
M. A. Feldman
IBM Certified DBA on DB2 for Linux, UNIX, and Windows
IBM Certified DBA on DB2 for z/OS and OS/390
|
Last edited by Marcus_A; 03-30-09 at 13:21.
|

03-31-09, 00:33
|
|
Registered User
|
|
Join Date: Jun 2008
Posts: 40
|
|
Hi Guys ,
Thanks to all of you !
./db2icrt .... worked
|
|
| Thread Tools |
Search this Thread |
|
|
|
| Display Modes |
Linear Mode
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
|
|