.ora-code.com

Links
Home
Oracle DBA Forum
Frequent Oracle Errors
TNS:could not resolve the connect identifier specified
Backtrace message unwound by exceptions
invalid identifier
PL/SQL compilation error
internal error
missing expression
table or view does not exist
end-of-file on communication channel
TNS:listener unknown in connect descriptor
insufficient privileges
PL/SQL: numeric or value error string
TNS:protocol adapter error
ORACLE not available
target host or object does not exist
invalid number
unable to allocate string bytes of shared memory
resource busy and acquire with NOWAIT specified
error occurred at recursive SQL level string
ORACLE initialization or shutdown in progress
archiver error. Connect internal only, until freed
snapshot too old
unable to extend temp segment by string in tablespace
Credential retrieval failed
missing or invalid option
invalid username/password; logon denied
unable to create INITIAL extent for segment
out of process memory when trying to allocate string bytes
shared memory realm does not exist
cannot insert NULL
TNS:unable to connect to destination
remote database not found'>ora-02019
exception encountered: core dump
inconsistent datatypes
no data found
TNS:operation timed out
PL/SQL: could not find program
existing state of packages has been discarded
maximum number of processes exceeded
error signaled in parallel query server
ORACLE instance terminated. Disconnection forced
TNS:packet writer failure
see ORA-12699
missing right parenthesis
name is already used by an existing object
cannot identify/lock data file
invalid file operation
quoted string not properly terminated
PART II: - Beyond a basic Oracle EXP/IMP shell script: Error Handling & Exit

PART II: - Beyond a basic Oracle EXP/IMP shell script: Error Handling & Exit

2005-09-01       - By Marquez, Chris
Reply:     <<     11     12     13  

It worked!

Only like this;

---export_simple_script_wrapper.sh
...
#typeset -i RC=`/bin/sh /tmp/export_simple_script.sh`
#typeset -i RC=`/tmp/export_simple_script.sh`
/tmp/export_simple_script.sh
RC=$?
...

---export_simple_script.sh
...
exit $RC

Seems the "typeset -i RC=...." will not work for me.

Chris


-- --Original Message-- --
From: Radoulov, Dimitre [mailto:cichomitiko@(protected)]
Sent: Thu 9/1/2005 4:58 PM
To: Marquez, Chris; oracle-l@(protected)
Subject: Re: PART II: - Beyond a basic Oracle EXP/IMP shell script: Error
Handling & Exit Status?

RE: PART II: - Beyond a basic Oracle EXP/IMP shell script: Error Handling &
Exit Status?Try it like this:

===============================================================================
=======
export_simple_script_wrapper.sh:
===============================================================================
=======

###################
# ERROR HANDLING & RETURN CODES
###################
export log_file="export_simple_script_wrapper.log"
# RETURN CODE: Set initial Return Code - RC for this script.
RC=1
echo 'RETURN CODE: Set initial Return Code - RC for this script.' >> $log_file
2>&1
echo $RC >> $log_file

cleanup()
{
       echo cleaning up
       echo "RETURN CODE: $RC"
}

trap 'cleanup; exit $?' EXIT

########################
# EXECUTE SCRIPT LOGIC: 1
########################
#typeset -i RC=`/bin/sh /app/oracle/stagearea/export_simple_script.sh`
/app/oracle/stagearea/export_simple_script.sh
RC=$?
if [[ $RC -ne 0 ]]; then
       exit
else
       echo ' ' >> $log_file
       echo 'ORACLE EXPort SUCCEEDED!: '$RC >> $log_file 2>&1
       echo $RC >> $log_file
       echo ' ' >> $log_file
fi

# RETURN CODE: Show EXPort Return Code - RC: EXPort RETURN CODE.
#RC=$?
echo 'RETURN CODE: Show EXPort Return Code - RC: EXPort RETURN CODE.' >> $log
_file 2>&1
echo $RC >> $log_file

===============================================================================
=======
export_simple_script.sh:
===============================================================================
=======

########################
# EXECUTE SCRIPT LOGIC: 1
########################

exp userid=test/test file=test.dmp log=test.log  >> $log_file 2>&1
export RC=$?

# RETURN CODE: Set next Return Code - RC: ORACLE EXP RETURN CODE.
#RC=$?
echo 'RETURN CODE: Set next Return Code - RC: ORACLE EXP RETURN CODE.' >> $log
_file 2>&1
echo $RC >> $log_file

