Check sqlplus version remotely

Most programs you can check the version of the program remotely with:

ssh server '/path/to/program -v'

sqlplus unfortunately is more difficult. You get this message.

ssh server "/opt/ora/bin/sqlplus -V"
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

Hope this helps someone in the future. This took me awhile to figure out.

 ssh server"export ORACLE_HOME=/opt/oracle/oracle_19.0.0.0; /opt/ora/bin/sqlplus -V"

SQL*Plus: Release 19.0.0.0.0 - Production
Version 19.17.0.0.0

Hi @cokedude,

most shells allow passing an env var directly in front of the command. So this should also work:

ssh server "ORACLE_HOME=/opt/oracle/oracle_19.0.0.0 /opt/ora/bin/sqlplus -V"

From man bash:
The environment for any simple command or function may be augmented temporarily by prefixing it with parameter assignments, as described above in PARAMETERS. These assignment statements affect only the environment seen by that command.

Is there an advantage of doing it that way?

Yes, less tying :slight_smile:

If you are trying to check the version of SQL*Plus on a remote server, you can use the following command:

ssh server 'sqlplus -v'

This will run the sqlplus -v command on the remote server and display the output.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.