Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Remote 'su -c'

Status
Not open for further replies.
Jun 18, 2001
21
US
I am trying to start/stop an Oracle database on a remote server during a backup. The startup/shutdown script for the database executes an 'su' call to run as a dba.

Since my HP Omniback Cell Manager is on serverA, and I am trying to backup serverB I am unable to start and stop this database from a remote server.

Any ideas on how to execute a remote script that contains an 'su -c' within it?
 
Hi,
That is not what you are looking for exactly, but it may give you a clue:
remsh <remote_server> -l <oracle_user> &quot;. ./.profile; cd <directory>; sqlplus <connect_string> @./script.sql&quot;

The above command executes the commands separated by ; on a remote machine as a user <oracle_user>.
Of course you have to allow the remote login.

mewa
 
I have to change the technical user this thing displays, I am a UNIX Admin ... You could set this up to run on Omniback as a pre-exec script on the Omniback server inside the Omniback application running the command remsh command at the top. Now its been a while, but I think I still have the notes on how to do this. I had to do this at the last job that I had over a year ago. I will get the notes on Monday and post it. I wish that I still was working on HP I have been working with Sun for the last year or so. I just remembered that you could also do a post-exec script ... Once the backup is completed, you could start Oracle and the listeners back up .. OOO I get really excited about this stuff ... I need a life!!) now I really am starting to remember .. Write the pre and post scripts and call the scripts from inside the Omniback app as I said previously. I will see if I still have the scripts as well ...
 
We are using the PRE & Post scripts in omniback to stop/start the databse on the remote servers.

The problem arises in the reporting. Currently the Omniback PRE and post scripts are located on the remote machine. I am trying to at least make the POST script reside on my local Cell Server. I would then call the remote script to start my database and issue an OMNIRPT command to record my session status.

 
Hi,
Now I think I understand what you want to do:
1. your post-exec is to be run on CS
2. post-exec runs a remote script which stops/starts a db
3. post-exec runs omnirpt on the local machine
Is that correct?

But I still don't get what is your problem with the post-exec scripts.

Please, be more specific.

mewa
 
Currently, we have a Cell Server unning a job that executes remote PRE & POST scripts to shutdown.startup an Oracle instance.

This poses a problem in that I cannot run an omnirpt command on my cell server as part of my post script.

Since the Pre scripts have an &quot;su -c&quot; call imbeded in them, I cannot remsh them from a script on my CS.

Any ideas on how to have two post scripts? Or how to allow the call a remote script with an imbedded &quot;su -&quot; call in it?
 
I think that instead of using 'su -' command in your post-exec script to stop a database you could run remsh with -l option.
Here is an example of a script:
#!/usr/bin/sh

#stop a database
remsh host -l oracle &quot;. ./.profile; cd $ORACLE_HOME; ./bin/dbshut&quot;
#the end of script

I assume that Oracle variables are set in .profile and that
the file .rhosts in oracle user home directory is set up correctly and that .rhost in user running that script is set up correctly.
I tested the script and it's working in my hpux.
If testing the script first check if 'remsh host -l oracle ls' is working correctly. If not check the .rhosts files.

mewa
 
Thanks, but only the root user has remote access on oour servers. We do not allow other users to run the 'remsh'
 
What about:
remsh host -n &quot;su - oracle -c any_command 2>&- &quot;

mewa
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top