if [[ $RC -eq 1 ]]; then
       echo ' ' >> $log_file
       echo 'ORACLE EXPort FAILED!: '$RC >> $log_file 2>&1
       echo ' ' >> $log_file

elif [[ $RC -eq 0 ]]; then
       echo ' ' >> $log_file
       echo 'ORACLE EXPort SUCCEEDED!: '$RC >> $log_file 2>&1
       echo ' ' >> $log_file

else
       echo ' ' >> $log_file
       echo 'ORACLE EXPort Utility STOPPED!: '$RC >> $log_file 2>&1
       echo ' ' >> $log_file

fi

exit $RC

===============================================================================
=======

Output & logfile:

$ ./export_simple_script_wrapper.sh
cleaning up
RETURN CODE: 1

$ vi export_simple_script_wrapper.log
"export_simple_script_wrapper.log" 19 lines, 538 characters
RETURN CODE: Set initial Return Code - RC for this script.
1

Export: Release 9.0.1.5.0 - Production on Thu Sep 1 22:53:33 2005

(c) Copyright 2001 Oracle Corporation.  All rights reserved.


EXP-00056: ORACLE error 1034 encountered
ORA-01034 (See ORA-01034.ora-code.com): ORACLE not available
ORA-27101 (See ORA-27101.ora-code.com): shared memory realm does not exist
SVR4 Error: 2: No such file or directory
EXP-00005: all allowable logon attempts failed
EXP-00000: Export terminated unsuccessfully
RETURN CODE: Set next Return Code - RC: ORACLE EXP RETURN CODE.
1

ORACLE EXPort FAILED!: 1




HTH
Dimitre Radoulov


<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<HTML>
<HEAD>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">
<META NAME="Generator" CONTENT="MS Exchange Server version 6.5.7232.39">
<TITLE>RE: PART II: - Beyond a basic Oracle EXP/IMP shell script: Error
Handling &amp; Exit Status?</TITLE>
</HEAD>
<BODY>
<!-- Converted from text/plain format -->

