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
Logging OWB mapping execution in Shell script npn Shell Programming and Scripting 1 11-16-2006 09:25 AM
Have a script running even with the shell logging out 435 Gavea Shell Programming and Scripting 4 09-20-2005 05:20 PM
logging in Shell script laila63 Shell Programming and Scripting 3 07-16-2004 06:50 PM
shell script error logging niamh UNIX for Dummies Questions & Answers 1 04-05-2004 12:17 PM
security permission logging onto Oracle database ctcuser UNIX for Dummies Questions & Answers 1 03-23-2004 11:14 AM

Closed Thread
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 02-23-2007
manirsendhil manirsendhil is offline
Registered User
  
 

Join Date: Feb 2007
Posts: 1
Logging into oracle or SQL from shell script

Hi,

I have a shell script where I log on to sqlplus like this

log()
{
sqlplus -s scott/tiger <<!
select count(*) from EMP;
!
}

log

Here I have hardcoded/used the username : scott and password : tiger directly to log on to SQLPLUS. If i have my log in information in my profile file then how can I make use of it, instead of harcoding values in the script.

Thanks in advance
  #2 (permalink)  
Old 02-23-2007
anbu23 anbu23 is offline Forum Advisor  
Registered User
  
 

Join Date: Mar 2006
Location: Bangalore,India
Posts: 1,398
Let usernm and pwd be variables defined in the .profile

sqlscpt.sh

Code:
log()
{
sqlplus -s $usernm/$pwd <<!
select count(*) from EMP;
!
}

log

Run the script like this

Code:
. ./sqlscpt.sh

  #3 (permalink)  
Old 04-10-2007
timarcher52 timarcher52 is offline
Registered User
  
 

Join Date: Apr 2007
Posts: 2
I have a little writeup on running SqlPlus commands and PL/SQL procedures from a shell script. Take a look at it. Its located at http://timarcher.com/?q=node/48

It demonstrates a simple way to do it under Oracle and RedHat Linux. Furthermore I show you how to get the return codes from the sql plus execution into your unix script so that you can jump to an appropriate path of execution in your shell script.
Closed Thread

Bookmarks

Tags
linux commands

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:06 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