Ever need to run a command as a specific user? Many Oracle commands require you to become the “oracle” user to make use of them.
To do this in a script, simply define your Oracle variables and use the “su” command. Here’s some example code:
su – $ORA_OWNER -c “$ORA_HOME/bin/lsnrctl start listener_rmdyd1”
su – $ORA_OWNER -c “$ORA_HOME/bin/lsnrctl start listener_hbstgu1”