I need to call sqlplus with oracle user sudo to clearly specified DB (env var ORACLE_SID) by one line command. The usual way to do it consists of 2 steps:
$ sudo -u oracle -i $ ORACLE_SID=DBNAME sqlplus / as sysdba But I need to do it in one line (to save time, reasonably). I try to do it simply like this:
$ sudo -u oracle -i ORACLE_SID=DBNAME sqlplus / as sysdba But it seems that sqlplus does not see changing of ORACLE_SID env var and connects to default DB. Also I can not exclude -i sudo option because I need to be sure that all other environment variables initialized perfectly.
How can I run application with sudo and custom environment variable in my case?
