Run scripts on remote server

I have a sql script in my parent server - host1
i can do a passwordless ssh to remote server - host1a and host1b

Can i run the sql script which is present in host1 by connecting to host1a and host1b.
Should i place the sql script in host1a and host1b ? Is there a way i can run without placing the scripts in the 2 child servers.?

Thanks

Confirm if you are not able to connect to database on host1b from host1a

sqlplus user_name/password@dbname

Probably a little safer to run the SQL like this:-

sqlplus <<-EOSQL
   user_name/password@dbname
   select Hello from dual;
EOSQL

The other way will publish your predentials to anyone who does a ps at the time and spots your process.

Call me paranoid, but I'm paranoid :stuck_out_tongue:

Robin