Solaris 8 strip LD_LIBRARY_PATH when su - oracle (Merged) [message #402337] |
Fri, 08 May 2009 16:30 |
kerrtung
Messages: 5 Registered: May 2009 Location: Dallas, Texas, USA
|
Junior Member |
|
|
Hi All,
In my rc script, I have su - oracle to run
/var/opt/oracle/product/10.2.0/db_1/bin/lsnrctl
However, it fails with the following:
ld.so.1: /var/opt/oracle/product/10.2.0/db_1/bin/lsnrctl: fatal: libclntsh.so.10.1: open failed: No such file or directory
The cause is the the env var
LD_LIBRARY_PATH=/var/opt/oracle/product/10.2.0/db_1/lib was stripped by the su process. According to the su man page:
" Variables with LD_ prefix are removed for security reasons.
Thus, su bin will not retain previously exported variables
with LD_ prefix while becoming user bin (bin used as example previously)"
How do I make Solaris 8 su to keep the LD_LIBRARY_PATH setting or hard code this setting into Oracle configuration file so that lsnrctl will not fail?
Thanks,
Kerr
|
|
|
|
Re: Solaris 8 strip LD_LIBRARY_PATH when su - oracle [message #402398 is a reply to message #402338] |
Sat, 09 May 2009 21:43 |
kerrtung
Messages: 5 Registered: May 2009 Location: Dallas, Texas, USA
|
Junior Member |
|
|
It doesn't seem to work. Any idea?
FYI:
501 ln -s /var/opt/oracle/product/10.2.0/db_1/lib/libclntsh.so.10.1 /usr/lib/libclntsh.so.10.1
502 ./S99oracle stop
cccsi00dv:/tmp> ./S99oracle stop
+ ORACLE_BASE=/var/opt/oracle
+ ORACLE_HOME=/var/opt/oracle/product/10.2.0/db_1
+ ORACLE_OWNER=oracle
+ ORACLE_SID=cqdb
+ TNS_ADMIN=/var/opt/oracle/product/10.2.0/db_1/network/admin
+ LD_LIBRARY_PATH=/var/opt/oracle/product/10.2.0/db_1/lib
+ export LD_LIBRARY_PATH
+ echo -n Shutting down Oracle:
-n Shutting down Oracle:
+ su oracle -c /var/opt/oracle/product/10.2.0/db_1/bin/dbshut
+ echo Stoping Oracle Listeners...
Stoping Oracle Listeners...
+ su - oracle -c /var/opt/oracle/product/10.2.0/db_1/bin/lsnrctl stop
cccsi00dv:/tmp> ld.so.1: /var/opt/oracle/product/10.2.0/db_1/bin/lsnrctl: fatal: libclntsh.so.10.1: open failed: No such file or directory
Thanks,
Kerr
|
|
|
|
Re: Solaris 8 strip LD_LIBRARY_PATH when su - oracle [message #402599 is a reply to message #402337] |
Mon, 11 May 2009 10:59 |
kerrtung
Messages: 5 Registered: May 2009 Location: Dallas, Texas, USA
|
Junior Member |
|
|
/usr/lib/libclntsh.so.10.1
/usr/apps/oracle/9i/lib32/libclntsh.so.9.0
/usr/apps/oracle/9i/lib32/libclntsh.so
/var/opt/oracle/product/10.2.0/db_1/instantclient32 \ /libclntsh.so.10.1
/var/opt/oracle/product/10.2.0/db_1/lib/libclntsh.so.10.1
/var/opt/oracle/product/10.2.0/db_1/lib/libclntsh.so
/var/opt/oracle/product/10.2.0/db_1/lib32/libclntsh.so
/var/opt/oracle/product/10.2.0/db_1/lib32/libclntsh.so.10.1
Thanks,
Kerr
|
|
|
su - oracle break LD_LIBRARY_PATH [message #403086 is a reply to message #402337] |
Wed, 13 May 2009 11:40 |
kerrtung
Messages: 5 Registered: May 2009 Location: Dallas, Texas, USA
|
Junior Member |
|
|
Hi All,
In my rc script, I have su - oracle to run
/var/opt/oracle/product/10.2.0/db_1/bin/lsnrctl
However, it fails with the following:
ld.so.1: /var/opt/oracle/product/10.2.0/db_1/bin/lsnrctl: fatal: libclntsh.so.10.1: open failed: No such file or directory
The cause is the the env var
LD_LIBRARY_PATH=/var/opt/oracle/product/10.2.0/db_1/lib was stripped by the su process. According to the man su page:
" Variables with LD_ prefix are removed for security reasons.
Thus, su bin will not retain previously exported variables
with LD_ prefix while becoming user bin (bin used as example previously)"
How do I make Solaris 8 su to keep the LD_LIBRARY_PATH setting or change the Oracle configuration so that lsnrctl will find /var/opt/oracle/product/10.2.0/db_1/lib without having to depend on the environment var $LD_LIBRARY_PATH?
Thanks,
Kerr
|
|
|
Re: su - oracle break LD_LIBRARY_PATH [message #403092 is a reply to message #403086] |
Wed, 13 May 2009 12:51 |
ThomasG
Messages: 3212 Registered: April 2005 Location: Heilbronn, Germany
|
Senior Member |
|
|
You are su-ing from root to Oracle?
Is LD_LIBRARY_PATH set in the root environment?
Does it work when you log in as "oracle" directly?
Where is the profile for oracle set? in ~/.profile?
Then you could try:
su - oracle <<!
source ~/.profile
lsnrctl
!
|
|
|
Re: Solaris 8 strip LD_LIBRARY_PATH when su - oracle (Merged) [message #404146 is a reply to message #402337] |
Wed, 20 May 2009 10:30 |
kerrtung
Messages: 5 Registered: May 2009 Location: Dallas, Texas, USA
|
Junior Member |
|
|
Hi Thomas,
I borrowed your idea and it works now. Thanks!
FYI:
cccsi00dv:/tmp> cat S99oracle
#!/usr/bin/ksh
# oracle
# Set ORACLE_HOME to be equivalent to the ORACLE_HOME
# from which you wish to execute dbstart and
# dbshut
# set ORACLE_OWNER to the user id of the owner of the
# Oracle database in ORACLE_HOME
ORACLE_BASE=/var/opt/oracle
ORACLE_HOME=$ORACLE_BASE/product/10.2.0/db_1
ORACLE_OWNER=oracle
ORACLE_SID=cqdb
TNS_ADMIN=$ORACLE_HOME/network/admin
LD_LIBRARY_PATH=/var/opt/oracle/product/10.2.0/db_1/lib
export LD_LIBRARY_PATH
case "$1" in
'start')
# Start the Oracle databases:
# The following command assumes that the oracle login will not prompt the
# user for any values
echo -n "Starting Oracle: " &&
su - oracle -c "$ORACLE_HOME/bin/dbstart" &
echo "Starting Oracle listeners..." &&
su - oracle <<LD1
. /oracle/.bash_profile
$ORACLE_HOME/bin/lsnrctl start &
LD1
;;
'stop')
# Stop the Oracle databases:
# The following command assumes that the oracle login will not prompt the
# user for any values
echo -n "Shutting down Oracle: " &&
su oracle -c $ORACLE_HOME/bin/dbshut &
echo "Stoping Oracle Listeners..." &&
su - oracle <<LD2
. /oracle/.bash_profile
$ORACLE_HOME/bin/lsnrctl stop &
LD2
;;
'restart')
# Restart the Oracle databases:
echo -n "Retarting Oracle: "
$0 stop
$0 start
;;
*)
echo "Usage: oracle { start | stop | restart }"
exit 1
esac
|
|
|