running shell script from sqlplus


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting running shell script from sqlplus
# 1  
Old 07-19-2006
running shell script from sqlplus

I have a script which connects to different database servers using sqlplus. Is there a way by which I can run a shell command on that host from sqlplus?

I know about 'host' command but it runs script on the local machine where the original script is running. Is there a way to run command on the remote host to which I am connection thru sqlplus.

Thanks
# 2  
Old 07-19-2006
Code:
host remsh yournodename "somecommand someparm1  someparm2"

man remsh
# 3  
Old 07-19-2006
Is there any other way apart from rsh/remsh.. rsh is blocked. When I do it says permission denied.

Thanks,
# 4  
Old 07-19-2006
What are you trying to do? (rather than fixing how you are currently doing it)
# 5  
Old 07-19-2006
I have a script that connects to different databases using sqlplus. It basically pulls rows from all the different servers and creates a repository in a single table on host machine.

Apart from pulling information from each database, I also want a script to get executed on the OS where the database reside.

Is this possible using sqlplus?

Thanks.
# 6  
Old 07-20-2006
If rsh and remsh are "turned off" then, no. Not without privilege.

You do realize that you can access all of the remote Oracle servers without physically running your sql code on those servers. In other words, you can write a block of code on boxa, that runs on boxa, that accesses, in turn, all of the remote Oracle instances that you need to query. You never leave boxa, where you have to run your script.

Ask your DBA to set up tnsnames and make a few other other changes so you can do that. This is standard Oracle. You may already be able to do that now, so ask your DBA "how to"
# 7  
Old 07-20-2006
Yes. That is what I'm doing in my script. But apart from running sql on different boxes I also want to run OS commands on different boxes.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Sqlplus in shell script

Hi All, Please let me know what i am missing in the following code (part of my script) Schemas=(AWQM WFCONTROLLER PROVCO PRISM) for s in "${Schemas}" do sch="${s}_$tol" if || ;then echo "This is AD or TD region" sqlplus -s $sch/$tpwd@$ttns <<EOF... (7 Replies)
Discussion started by: pvmanikandan
7 Replies

2. Solaris

Error during running sqlplus command from shell script in Solaris

I am using following code to connect to oracle database from solaris shell script. which will try thrice to connect the database ...at the 4rth atempt it will exir=t. count=0 while ; do sqlplus -s $usrname/$password@dbSID <<-EOF | tee $logfile WHENEVER OSERROR EXIT 9; WHENEVER SQLERROR... (4 Replies)
Discussion started by: millan
4 Replies

3. Shell Programming and Scripting

Running sqlplus for 5 DB in a shell

Hi all, on AIX 6.1 I want to run the following but for 5 DB. How should I do that ? Using FOR, WHILE ???? How ? export ORACLE_SID=DB1 sqlplus / as sysdba << EOF whenever sqlerror exit sql.sqlcode; whenever oserror exit FAILURE set define off set head off set feedback off set echo off... (1 Reply)
Discussion started by: big123456
1 Replies

4. Shell Programming and Scripting

sqlplus in shell script

Hi When I use sqlplus in shell script, I get sqlplus: command not found. ORACLE_HOME is not set. How to set ORACLE_HOME in unix? Thanks (3 Replies)
Discussion started by: vinoth_kumar
3 Replies

5. Shell Programming and Scripting

Running SQLPLUS Script in CRONTAB

Hi, Can someone please help me here with this one. This is my script: # more tosh.sh #!/usr/bin/ksh clear . /home/oracle/.profile echo "Good morning, world." export ORACLE_HOME=/u01/app/oracle/product/9.0.1 export PATH=$ORACLE_HOME/bin:/usr/local/bin export ORACLE_SID=xxxx ... (11 Replies)
Discussion started by: santoshpayal
11 Replies

6. Shell Programming and Scripting

SQLPLUS within shell script

Hi I want to connect to the Oracle database using a username/password and get back the query result(a numeric value) in a variable, which I can then compare using a conditional. Can anybody help me with this. Thanks Gaurav (4 Replies)
Discussion started by: gaurav_1711
4 Replies

7. Shell Programming and Scripting

(Urgent):Creating flat file using sql script and sqlplus from UNIX Shell Script

Hi, I need help urgently for following issue. Pls help me to resolve this issue. I am calling sql script file(file1.sql) from UNIX Shell Script(script1.ksh) using sql plus and trying to create flat file that contains all records returned from SQL query in SQL script(file1.sql) I given... (6 Replies)
Discussion started by: praka
6 Replies

8. Shell Programming and Scripting

URGENT: cron job not running the sqlplus command in shell script

cron job not running the sqlplus command in shell script but the shell script works fine from command line.. Cronjob: 5 * * * * /home/dreg/script.sh script.sh: #!/bin/ksh /oracle/u000/app/oracle/product/10204/GEN/bin/sqlplus -s <user>/<pass>@<sid/home/dreg/sqlscript.sh ... (18 Replies)
Discussion started by: Ikea
18 Replies

9. Shell Programming and Scripting

error running sqlplus from shell file

I am running a shell file following script on bash shell in solaris 10 ( echo abc@orcl echo abc echo "set feedback off" echo "truncate table SIndexDataTypeHst1_changes;" ) | sqlplus -s but getting the following error ERROR: ORA-01005: null password given; logon denied ... (3 Replies)
Discussion started by: mmunir
3 Replies

10. UNIX for Dummies Questions & Answers

Shell Script And SQLPLUS

i'm having real problems retrieving the returncode of my sqlplus-call. I found a lot of informations on the net, but havn't been able to get it running so far, so now i ask for some help ;) I do start the sqlplus out of my shell script with the parameters stored in the proc_clips.sql, which is... (6 Replies)
Discussion started by: maco_home
6 Replies
Login or Register to Ask a Question