Sponsored Content
Top Forums Shell Programming and Scripting My error is not being caught or handled Post 302355745 by ramangill on Wednesday 23rd of September 2009 03:19:26 PM
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

 

8 More Discussions You Might Find Interesting

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

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

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

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

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

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

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

8. 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
ZGREP(1)						      General Commands Manual							  ZGREP(1)

NAME
zgrep - search possibly compressed files for a regular expression SYNOPSIS
zgrep [ grep_options ] [ -e ] pattern filename... DESCRIPTION
Zgrep invokes grep on compressed or gzipped files. These grep options will cause zgrep to terminate with an error code: (-[drRzZ]|--di*|--exc*|--inc*|--rec*|--nu*). All other options specified are passed directly to grep. If no file is specified, then the standard input is decompressed if necessary and fed to grep. Otherwise the given files are uncompressed if necessary and fed to grep. If the GREP environment variable is set, zgrep uses it as the grep program to be invoked. EXIT CODE
2 - An option that is not supported was specified. AUTHOR
Charles Levert (charles@comm.polymtl.ca) SEE ALSO
grep(1), gzexe(1), gzip(1), zdiff(1), zforce(1), zmore(1), znew(1) ZGREP(1)
All times are GMT -4. The time now is 05:24 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy