The UNIX and Linux Forums  


Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
.
google unix.com



Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Shell script query max29583 UNIX for Dummies Questions & Answers 4 08-07-2008 07:09 AM
C Shell Script query bpupdown Shell Programming and Scripting 1 05-13-2008 08:38 PM
Need Unix script for executing oracle query ravi gongati Shell Programming and Scripting 14 03-24-2008 05:53 AM
Execute oracle query determined at runtime from a unix script infyanurag Shell Programming and Scripting 4 02-01-2008 07:54 AM
Perl script variable passed to Oracle query rahulrathod Shell Programming and Scripting 1 05-30-2007 09:57 AM

Reply
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Bulgarian Greek Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 08-25-2009
mogabr mogabr is offline
Registered User
  
 

Join Date: Aug 2008
Posts: 32
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
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 (permalink)  
Old 08-25-2009
vgersh99's Avatar
vgersh99 vgersh99 is offline Forum Staff  
Moderator
  
 

Join Date: Feb 2005
Location: Boston, MA
Posts: 5,131

Code:
sqlplus -s user/password@${ORACLE_SID} 'select query;'

  #3 (permalink)  
Old 08-25-2009
mogabr mogabr is offline
Registered User
  
 

Join Date: Aug 2008
Posts: 32
Quote:
Originally Posted by vgersh99 View Post
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 (permalink)  
Old 08-25-2009
vgersh99's Avatar
vgersh99 vgersh99 is offline Forum Staff  
Moderator
  
 

Join Date: Feb 2005
Location: Boston, MA
Posts: 5,131
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 (permalink)  
Old 08-25-2009
mogabr mogabr is offline
Registered User
  
 

Join Date: Aug 2008
Posts: 32
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

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

Quote:
Originally Posted by vgersh99 View Post
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
Reply

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 11:14 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0