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 > 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-02-2008 03:29 AM
Shell Script Error jazz8146 UNIX for Dummies Questions & Answers 0 04-23-2008 08:38 AM
awk Shell Script error : "Syntax Error : `Split' unexpected Herry UNIX for Dummies Questions & Answers 2 03-17-2008 11:16 AM
FTP shell script error caturing im_new Shell Programming and Scripting 6 01-15-2008 03:21 AM
shell script error logging niamh UNIX for Dummies Questions & Answers 1 04-05-2004 12:17 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 05-18-2007
jalpan.pota jalpan.pota is offline
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
  #2 (permalink)  
Old 05-18-2007
porter porter is offline Forum Advisor  
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.
  #3 (permalink)  
Old 05-18-2007
jalpan.pota jalpan.pota is offline
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
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 04:30 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