Executing remote server sqlplus

Hello Guys

I have to compare flat file record to oracle table record count count which are on different servers

I am taking the flat file record count from the server now I am connecting to remote server first and then running sqlplus

But after connecting to remote server the sqlplus command is not executing

 
#!/usr/bin/ksh
ssh -o 'PasswordAuthentication yes' -o 'PreferredAuthentications publickey' -i /home/r141695/.ssh/id_dsa us320
result=`sqlplus -s UID/PWD#2738@Server<<EOF 
set pages 0 feed off;
set feedback off;
#select rcrd_cnt from rptg.r_sb_stg_data_fl_acq_cyc_cntl where srce_id = 1 and data_acq_cyc_cntl_id =$cntl_id and srce_fl_id = $p ;
select dummy from dual;
exit; 
EOF;`
exit
echo $?
echo $pwd

Where did you set the environment for oracle after you connect with ssh?

The problem is that you're assuming that all commands below ssh will be executed on the remote server. They aren't.

To run a command on a remote server you'll have to invoke it like this:

ssh user@remote 'command'

Hi vbe,
Can you please let me now how to set the environment for oracle to successfully run the command