Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.misc -> Re: UNIX remsh and sqlplus
Mike Tinney wrote:
> I looking for the correct syntax or a easy way to do a select from a
> remote system on UNIX to be used via a sqript.
Do not have remsh installed on my Linux desktop, so I used rexec to a HP-UX box.
This worked:
# rexec -l username -p password hostname /
". /home/username/.profile 1>/dev/null 2>/dev/null
sqlplus -s << EOF
orauser/orapass
descr foorbar
exit
EOF"
To explain:
-l username = remote Unix username -p password = remote Unix user's password hostname = hostname or IP of remote machine
After that, the command to send. I enclosed the entire set of commands to send in double qoutes.
First thing I do is to run the .profile on that remore machine. We need to have a valid Oracle environment set (PATH, ORACLE_SID, etc.). I redirect both STDOUT and STDERR to /dev/null as running the .profile will likely cause error messages/warnings to be send as we're not running the .profile on a tty device.
Okay, next thing is running SQL*Plus - that should be pretty self explanatory.
A few problems with doing something like this. A "ps -ef" will likely show the command line Unix username and password parameters. Anyone running it on your local box, will see the username and password used for accessing that remote machine. You can though use a .rhosts on the remote machine, but this raises other security concerns again.
The rexec sends the command in clear text. You need to add the Oracle username and password to that to access the db via SQL*Plus. Anyone running a sniffer will have the Oracle name and password offered on a silver platter.
rexec and remsh are useful commands to have. But they are also potential security risks - never forget that. :-)
-- BillyReceived on Fri Oct 18 2002 - 01:25:58 CDT
![]() |
![]() |