How to solve this problem in shell script: unexpected end of file

Hello,
I need to connect to each databases listed in /etc/oratab and check which database is shutdown(or mounted-only) and which database is opened to accept connection. However, following shell script gives me this error message:
$>./check_is_db_runing.sh
./check_is_db_runing.sh: line 39: syntax error: unexpected end of file
Could anyone please help me to solve this problem, why the code (line 29 to 32) does not work in the LOOP? It works without the LOOP.
Thanks in advance!!!
1 #!/bin/bash
2
3 LOGDIR=/data03/oracle/dbscripts
4 ORATABFILE=/etc/oratab
5
6 cat $ORATABFILE | while read LINE
7 do
8 case $LINE in
9 \#*) ;; #comment-line in oratab
10 *)
11 ORACLE_SID=`echo $LINE | awk -F: '{print $1}' -`
12 if [ "$ORACLE_SID" = '*' ] ; then
13 # NULL SID - ignore
14 ORACLE_SID=""
15 continue
16 fi
17
18 # Proceed only if last field is 'Y'
19 if [ "`echo $LINE | awk -F: '{print $NF}' -`" = "Y" ] ; then
20 if [ `echo $ORACLE_SID | cut -b 1` != '+' ]; then
21
22 ORACLE_HOME=`echo $LINE | awk -F: '{print $2}' -`
23 PATH=$ORACLE_HOME/bin:/bin:/usr/bin:/etc
24 export ORACLE_SID ORACLE_HOME PATH
25 LOGFILE=$LOGDIR/check_$ORACLE_SID.log
26 touch $LOGFILE
27 #echo $LOGFILE
28
29 $ORACLE_HOME/bin/sqlplus -s "/ as sysdba" << EOF > $LOGFILE
30 select * from global_name;
31 exit
32 EOF
33
34 fi
35 fi
36 ;;
37 esac
38 done

This code works ie. generates logs with sql result - slightly modified to be runable:
#!/bin/bash
LOGDIR=/tmp
ORATABFILE=/etc/oratab
cat $ORATABFILE | while read LINE
do
case $LINE in
\#*) ;; #comment-line in oratab
ORACLE_SID=`echo $LINE | awk -F: '{print $1}' -`
if \[ -z $ORACLE_SID \] ; then
# NULL SID - ignore
ORACLE_SID=""
continue
# Proceed only if last field is 'Y'
else
ORACLE_HOME=`echo $LINE | awk -F: '{print $2}' -`
PATH=$ORACLE_HOME/bin:/bin:/usr/bin:/etc
export ORACLE_SID ORACLE_HOME PATH
LOGFILE=$LOGDIR/check_$ORACLE_SID.log
touch $LOGFILE
#echo $LOGFILE
$ORACLE_HOME/bin/sqlplus -s "/ as sysdba" << EOF > $LOGFILE
select * from global_name;
exit
EOF
fi
esac
done

