My error is not being caught or handled


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting My error is not being caught or handled
# 1  
Old 09-23-2009
My error is not being caught or handled

Hi,

I my ksh script I have the following:

Code:
##--Checking the spool file for errors
NumberOfErrors=`cat $CurrSpoolFile | grep " ORA-[0-9]" | wc -l`

my logfile shows this:

Code:
PL/SQL procedure successfully completed.

PL/SQL procedure successfully completed.

BEGIN sys.dbms_stats.export_schema_stats('INFOMAT','STATTAB','RIX230909'); END;

*
ERROR at line 1:
ORA-20000: Table "INFOMAT"."STATTAB" does not exist or insufficient privileges
ORA-06512: at "SYS.DBMS_STATS", line 5158
ORA-06512: at "SYS.DBMS_STATS", line 5185
ORA-06512: at "SYS.DBMS_STATS", line 5587
ORA-06512: at line 1

$NumberOfErrors should give me a result of 5 however when I run the following:

Code:
# Populating the ScriptStatus variable
ScriptStatus="There were ${IndexesBefore} Indexes before the script and ${IndexesAfter} Indexes after the script -- SQL has 
generated ${NumberOfErrors} ORA errors"

  if [[ ${NumberOfErrors} -gt 0 ]] || [[ ${IndexesBefore} -ne ${IndexesAfter}  ]]
  then
        echo "Script Errors... "                                    >> $CurrLogFile
...
...

I get a value of 0. Can anyone see why? When I run the grep command straight from the command line I get my expected results as such:
Code:
>cat Rebuild_ix_COMP.log.curr | grep "ORA-[0-9]" | wc -l
      10

I can't see anything that stands out here...I am so confused...PLEASE HELP!

---------- Post updated at 03:19 PM ---------- Previous update was at 03:14 PM ----------

I also tried this as well:

Code:
NumberOfErrors=cat Rebuild_ix_COMP.log | grep " ORA-[0-9]" | wc -l
ksh: Rebuild_ix_COMP.log: cannot execute
       0

# 2  
Old 09-23-2009
Quote:
Originally Posted by ramangill
...
I also tried this as well:

Code:
NumberOfErrors=cat Rebuild_ix_COMP.log | grep " ORA-[0-9]" | wc -l
ksh: Rebuild_ix_COMP.log: cannot execute
       0

That "ORA-" message starts from the first column. Remove the space to the left of it.

BTW, this command:

Code:
cat Rebuild_ix_COMP.log | grep " ORA-[0-9]" | wc -l

is worthy of the Useless Use of Cat Award.

Try:

Code:
grep -c ^ORA- your_log_file

tyler_durden
Login or Register to Ask a Question

Previous Thread | Next Thread

8 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Continue Processing after a signal is caught

Is it possible to continue after signal is caught and control goes to function specified in the trap statement? (3 Replies)
Discussion started by: Soham
3 Replies

2. Solaris

Exiting (caught signal 11)

I created a new Virtual machine and was trying to install Solaris but keep getting this error.:confused: EXITING (caught signal 11) Type "install-solaris to restart" Can't find anything on Google. This is the iso image I am using "sol-10-u11-ga-x86-dvd" Followed all the instructions on... (5 Replies)
Discussion started by: newborndba
5 Replies

3. Shell Programming and Scripting

Line numbers and exception to be caught in logs

Hi Folks, I have just basic queries is that suppose I have to monitor the logs then there is a command , suppose I have to monitor the abc.log which is updating dynamically within seconds so the command will be after going to that directory is .. tail -f abc.log Now please advise what about... (1 Reply)
Discussion started by: punpun66
1 Replies

4. Shell Programming and Scripting

Number of fields handled by awk

Hi Gurus, Have a file seperated by "~" and no of fields is 104. When i try to run awk, it erros out. awk: record `B~A31~T24_STF~~~2009...' has too many fields Any idea how can i extract a specific filed with this many fields in a row. Kindly help (3 Replies)
Discussion started by: srivat79
3 Replies

5. Shell Programming and Scripting

Move files one at the time and wait until the previous file is handled

I'm a novice at unix and need it more and more to do my work. I seem running into problems getting this script "attempt" to work: I need to copy all files in a directory, which is containing 22000 files, into a directory one level up. There a tool monitors the content of the dir and processes... (2 Replies)
Discussion started by: compasscard
2 Replies

6. AIX

process caught signal 5

Hello, We are using AIX 5.2 ML 7. One of the process in its log file said the following and stopped running. Caught signal=5, exiting. What would cause the signal 5 to be generated on an AIX box. Please advise. Thx Jerardfjay (2 Replies)
Discussion started by: jerardfjay
2 Replies

7. Programming

Ineteractive application handled using Expect script

Hi expert guys, I have unix server where i have a application for some special commands. Below way to entering in that application- bash-2.05$ telnet 11.13.58.39 2310 Trying 0.0.0.0... Connected to .. Escape character is '^]'. CONNECTING TO... PROCESS 2310 CONNECTED... Enter... (0 Replies)
Discussion started by: thepurple
0 Replies

8. Linux

Maximum number of threads handled by a process????

Hi Anybody knows max. no. of threads handled by a process in linux. Please reply Thanks in advnce :confused: (0 Replies)
Discussion started by: Agnello
0 Replies
Login or Register to Ask a Question