Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Mailing Lists -> Oracle-L -> RE: Beyond a basic Oracle EXP/IMP shell script: Error Handling & Exit Status?

RE: Beyond a basic Oracle EXP/IMP shell script: Error Handling & Exit Status?

From: Allen, Brandon <Brandon.Allen_at_OneNeck.com>
Date: Thu, 18 Aug 2005 15:04:04 -0700
Message-ID: <04DDF147ED3A0D42B48A48A18D574C4502361470@NT15.oneneck.corp>


Chris,  

The $? variable returns the exit code of whatever command was executed immediately before it. In your case, it is exiting the return value of the preceeding 'echo' command. You need to capture the value of $? immediately after the exp command.  

Regards,
Brandon

-----Original Message-----
From: oracle-l-bounce_at_freelists.org [mailto:oracle-l-bounce_at_freelists.org]On Behalf Of Marquez, Chris Sent: Thursday, August 18, 2005 2:47 PM
To: Reidy, Ron; oracle-l_at_freelists.org
Subject: RE: Beyond a basic Oracle EXP/IMP shell script: Error Handling & Exit Status?

Ron,

Thanks I appreciate the comments.
I have not looked into 'typeset' command yet (maybe if I do it will answer my next question?

I used a simple EXP shell script I have and forced the 3 possible outcomes;

     Export terminated successfully with warnings.
     Export terminated successfully without warnings.
     EXP-00000: Export terminated unsuccessfully

"Export terminated..." should produce "0" and
"Export terminated unsuccessfully" should produce "1" however " $? " is always "0" for each?

This snip shell code



exp <<EOFexp >> $log_file 2>&1 \
.......
exit
EOFexp

echo 'EXP ERROR CODE ' >> $log_file 2>&1 echo $? >> $log_file


Either "EXP-00000: Export terminated unsuccessfully" != "Export terminated unsuccessfully" or EXP is never populating " $? " correctly?

Reference;

Doc ID:         Note:281725.1
Subject:        Database Utilities - Export and Import Exit Codes (Errorlevel)

Chris Marquez
Oracle DBA

-----Original Message-----
From: Reidy, Ron [ mailto:Ron.Reidy_at_arraybiopharma.com] Sent: Thu 8/18/2005 4:19 PM
To: Marquez, Chris; oracle-l_at_freelists.org Subject: RE: Beyond a basic Oracle EXP/IMP shell script: Error Handling & Exit Status?

Comments below ...



Ron Reidy
Lead DBA
Array BioPharma, Inc.

-----Original Message-----
From: oracle-l-bounce_at_freelists.org [ mailto:oracle-l-bounce_at_freelists.org]On Behalf Of Marquez, Chris Sent: Thursday, August 18, 2005 2:14 PM
To: oracle-l_at_freelists.org
Subject: Beyond a basic Oracle EXP/IMP shell script: Error Handling & Exit Status?

All,

OK, OK, OK...my task (specifically).
1.) I need to know (or test) if my script completes successfully and assign a value.
[Reidy, Ronald] Use the 'typeset' command to declare a variable (typeset -i rc). At the end oif the exp/imp command assign the value of the return code (rc=$?). Test it from there.

2.) I need to know if/where my script dies/aborts/terminates in the middle and assigning a value....rolling variable?

     "if step A complete then v_stats=...if step B complete then v_stats=..."

3.) I need to get a positive or negative return code from Oracle EXP/IMP utility and pass it to shell script (#2 above).
[Reidy, Ronald] exp/imp return positive codes only. 0 = OK, anything else indicates a warning or failure

I'm all ears...and ready for code samples-scripts, docs, links and references.

Thanks,

Chris Marquez
Oracle DBA

This electronic message transmission is a PRIVATE communication which contains information which may be confidential or privileged. The information is intended to be for the use of the individual or entity named above. If you are not the intended recipient, please be aware that any disclosure, copying, distribution or use of the contents of this information is prohibited. Please notify the sender of the delivery error by replying to this message, or notify us by telephone (877-633-2436, ext. 0), and then delete it from your system.

Privileged/Confidential Information may be contained in this message or attachments hereto. Please advise immediately if you or your employer do not consent to Internet email for messages of this kind. Opinions, conclusions and other information in this message that do not relate to the official business of this company shall be understood as neither given nor endorsed by it.

--
http://www.freelists.org/webpage/oracle-l
Received on Thu Aug 18 2005 - 17:04:56 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US