Skip to Main Content

Infrastructure Software

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

How to pass local variable to another script to run via SSH

Hi ,

Am performing various operations on local server and remote server for oracle database cloning. Am trying to keep all the scripts locally (ie on Local Server) , so that i can run the same script on both local server and database as well as remote server and database.

I know that we can copy the scripts remotely and run it directly , however, i found difficult to redirect the output or result to local log file to compare the results with local & remote server output.

I am stuck on the following example, so, can somebody guide me.

Trying to add lines on remote server on DB or GRID HOME listener.ora file.

    Sequence:

    1. Master Script --> this script will gather details about Local & Remote server : Server Name,Oracle SID, ORACLE_HOME and GRID_HOME

    2. listnr script --> This script will add entry to listener.ora on local server based on ORACLE_HOME and GRID HOME from master script

                              The same script should add entry to remote server listener.ora after getting ORACLE_HOME and GRID_HOME from master script

                              Problem: It doesnt get the ORACLE_HOME and GRID_HOME variable value from master script, so it fails with path issue

       SSH Command to run local script on remote server

       ssh username@remoteserver "bash -s" -- < ./remote_lsnr.sh >  ${ORA_LOG_LOCATION}_STDBY_TNS.log

Please let me know if you need example script, i can upload for review.

Also, feel free ask me if you have any questions on my requirement

Thanks

Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jun 3 2015
Added on May 6 2015
0 comments
740 views