run oracle query remotly with shell script


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting run oracle query remotly with shell script
# 1  
Old 08-25-2009
run oracle query remotly with shell script

hello

how to run shell script to excute oracle queries on remote db ?

i have tried as following
sqlplus -s user/password@remote_server "select query;"
but not working
also this one
sqlplus -s user/password@remote_server `select query;`
not working Smilie
i add this line to run another .sql file like this one :
sqlplus -s user/password@remote_server /oracle.sql
but also not working

thanks to help how to do that and excute the data

regards
# 2  
Old 08-25-2009
Code:
sqlplus -s user/password@${ORACLE_SID} 'select query;'

# 3  
Old 08-25-2009
Quote:
Originally Posted by vgersh99
Code:
sqlplus -s user/password@${ORACLE_SID} 'select query;'

the script should run to excute sql query on remote machine..
solution
sqlplus -s user/password@${ORACLE_SID} 'select query;'
not working ,.
ERROR:
ORA-12154: TNS:could not resolve the connect identifier specified
i added the tns name for the remote machine after $remote_server but not working
# 4  
Old 08-25-2009
Do you have an Oracle client installed on a LOCAL machine?
If so, is tns_names configured correctly? Can you tnsping remote DB by its SID from LOCAL machine?
# 5  
Old 08-25-2009
Hello

thanks for ur support it works like the follwoing
sqlplus -s user/password@remote_server @sql.file

and in the sql.file i add all queries i wants ,,

thanks man for ur support Smilie

---------- Post updated at 02:23 PM ---------- Previous update was at 02:19 PM ----------

Quote:
Originally Posted by vgersh99
Do you have an Oracle client installed on a LOCAL machine?
If so, is tns_names configured correctly? Can you tnsping remote DB by its SID from LOCAL machine?
can u help me how to add the output into file so i can load later into mysql db ?

regards
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Shell script to run sql query having a long listing of parameters

Hi, I have a query regarding execution of a sql query having long listing of parameters ..I need to execute this query inside a shell script. The scenario is like.... Suppose I have a file abc.txt that has the card numbers..it could be in thousands.. then I need to fire a query like ... (12 Replies)
Discussion started by: vsachan
12 Replies

2. Shell Programming and Scripting

Run SQL thru shell script: how to get a new line when run sql query?

Hi, this's Pom. I'm quite a new one for shell script but I have to do sql on shell script to query some information from database. I found a concern to get a new line...When I run my script, it retrieves all data as wondering but it's shown in one line :( What should I do? I'm not sure that... (2 Replies)
Discussion started by: Kapom
2 Replies

3. Shell Programming and Scripting

How to run a SQL select query in Oracle database through shell script?

I need to run a SQL select query in Oracle database and have to capture the list of retrieved records in shell script. Also i would like to modify the query for certain condition and need to fetch it again. How can i do this? Is there a way to have a persistent connection to oracle database... (9 Replies)
Discussion started by: vel4ever
9 Replies

4. Shell Programming and Scripting

Problems with storing oracle sqlplus query output shell script

Hello everyone, I have a RHEL 5 system and have been trying to get a batch of 3-4 scripts each in a separate variables and they are not working as expected. I tried using following syntax which I saw a lot of people on this site use and should really work, though for some reason it doesn't... (3 Replies)
Discussion started by: rockf1bull
3 Replies

5. Shell Programming and Scripting

Shell Script to execute Oracle query taking input from a file to form query

Hi, I need to query Oracle database for 100 users. I have these 100 users in a file. I need a shell script which would read this User file (one user at a time) & query database. For instance: USER CITY --------- ---------- A CITY_A B CITY_B C ... (2 Replies)
Discussion started by: DevendraG
2 Replies

6. Shell Programming and Scripting

run query in shell script after ssh

Hi, I need to run sql query in shell script after getting connected to ssh. For that I connected to ssh through shell script using RSA keys done]. Now when I am running sql query, it's not working... but several other commands like 'ls'. 'mkdir', etc are working properly. Here is my code: ... (2 Replies)
Discussion started by: shekhar2010us
2 Replies

7. Shell Programming and Scripting

Connect Oracle using shell script at run time

Hi all, I am a newbie.....am jus trying to connect to oracle thro a script, but not thro giving the username/password@server_name directly like `$ORACLE_HOME/bin/sqlplus username/password@server_name In the above line, once it is connected to Oracle, it shud ask me the username and password... (4 Replies)
Discussion started by: kritibalu
4 Replies

8. Shell Programming and Scripting

Shell script to query Oracle table

Hi, unix gurnis I need help for following requirement for writing a shell scritp. log in to oracle database, query one table total records (select count(*) from table1), pass the return value to a file. Thanks in advance (2 Replies)
Discussion started by: ken002
2 Replies

9. Shell Programming and Scripting

Query Oracle tables and return values to shell script that calls the query

Hi, I have a requirement as below which needs to be done viz UNIX shell script (1) I have to connect to an Oracle database (2) Exexute "SELECT field_status from table 1" query on one of the tables. (3) Based on the result that I get from point (2), I have to update another table in the... (6 Replies)
Discussion started by: balaeswari
6 Replies

10. Shell Programming and Scripting

run shell script from oracle store procedure

hi, this is urgent..can i run a shell script from store procedure without using java. (8 Replies)
Discussion started by: arnabb4u
8 Replies
Login or Register to Ask a Question