The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > UNIX for Dummies Questions & Answers
Google UNIX.COM


UNIX for Dummies Questions & Answers If you're not sure where to post a UNIX or Linux question, post it here. All UNIX and Linux newbies welcome !!

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
found error 138 while run shell script rinku Shell Programming and Scripting 1 06-01-2008 11:29 PM
Shell Script Error jazz8146 UNIX for Dummies Questions & Answers 0 04-23-2008 04:38 AM
awk Shell Script error : "Syntax Error : `Split' unexpected Herry UNIX for Dummies Questions & Answers 2 03-17-2008 08:16 AM
FTP shell script error caturing im_new Shell Programming and Scripting 6 01-15-2008 12:21 AM
shell script error logging niamh UNIX for Dummies Questions & Answers 1 04-05-2004 08:17 AM

Reply
 
Submit Tools LinkBack Thread Tools Display Modes
  #1  
Old 05-18-2007
Registered User
 

Join Date: May 2007
Posts: 3
error in shell script

Hi,

I have written a small shell script which logs into each oracle database on the server and displays whether it is in archivelog mode or not.. The script is as under:


#!/bin/bash
dblist=`ps -ef | grep smon | grep -v grep |cut -d'_' -f3`
for ohome in $dblist; do
sqlplus -s /nolog << EOF
connect / as sysdba ;
ORACLE_SID=$ohome; export ORACLE_SID
set heading off
set feedback off
set verify off
output=`select log_mode from v$database;`
exit;
EOF
echo $ohome
echo $output | sort -u
done

When I run it .. i received errors as under:

jalpan.sh: select: not found
Connected.
SP2-0734: unknown command beginning "ORACLE_SID..." - rest of line ignored.
SP2-0042: unknown command "output=" - rest of line ignored.
bnkdbp01

jalpan.sh: select: not found
Connected.
SP2-0734: unknown command beginning "ORACLE_SID..." - rest of line ignored.
SP2-0042: unknown command "output=" - rest of line ignored.
dosdbp01 --> Oracle Database Name

Pls help

Thx in advance
Reply With Quote
Forum Sponsor
  #2  
Old 05-18-2007
Registered User
 

Join Date: Jan 2007
Posts: 2,965
1. is the ORACLE_SID line supposed to be before the sqlplus line?

2. Are the 'set x y' lines as part of the SQL*PLUS script supposed to have a ';' at the end?

3. The 'output', it looks like you are trying to assign in the SQL*PLUS script but have it magically read by the shell script.
Reply With Quote
  #3  
Old 05-18-2007
Registered User
 

Join Date: May 2007
Posts: 3
Hi,

Reg your point 1 and 2 , you are correct. I did modify it and its working

Reg point 3. i removed ref to output variable and just kept select stmt and it worked

Thanks again for your guidance
Reply With Quote
Google The UNIX and Linux Forums
Reply

Thread Tools
Display Modes




All times are GMT -7. The time now is 12:22 PM.


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