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 here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Call sqlplus in the shell script beaniebear Shell Programming and Scripting 3 05-13-2008 06:30 AM
help me in sending parameters from sqlplus script to unix shell script Hara Shell Programming and Scripting 2 01-29-2008 12:31 PM
Shell Script And SQLPLUS maco_home UNIX for Dummies Questions & Answers 6 08-25-2007 09:05 AM
connect to sqlplus in a script big123456 Shell Programming and Scripting 1 09-18-2006 03:56 AM
Need help with ksh script that uses sqlplus, called from PHP j2owilson Shell Programming and Scripting 7 02-27-2006 01:35 PM

Reply
 
Submit Tools LinkBack Thread Tools Display Modes
  #1  
Old 03-06-2006
Registered User
 

Join Date: Mar 2006
Posts: 3
SQLPLUS in script

I have a script that passes a parameter to the sqlplus command that looks like the following:


#!/bin/sh

TARGET_SID=$1
AUXILIARY_SID=$2
sqlplus 'sys@$AUXILIARY_SID as sysdba' @shutdown.sql

I keep getting the following error:
ERROR:
ORA-12154: TNS:could not resolve service name
HOWEVER, I have my sid defined in the tnsnames.ora AND if I take out the parameter $AUXILIARY_SID and put in the actual sid name (PPRD) it works fine. Any Ideas?

Thanks!
Rhonda Nichols
Reply With Quote
Forum Sponsor
  #2  
Old 03-06-2006
Registered User
 

Join Date: Jan 2005
Posts: 682
Use double quotes rather than single quotes.
Reply With Quote
  #3  
Old 03-06-2006
Registered User
 

Join Date: Mar 2006
Posts: 3
Thanks. I never thought of somthing so simple. One more thing. I am trying to pass the pswd as a parameter so that it doesn't so up during ps -ef as follows:


PSWD=***** (where stars are my password)
sqlplus "sys@$AUXILIARY_SID as sysdba" @shutdown.sql <$PSWD


but of course this doesn't work. Can this be done? What am I doing wrong?

-Rhonda
Reply With Quote
  #4  
Old 03-06-2006
Registered User
 

Join Date: Mar 2006
Posts: 3
Sorry, I had a DUH moment.

I just did this:

sqlplus "sys/$PSWD@$AUXILIARY_SID as sysdba" @shutdown.sql

I think this will work

THANKS!
Reply With Quote
  #5  
Old 03-06-2006
Registered User
 

Join Date: Jan 2005
Posts: 682
An alternative is:
Code:
echo $PSWD | sqlplus "sys@$AUXILIARY_SID as sysdba" @shutdown.sql
or you can use a named pipe:
Code:
mknod p sysdba_logon.sql
echo "connect sys/$PSWD@$AUXILIARY_SID as sysdba" > connect.sql &
sqlplus <<-EOF
@connect.sql
@shutdown.sql
EOF
rm connect.sql
Reply With Quote
Google The UNIX and Linux Forums
Reply

Thread Tools
Display Modes




All times are GMT -7. The time now is 09:49 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited.
The UNIX and Linux Forums Content Copyright ©1993-2008. All Rights Reserved.Ad Management by RedTyger Visit The Complex Event Processing Blog

Content Relevant URLs by vBSEO 3.2.0