I am running this test.ksh on server1. It successfully logins to server2 but runs the queries of query.sql on server1. query.sql is present in both server1 and server2
Can anybody please help.
I need to run queries on server2 itself.
Below is the test script
Maybe if you explained what you are up to can we help...
Because you have 2 options:
1) You connect using ssh balhblah -c YOURSCRIPT
2) You use a heredoc
(If you dont know what it is: Here Documents )
What you submitted will connect by opening a new shell on server2, the rest will continue to be executed by the script current shell...
As of now , I just need the output to be displayed on the terminal. As soon as the ssh command is interpreted, the host changes back to the local server.
I tried including
It won't work if it's not a valid command. Try . oraenv ; command
To drop to a shell instead of quitting, try ssh -t ... 'command ; exec bash'
The -t forces it to allocate a terminal so interacting remains possible, and the 'exec bash' drops you to a shell once sql is done instead of quitting.
Well, if there isn't an oraenv file in the current directory on the remote server, it's not going to be able to source it. (Don't just copy the one you have, it's probably different on the other server.)
Find it on the remote server or ask its administrator to tell you where it is.