Hey everybody,
currently I am having an issue that I need to open an ssh session to a remote host, once on the remote host I need to use sudo and then execute sqlplus. Once the sqlplus call is open I need to execute one command while the sqlplus is active. For example show sga.
I already got so far that this is working.
ssh -nq <host> -l <user> /usr/bin/sudo -u <orauser> -i sqlplus / as sysdba
With the following, the result is the same
ssh -nq <host> -l <user> "/usr/bin/sudo -u <orauser> -i sqlplus / as sysdba"
The result is:
SQL*Plus: Release 11.2.0.4.0 Production on Fri Mar 4 09:56:42 2016
Copyright (c) 1982, 2013, Oracle. All rights reserved.
Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
SQL> Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
Now what I would like to be able to do is to get the sga values set in the DB by calling 'show sga' inside the sqlplus connection.
I already tried the following commands, which don't work:
ssh -nq <host> -l <user> "/usr/bin/sudo -u <orauser> -i echo 'show sga' | sqlplus / as sysdba"
bash: sqlplus: command not found
ssh -nq <host> -l <user> "/usr/bin/sudo -u <orauser> -i echo \"show sga\" | sqlplus / as sysdba"
bash: sqlplus: command not found
Does anyone of you have a hint how I could solve this?
Kind regards.