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
Need shell script to read two file at same time and print out in single file sreedhargouda Shell Programming and Scripting 10 03-16-2009 01:36 PM
How can i pass a file from unix to oracle?? vidyadhar85 UNIX for Advanced & Expert Users 1 06-28-2008 08:01 PM
How transfer sql file from one serverto another without username and password Arpitmitm AIX 1 06-01-2008 03:52 AM
how to pass values from oracle sql plus to unix shell script trichyselva UNIX for Dummies Questions & Answers 2 02-24-2006 10:19 AM
How to pass a oracle variable back to the shell script Jtrinh UNIX for Dummies Questions & Answers 3 07-11-2005 03:07 PM

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 06-10-2009
jhon jhon is offline
Registered User
  
 

Join Date: Apr 2009
Posts: 3
Exclamation Read Oracle Username password SID from single file and pass it to shell

Dear All

I am trying to write one shell which will be running through Cron which contain one SQL query. But I want to draw/fetch the Username password and Instance name (required to loging to the database) from one single file to run that SQL query . Also this file contain details of multiple Database.

so How can i acheive that.
username password is diffrent for diffrent DB's .

Please anybody help me out.
  #2 (permalink)  
Old 06-10-2009
vbe's Avatar
vbe vbe is online now Forum Staff  
Moderator
  
 

Join Date: Sep 2005
Location: Switzerland - GE
Posts: 1,586
Load all your needed env vars in profile_for_app
(export APP_USER="name/passwd" ...)
then
in your script for cron:
Code:
. /opt/app/your_app/bin/profile_for_app

sqlplus -s $APP_USER @$HOME/sql/your_SQL.sql

  #3 (permalink)  
Old 06-10-2009
colemar colemar is offline
Registered User
  
 

Join Date: Apr 2009
Location: Trento, Italy
Posts: 116
Quote:
Originally Posted by vbe View Post
Code:
sqlplus -s $APP_USER @$HOME/sql/your_SQL.sql
It is wise to not reveal the password to anybody who is able to run a ps -ef | grep sqlplus command. Therefore:

Code:
$ORACLE_HOME/bin/sqlplus -s << SQLEND
connect $APP_USER
@$HOME/sql/your_SQL.sql
quit
SQLEND

Closed Thread

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 08:32 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