Need help in shell script on AIX

Hi All,

I am connecting from ServerA(Unix) to ServerB (AIX). Copying a Database dump file from A to B. On B i need to import that dump file.

I have used the following code to do this operation but ended up with error

Pseudo-terminal will not be allocated because stdin is not a terminal.
stty: tcgetattr: A specified file does not support the ioctl system call.

and it hangs up.

ServerA>sshpass -p 'oracle01'  scp /oracle/DATAPUMP/* oracle@ServerB:/oracle/test1/DATAPUMP

echo 'File Transfered';

ServerA>sshpass -p 'oracle01' ssh oracle@ServerB
export ORACLE_SID='orcl'
chmod 777 -R /oracle/test1/DATAPUMP
export ORACLE_HOME=/oracle/Home1
export PATH=$PATH:${ORACLE_HOME}/bin
sqlplus / as sysdba <<EOF
spool sss1.txt;
.....

While connecting to ServerB I am getting the above error.

Please help me.

thanks,
maddy

sshpass is not the same as ssh, it creates a controlling "terminal" which is not a /dev/tty device.

Do not use sshpass, just use ssh:

echo "
export ORACLE_SID='orcl'
chmod 777 -R /oracle/test1/DATAPUMP
export ORACLE_HOME=/oracle/Home1
export PATH=$PATH:${ORACLE_HOME}/bin
sqlplus / as sysdba <<EOF
spool sss1.txt; 
.. and all the rest" > myscript.sh
chmod 777 myscript.sh
scp -p myscript.sh   oracle@ServerB:/tmp/myscript.sh
ssh oracle@serverB '/tmp/myscript.sh'

These commands require that the user running the code on serverA above have ssh keys on serverB. Since you already have the password for the oracle account, this should be trivial.

Thanks Jim... It was helpful