Similar Messages

  • I recieve SMS and i hear established melody and I do't hear the person on all over SMS. How to solve this problem?

    Problem with an incoming message. For example, during my conversation the second line receives a call, I hear the sound in dynamics such as "piiiip piiiip," but when in this situation I recieve SMS and i hear established melody and I do't hear the person on all over SMS. How to solve this problem? Perhaps someone tell me? save in advance

    Not Charge
    - See:     
    iPod touch: Hardware troubleshooting
    iPhone and iPod touch: Charging the battery
    - Try another cable. The cable for 5G iPod (lightning connector) seems to be more prone to failure than the older cable.
    - Try another charging source
    - Inspect the dock connector on the iPod for bent or missing contacts, foreign material, corroded contacts, broken, missing or cracked plastic.
    - Make an appointment at the Genius Bar of an Apple store.
      Apple Retail Store - Genius Bar

  • Hi, when ever I'm using 3G, on my Iphone4 sim stops working and Network is lost, this started after I updated my phone with  6.0.1(10A523)version. Please help how to solve this problem.

    Hi, when ever I'm using 3G, on my Iphone4 sim stops working and network is lost, this started after I updated my phone with  6.0.1(10A523)version. Please help how to solve this problem. Thanks.

    Photos/videos in the Camera Roll are not synced. Photos/videos in the Camera Roll are not touched with the iTunes sync process. Photos/videos in the Camera Roll can be imported by your computer which is not handled by iTunes. Most importing software includes an option to delete the photos/videos from the Camera Roll after the import process is complete. If is my understanding that some Windows import software supports importing photos from the Camera Roll, but not videos. Regardless, the import software should not delete the photos/videos from the Camera Roll unless you set the app to do so.
    Photos/videos in the Camera Roll are included with your iPhone's backup. If you synced your iPhone with iTunes before the videos on the Camera Roll went missing and you haven't synced your iPhone with iTunes since they went missing, you can try restoring the iPhone with iTunes from the iPhone's backup. Don't sync the iPhone with iTunes again and decline the prompt to update the iPhone's backup after selecting Restore.

  • I Try to open an Indesign document. The message: it is made in a newer version. Go tot CC: Help/Give your Adobe id/Start Indesign again and try to open the document. This doesn't work. How to solve this problem?

    I Try to open an Indesign document. The message: it is made in a newer version. Go tot CC: Help/Give your Adobe id/Start Indesign again and try to open the document. This doesn’t work. How to solve this problem?

    What version are you running?
    What version was it made with?

  • Hello guys..!! I have got my new  iphone 4 2 days ago.The same day it got a problem of auto restart in every 1, to 2 minutes. I updated and restored it many times...but of no use... can any one help me how to solve this problem..!!

    Hello guys..!! I have got my new  iphone 4 2 days ago.The same day it got a problem of auto restart in every 1, to 2 minutes. I updated and restored it many times...but of no use... can any one help me how to solve this problem..!!

    Go to Settings/General/Reset - Erase all content and settings. the connecto to iTunes and restore as a New phone. Do not restore any backup. If the problem persists you have a hardware problem. Take it to Apple for exchange.
    This assumes that the phone is not hacked or jailbroken. If it is you will have to go elsewhere on the internet for help.

  • Iphone 4 is hiting in ios 5.1.1. any one know how to solve this problem??

    iphone 4 is hiting in ios 5.1.1. any one know how to solve this problem??

    This sounds like a hardware problem and should be taken to Apple if the heating / "hiting" becomes disturbing to you. If you feel that your iPhone has a heating / "hiting" problem and needs to be repaired, please contact Apple Support and they can further assist you in having it inspected, repaired, or even replaced. In the past, the overheating of Apple products has been known to cause harmful problems to a few particular users. Please evaluate your situation and take further action if you feel necessary.
    http://www.apple.com/support/contact/

  • I'm using windows 8 on my pc, and i have just downloaded the latest version of itunes, after i upgraded the latest version of itunes, it can't detect my iphone, but my windows/my pc does. Anyone knows how to solve this problem?

    I'm using windows 8 on my pc, and i have just downloaded the latest version of itunes, after i upgraded the latest version of itunes, it can't detect my iphone, but my windows/my pc does. Anyone knows how to solve this problem?

    Hi jstutsman,
    If you are having issues with your iPod nano not being recognized in iTunes after a recent update, you may find the steps and links listed in the following article helpful:
    iPod not appearing in iTunes - Apple Support
    Regards,
    - Brenden

  • I have a problem in my iphone 4 with wi-fi after update to IOS6 please can help my how can solve this problem?

    I have a problem in my iphone 4 with wi-fi after update to IOS6 please can help my how can solve this problem?

    Nope
    One needs to press the home and sleep / wake keys together for the phone to reset
    The other thing I could recommend
    Let the battery run out and the phone completely "die"
    It may take a day or two with it not being used
    Then plug it in to charge and see if there is any change in behavior
    If you cannot get this to work - you may need to bring it to an Apple store

  • When i go to new sms typing their is always show a text, how can solve this problem?

    when i go to new sms typing their is always show a text, how can solve this problem?

    Delete them and then download them from the desired Apple ID. This may require repurchasing paid applications.
    (95675)

  • Hi my iphone 4 is disabled how can solve this problem? help me please

    hi my iphone 4 is disabled how can solve this problem? help me please

    What do you mean by "disabled"? Disabled by entering the wrong passcode? If so, you'll have to force the phone into recovery mode & restore it to get it working again & remove the passcode:
    Turn your phone off, then force it into recovery mode & restore it:
    Leave the USB cable connected to your computer, but NOT your phone, iTunes running, press & hold the home button while connecting the USB cable to your dock connector, continue holding the home button until you see “Connect to iTunes” on the screen. You may now release the home button. iTunes should now display that it has detected your phone in recovery mode, if not quit and reopen iTunes. If you still don’t see the recovery message repeat these steps again. iTunes will give you the option to restore from a backup or set up as new.

  • I have an IMac 10.5.2 from about 5 years ago and recently my flash player stopped responding.  I tried to update my flash player but it tells me I need an updated system to install the player.  Can anyone help me figure out how to solve this problem?

    I have an imac osx 10.5.2 from about five years ago and recently my flash player stopped operating/responding.  Does anyone know if I have to install a new flash player?  I have attempted it several times and it won't let me.  I would appreciate any suggestions on how to solve this problem.  Do I need a new operating system?

    Why have you not updated to 10.5.8?
    You can check here:  http://www.adobe.com/products/flash/about/  to see which version you should install for your Mac and OS. Note that version 10,1,102,64 is the last version available to PPC Mac users*. The latest version,10.3.183.23 or later, is for Intel Macs only running Tiger or Leopard, as Adobe no longer support the PPC platform. Version 11.4.402.265 or later is for Snow Leopard onwards.
    * Unhelpfully, if you want the last version for PPC (G4 or G5) Macs, you need to go here:  http://kb2.adobe.com/cps/142/tn_14266.html  and scroll down to 'Archived Versions/Older Archives'. Flash Player 10.1.102.64 is the one you download. More information here:  http://kb2.adobe.com/cps/838/cpsid_83808.html
    You should first uninstall any previous version of Flash Player, using the uninstaller from here (make sure you use the correct one!):
    http://kb2.adobe.com/cps/909/cpsid_90906.html
    and also that you follow the instructions closely, such as closing ALL applications (including Safari) first before installing. You must also carry out a permission repair after installing anything from Adobe.
    After installing, reboot your Mac and relaunch Safari, then in Safari Preferences/Security enable ‘Allow Plugins’. If you are running 10.6.8 or later:

  • Hello THIS IS RAZA I GOT A MACBOOK PRO I HAVE A PROBLEM. PROBLEM IS how to solve this problem i have uploaded in .... all the time few days later on i face this problem in safari..... anyone can help me please.....thanks Screen Shot 2015-03-21 at 10.

    Hello
    THIS IS RAZA
    I GOT A MACBOOK PRO
    I HAVE A PROBLEM. PROBLEM IS how to solve this problem i have uploaded in .... all the time few days later on i face this problem in safari..... anyone can help me please.....thanks

    This is a scam. Do not phone these people, at best they will charge you for unnecessary 'cleaning' and at worst they will gain access to your Mac and steal your data. You've probably managed to install some 'adware' which is producing this fake warning. 'Adwaremedic' should remove it and is safe to use - please see
    http://www.adwaremedic.com/index.php

  • Why i can not open my itunes how to solve this problem

    i have problem with my itunes version 10.3 but it said the file itunes library it could'nt be read it was created by new version of itunes where i can go to find the library of itunes or how to solve this problem..

    Hello:
    This article may help:
    http://docs.info.apple.com/article.html?path=Mac/10.7/en/mh11399.html
    Are you really running OS X 10.4 or is your profile out of date?
    Barry

  • My iPad Mini iOS7 is showing only Apple Logo which happened during software update. I tried to restore using iTunes but it asking me to response from iPad. But my ipad only shows apple logo. How can i response? How to solve this problem?

    My iPad Mini iOS7 is showing only Apple Logo which happened during software update. I tried to restore using iTunes but it asking me to response from iPad. But my ipad only shows apple logo. How can i response? How to solve this problem?

    FORCE IPAD INTO RECOVERY MODE
    1. Turn off iPad
    2. Turn on computer and launch iTunes (make sure you have the latest version of iTune)
    3. Plug USB cable into computer's USB port
    4. Hold Home button down and plug the other end of cable into docking port.
    DO NOT RELEASE BUTTON until you see picture of iTunes and plug
    5. Release Home button.
    ON COMPUTER
    6. iTunes has detected iPad in recovery mode. You must restore this iPad before it can be used with iTunes.
    7. Select "Restore iPad"...
    Note:
    1. Data will be lost if you do not have backup
    2. You must follow step 1 to step 4 VERY CLOSELY.
    3. Repeat the process if necessary.

  • HT201441 what if the user also forgot id apple? how to solve this problem? whether the iPhone can still be used?

    what if the user also forgot ps apple? how to solve this problem? whether the iPhone can still be used?

    Start here:
    https://iforgot.apple.com

Maybe you are looking for

  • Ipod not recognized by computer or itunes.!please help..been trying all day

    i did 4 of the 5 R's because when i tried to restore my ipod the ipod updater 2006-03-23 wont even update because it thinks my ipod isnt plugged in. what can i do.

  • File to RFC (Error Mail )

    Hi, I have a requirement like legacy system details ( flat file ) send to RFC/Bapi and the status ( Success or Error ) should be updated to the concerned people with the mail. How can we achieve this in XI? I have done with the File to RFC scenario..

  • LAN problems in bootcamp

    I've been playing Company of Heroes with several friends over LAN (3 macs and a pc), all have the latest patches to the game and are running Windows XP SP2. However, 2 of the macs seem to lag sometimes, enough that the game is almost unplayable on th

  • New iMac boot help

    So I bought the 2.66GHz, 20-inch iMac yesterday from a JB Hi-Fi outlet and got the RAM upgraded from 2 to 4 gig which was performed in store and seemed fine. When I got the computer home, set it up according to the user manual (just to be sure) and s

  • 700p suddenly gives invalid user/password message when trying to get new mail

    My Yahoo Mail Plus account is working fine. When I use versamail on the Palm Treo 700p to retrieve emails from my active Yahoo account, I get "-ERR(Auth)invalid user/password" message. I can access my Yahoo Mail account from the "Web" app on my treo.