<P><FONT SIZE=2>It worked!<BR>
<BR>
Only like this;<BR>
<BR>
---export_simple_script_wrapper.sh<BR>
...<BR>
#typeset -i RC=`/bin/sh /tmp/export_simple_script.sh`<BR>
#typeset -i RC=`/tmp/export_simple_script.sh`<BR>
/tmp/export_simple_script.sh<BR>
RC=$?<BR>
...<BR>
<BR>
---export_simple_script.sh<BR>
...<BR>
exit $RC<BR>
<BR>
Seems the &quot;typeset -i RC=....&quot; will not work for me.<BR>
<BR>
Chris<BR>
<BR>
<BR>
-- --Original Message-- --<BR>
From: Radoulov, Dimitre [<A HREF="mailto:cichomitiko@(protected)">mailto
:cichomitiko@(protected)</A>]<BR>
Sent: Thu 9/1/2005 4:58 PM<BR>
To: Marquez, Chris; oracle-l@(protected)<BR>
Subject: Re: PART II: - Beyond a basic Oracle EXP/IMP shell script: Error
Handling &amp; Exit Status?<BR>
<BR>
RE: PART II: - Beyond a basic Oracle EXP/IMP shell script: Error Handling &amp;
Exit Status?Try it like this:<BR>
<BR>
===============================================================================
=======<BR>
export_simple_script_wrapper.sh:<BR>
===============================================================================
=======<BR>
<BR>
###################<BR>
# ERROR HANDLING &amp; RETURN CODES<BR>
###################<BR>
export log_file=&quot;export_simple_script_wrapper.log&quot;<BR>
# RETURN CODE: Set initial Return Code - RC for this script.<BR>
RC=1<BR>
echo 'RETURN CODE: Set initial Return Code - RC for this script.' &gt;&gt; $log
_file 2&gt;&amp;1<BR>
echo $RC &gt;&gt; $log_file<BR>
<BR>
cleanup()<BR>
{<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; echo cleaning up<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; echo &quot;RETURN CODE: $RC&quot;<BR>
}<BR>
<BR>
trap 'cleanup; exit $?' EXIT<BR>
<BR>
########################<BR>
# EXECUTE SCRIPT LOGIC: 1<BR>
########################<BR>
#typeset -i RC=`/bin/sh /app/oracle/stagearea/export_simple_script.sh`<BR>
/app/oracle/stagearea/export_simple_script.sh<BR>
RC=$?<BR>
if [[ $RC -ne 0 ]]; then<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; exit<BR>
else<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; echo ' ' &gt;&gt; $log_file<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; echo 'ORACLE EXPort SUCCEEDED!: '$RC
&gt;&gt; $log_file 2&gt;&amp;1<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; echo $RC &gt;&gt; $log_file<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; echo ' ' &gt;&gt; $log_file<BR>
fi<BR>
<BR>
# RETURN CODE: Show EXPort Return Code - RC: EXPort RETURN CODE.<BR>
#RC=$?<BR>
echo 'RETURN CODE: Show EXPort Return Code - RC: EXPort RETURN CODE.' &gt;&gt;
$log_file 2&gt;&amp;1<BR>
echo $RC &gt;&gt; $log_file<BR>
<BR>
===============================================================================
=======<BR>
export_simple_script.sh:<BR>
===============================================================================
=======<BR>
<BR>
########################<BR>
# EXECUTE SCRIPT LOGIC: 1<BR>
########################<BR>
<BR>
exp userid=test/test file=test.dmp log=test.log&nbsp; &gt;&gt; $log_file 2&gt;
&amp;1<BR>
export RC=$?<BR>
<BR>
# RETURN CODE: Set next Return Code - RC: ORACLE EXP RETURN CODE.<BR>
#RC=$?<BR>
echo 'RETURN CODE: Set next Return Code - RC: ORACLE EXP RETURN CODE.' &gt;&gt;
$log_file 2&gt;&amp;1<BR>
echo $RC &gt;&gt; $log_file<BR>
<BR>
if [[ $RC -eq 1 ]]; then<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; echo ' ' &gt;&gt; $log_file<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; echo 'ORACLE EXPort FAILED!: '$RC
&gt;&gt; $log_file 2&gt;&amp;1<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; echo ' ' &gt;&gt; $log_file<BR>
<BR>
elif [[ $RC -eq 0 ]]; then<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; echo ' ' &gt;&gt; $log_file<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; echo 'ORACLE EXPort SUCCEEDED!: '$RC
&gt;&gt; $log_file 2&gt;&amp;1<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; echo ' ' &gt;&gt; $log_file<BR>
<BR>
else<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; echo ' ' &gt;&gt; $log_file<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; echo 'ORACLE EXPort Utility STOPPED!
: '$RC &gt;&gt; $log_file 2&gt;&amp;1<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; echo ' ' &gt;&gt; $log_file<BR>
<BR>
fi<BR>
<BR>
exit $RC<BR>
<BR>
===============================================================================
=======<BR>
<BR>
Output &amp; logfile:<BR>
<BR>
$ ./export_simple_script_wrapper.sh<BR>
cleaning up<BR>
RETURN CODE: 1<BR>
<BR>
$ vi export_simple_script_wrapper.log<BR>
&quot;export_simple_script_wrapper.log&quot; 19 lines, 538 characters<BR>
RETURN CODE: Set initial Return Code - RC for this script.<BR>
1<BR>
<BR>
Export: Release 9.0.1.5.0 - Production on Thu Sep 1 22:53:33 2005<BR>
<BR>
(c) Copyright 2001 Oracle Corporation.&nbsp; All rights reserved.<BR>
<BR>
<BR>
EXP-00056: ORACLE error 1034 encountered<BR>
ORA-01034 (See ORA-01034.ora-code.com): ORACLE not available<BR>
ORA-27101 (See ORA-27101.ora-code.com): shared memory realm does not exist<BR>
SVR4 Error: 2: No such file or directory<BR>
EXP-00005: all allowable logon attempts failed<BR>
EXP-00000: Export terminated unsuccessfully<BR>
RETURN CODE: Set next Return Code - RC: ORACLE EXP RETURN CODE.<BR>
1<BR>
<BR>
ORACLE EXPort FAILED!: 1<BR>
<BR>
<BR>
<BR>
<BR>
HTH<BR>
Dimitre Radoulov<BR>
<BR>
</FONT>
</P>

</BODY>
</HTML>