I am needing to run sqlplus -v on Linux where the user I am connecting with does not have execute permission on sqlplus.
I can however set what I need up my users profile as well as sudoers.
I have set in sudoers:
user1 ALL=(oracle) NOPASSWD: /u01/app/oracle/product/11.2.0/dbhome_1/bin/sqlplus
I then login with user1 and execute:
export ORACLE_SID=wujjii
export ORACLE_HOME=/u01/app/oracle/product/11.2.0/dbhome_1
export ORACLE_BASE=/u01/app/oracle
export PATH=$PATH:$ORACLE_HOME/bin
And finally:
sudo -u oracle /u01/app/oracle/product/11.2.0/dbhome_1/bin/sqlplus -v
This does not prompt for password however returns:
Error 6 initializing SQL*Plus
SP2-0667: Message file sp1<lang>.msb not found
SP2-0750: You may need to set ORACLE_HOME to your Oracle software directory
I know this is an age old topic but I think I have covered the basics here so any help appreciated.