The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

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
Connecting to oracle database from shell script satyakiran Shell Programming and Scripting 8 07-03-2009 03:22 PM
sybase connection through shell-script Amitabh UNIX for Dummies Questions & Answers 9 04-10-2009 10:34 PM
Logging into oracle or SQL from shell script manirsendhil Shell Programming and Scripting 2 04-09-2007 11:46 PM
run shell script from oracle store procedure arnabb4u Shell Programming and Scripting 8 08-16-2006 12:16 PM
shell script- oracle connection problem nattynatty Shell Programming and Scripting 4 08-14-2002 09:48 AM

Reply
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 12-15-2006
DILEEP410 DILEEP410 is offline
Registered User
  
 

Join Date: Dec 2006
Posts: 148
oracle connection from shell script

Hi,

For connecting to oracle my script is using the command
sqlplus username/password@db_instance_name.For this to work i am setting ORACLE_HOME,TNS_ADMIN and ORACLE_SID in a seperate script.My question is,could we make a connection to oracle just by the command
sqlplus username/password ie,without appending the instance name?.If yes,what all are the configurations i have to make before doing this?Your help is appreciated.

With Regards
Dileep
  #2 (permalink)  
Old 12-15-2006
jim mcnamara jim mcnamara is offline Forum Staff  
...@...
  
 

Join Date: Feb 2004
Location: NM
Posts: 5,717
If you define ORACLE_SID, sqlplus user/password will connect you to $ORACLE_SID,
$ORACLE_HOME has to point to a locally mounted directory. There is another variable, TWO_TASK which needs to be set when the instance is on a remote box. It needs to be set to the full name of the remote instance as defined in tnsnames.ora.

Code:
sample tnsnames.ora --
VCSPROD.corp=
  (DESCRIPTION =
        (ADDRESS =
          (COMMUNITY = TCP.corp)
          (PROTOCOL = TCP)
          (Host = somename)
          (Port = 1521)
        )
      (CONNECT_DATA =
        (SID = PROD)
           (GLOBAL_NAME = VCSPROD.corp)
      )
Find SID above. SID=PROD that value -- ORACLE_SID=PROD
find GLOBAL_NAME GLOBAL_NAME=VCSPROD.corp. VCSPROD (no suffix) goes in TWO_TASK. TWO_TASK-VCSPROD
  #3 (permalink)  
Old 12-15-2006
DILEEP410 DILEEP410 is offline
Registered User
  
 

Join Date: Dec 2006
Posts: 148
Yes Jim,you are right.I tried the same and it worked.Thanks for your valuable time and words.Thanks a lot.
  #4 (permalink)  
Old 07-01-2009
archana R archana R is offline
Registered User
  
 

Join Date: Jun 2009
Posts: 1
Oracle login from unix script

Hi,

I am new to this Forum and i need to know more about unix.

Please any body help me in how to connect oracle from unix script and how to access the data from oracle database from unix.
  #5 (permalink)  
Old 07-01-2009
anchal_khare anchal_khare is offline
Registered User
  
 

Join Date: Jun 2007
Location: Mumbai,India
Posts: 325
why hesitate to start new thread for your own topic?

since this is your first post, I advice you to read the forum rules carefully.

please visit here for information about beginners.
unix beginners


for connection to oracle, you can try

Code:
$ORACLE_HOME/bin/sqlplus $uname/$passwd@$sid << END
<<your sql queries goes here>>
<<...>>
exit
END
Hope it helps.

Last edited by anchal_khare; 07-01-2009 at 04:00 AM.. Reason: added sql connection part.
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 05:32 PM.


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