Batch file / SQLPLUS automation Error message

All,
I have a batch file process that runs my sql script in sqlplus. I have error handling / whenever statements in the sql script. I ran into an issue when the database admin accidently changed my directory path for one of my scripts. The script failed, however it did not send me an email. I want to get an email if the path name for the script is incorrects. When I run the batch file manually with an incorrect path, the process hangs. It logs into sqlplus. Once it cannot find the file, I can find a way to exit sqlplus and send a error code back to the batch file. Below is the batch file. I also want to be notified if I can't connect to the database or the login/password is incorrect. As long as the directory is fine and the tns names and database are fine the code runs. I just want to capture the error if it does not run. Can someone help me?
Note: If file does not exist, I can capture the error. However, the batch file hangs. I want to go the the next step and email the content of the captured error.
sqlplus command line:
SQLPLUS -s xxxx/xxxx@database @C:\test_error\test_error.sql > C:\test_error\sql_logs\%SortDate%_sql_log_file1.txt 2>&1
Batch file:
@ECHO on
VERIFY ON
SET SortDate=%date%
:START_SQL
SQLPLUS -s xxxx/xxxx@database @C:\test_error\test_error1.sql > C:\test_error\sql_logs\%SortDate%_sql_log_file1.txt 2>&1
IF %ERRORLEVEL% == 0 GOTO SQL_SUCESSFUL
IF %ERRORLEVEL% NEQ 0 GOTO SQL_ERROR
:SQL_ERROR
echo "THE SQL SCRIPT FAILED!!!"
c:\bmail -s 0.0.0 -t [email protected] -f [email protected] -h -a "THE SQL SCRIPT FAILED!!!" -m C:\test_error\sql_logs\%SortDate%_sql_log_file1.txt -c
GOTO END
:SQL_SUCESSFUL
ECHO "SQL WAS SUCESSFUL"
c:\test_error\test_dribble_merger_perl.pl > C:\test_error\perl_logs\%SortDate%_PERL_ERROR.log 2>&1
IF %ERRORLEVEL% == 0 GOTO PERL_COMPLETE
IF %ERRORLEVEL% NEQ 0 GOTO PERL_ERROR
GOTO End
:PERL_ERROR
echo "THE PERL SCRIPT FAILED!!!"
c:\bmail -s 0.0.0 -t [email protected] -f [email protected] -h -a "THE PERL SCRIPT FAILED!!!" -m C:\test_error\perl_logs\%SortDate%_PERL_ERROR.log -c
GOTO END
:PERL_COMPLETE
ECHO "PERL WAS SUCESSFUL. PROCESS COMPLETE"
GOTO End
:END
Thanks,
CC

Hi Experts,
I also have the same scenario.
if i gave invalid tnsname it disconnects from the sqlplus connection but the output errorlevel is 0 which should be 1 as there was an error
echo before %errorlevel% >>abc.txt
(echo whenever oserror exit FAILURE
) | sqlplus scott/tiger@[email protected] >>abc.txt
echo after %errorlevel% >>abc.txt
if i give invalid tnsname also,
For me after gives 0.
which is not correct
how to identify is the sqlplus returned without any error?

Similar Messages

  • When packaging a file in indesign - Error message - Cannot copy necessary linked file(s)

    When packaging a file in indesign - Error message - Cannot copy necessary linked file(s)

    Can you select all Links in the Links Panel
    Use the Flyout Menu on the top right of panel.
    Choose "Utilities>Copy Links to"
    And see if that works.

  • My operating system is Windows XP SP3.  I have Adobe 11.0.08 installed.  I cannot print a pdf file/document. Error message - AeroRd32.exe - Unable To Locate Component  -  "Application failed to start because lxdautil.dll not found."  Any suggestions?

    My operating system is Windows XP SP3.  I have Adobe 11.0.08 installed.  I cannot print a pdf file/document. Error message - AeroRd32.exe - Unable To Locate Component  -  "Application failed to start because lxdautil.dll not found."  Any suggestions?

    That DLL is part of your printer driver; reinstall or update the device driver for your printer, and the message should go away.

  • Hi Trying to download CS5 Design Premium. We have a copy on the Mac and want to put a second copy on the Macbook pro. Can download the file but when it is clicked the file give an error message "User access denied" and dumps the download. So hence I do no

    Hi Trying to download CS5 Design Premium. We have a copy on the Mac and want to put a second copy on the Macbook pro. Can download the file but when it is clicked the file give an error message "User access denied" and dumps the download. So hence I do not get an installation screen or a chance to enter the Licence no.

    Use another browser.
    Mylenium

  • Help opening file - file not found error message

    When I try to open an excel file that shows up in the finder, excel opens but then I get a "file not found" error message.
    Any ideas what is going on?

    Hi Ceeblee,
    SOLVED
    How ?? This is a forum for sharing solving problems. So even you solved your own issue it would be helpful for others who read your topic to know how you solved. This could be helpful for future problems for other users.
    Thanks ...
    Dimaxum

  • Since I updated my Creative Cloud desktop App to its last version, my files are no longer synchronized. I received the "fail to synch files" and "server error" messages.

    Since I updated my Creative Cloud desktop App to its last version, my files are no longer synchronized. I received the "fail to synch files" and "server error" messages.

    Hi, Jeff.
    I'm not on a network and I didn't change anything on my secutiy setups, so I got in touch to the customer support. They checked my computer and found nothing wrong, so they uploded some log files to analyse the case. I'm waiting for a answer.
    Thanks for the tips.

  • Help with "The end of file was reached" error message in Outlook 2011

    Hello, I am having an issue with Outlook 2011 that after 24 hours or so I am getting a “The end of file was reached” error message code -17895.
    Right after this error I get a disconnected from Exchange server and even after re opening the client it stays like this for about 5 minutes then restores. Has anyone else seen this error? I am able to reproduce this on multiple machines with multiple Exchange
    2010 mailbox accounts.  

    Same situation here:
    Outlook 2011 for Mac using Office 365, 3 users have reported the End of File Reached error when trying to send email.
    I have logged a ticket with Microsoft support and they have followed up with the following directions.
    1.    
    Repair Disc Permissions On A Mac
    o   
    1
    Log in to your computer with the administrative account. Open the hard drive, go into the "Applications" folder and then open the "Utilities" folder. Now launch the Disc Utility application.
    o   
    2
    Select your main hard drive. You'll probably see two options--one is the manufacturer's name of the disc and the other name is what you've called it. Choose the name of your hard drive.
    o   
    3
    Click on "Verify Disc Permissions" and the computer will perform a diagnostic test. After a few minutes, the problems with disk permissions will be reported in the Disc Utility window.
    Click on "Repair Disc Permissions" to fix them.
    o   
    4
    Insert your Mac OS X installation disk and restart your computer. Hold down the "C" key on your keyboard to boot from the disk rather than your computer's hard drive. Cancel the OS
    installation and open Disc Utility.
    o   
    5
    Click on "Verify" to have Disc Utility check your computer's hardware. Notice that this option is only available when the program is run from the CD. You can only test the hardware
    of a computer that isn't running the program locally.
    o   
    6
    Use Disc Utility to try and repair any hardware errors that it detects. Usually fixing the permissions will be enough to maintain your computer. If you still experience frequent lockups
    and crashes, then you should try repairing it with this method.
    Tips & Warnings
    If you use your computer for high-performance work, such as software compiling or video editing, then you may want to check the permissions weekly. Most computer users will only need
    to fix permissions after noticing problems with applications or the operating system.
    If the computer's performance does not improve after repairing permissions, then you'll have to troubleshoot for other issues. You may want to purchase more RAM for your computer to
    help speed it up.
    Permissions repairs will not correct problems caused by applications that did not use Apple's installer. Try deleting all files associated with the application and then reinstalling
    it.
    Avoid repairing the permissions after you've booted the computer from the OS X CD. It won't cause problems to your drive, but the version of "Disc Utility" on the CD may not be updated
    to address permission changes that are required by certain software updates.
    Secondly, the information for repairing an Outlook 2011 database is as follows:
    http://support.microsoft.com/kb/2360509

  • I can open my new InDesign files by going up through the menu and opening that way, but when I try to just double click on an InDesign file I get error messages telling me that certain plugins aren't available.

    I upgraded my Mac a few weeks ago to 10.10.2 Yosemite, and I joined the Adobe cloud so I could get access to all the new apps. I read a blurb somewhere about converting older InDesign files to the new CC version I'd have to open the old files in my old InDesign CS3, export to an ins file, then open that file in the new InDesign CC, then export it again to an idml file, then open that file and you shouldn't have any of the usual conversion problems. For the first few files I had to convert, it worked just fine. Now for some reason, whenever I try to open one of these converted files just by double-clicking on the file itself, I get an error message that says, "The document ____ uses one or more plug-ins which are currently not available on your system. Do you want to open anyway?" When I click OK, then I get another error message that says, "Cannot open ____. Please upgrade your plug-ins to their latest versions, or upgrade to the latest version of Adobe InDesign." I thought this CC version of InDesign was the newest. Can somebody please tell me what gives with this? Any help will be very much appreciated.

    Did you reinstall CS3 after CC?
    For that matter, doing an in-place upgrade on the OS is always a gamble with Adobe programs. Reinstalling all the versions you need, in order, would probably solve your problem.
    And you shouldn't need to save as IDML after opening the .inx in CC.

  • Merge to HDR Pro from LR5. After applying preset and during conversion of file, Iget an error message "Adobe Photoshop CC 2014 has stopped working" and closing PS

    In LR5 i do: Merge to HDR Pro. After I apply my preset and PS attempts to convert HDR file, I get an error message from PS: "Adobe Photoshop CC 2014 has stopped working". Then PS Closes.
    My source files are 5 NEF files of 28 MB. I select 16-bit, I also tried 8-bit. No difference. Same error message.
    I have a Toshiba Quosmio X870 with Intel i7 3610QM @ 2,30 GHz, 16 GB RAM, Windows 7x64 HP SP 1, 7,3 Performance Index
    Any suggestions?

    As the crash report says - your outdated video card driver is crashing. You need to update your video card driver from the GPU maker's website (AMD/ATI in this case).

  • App runs in Eclipse environment but not from jar file with no error message

    When I upgraded my jre to 5.0 my app does not run. After fixing the properties problem I had a few days ago it is now at least compiling and running within Eclpse
    However, when I export to a jar file it runs to a certain point and then just goes away with no error message!!! I've narrowed it down to the exact point where it dies but don't understand why it dies and especially gives me no errors whatsoever. It just goes away.
    It is creating an instance of a new class when it dies.
    Can someone please help me?

    Ok, well it doesn't. Anyway, I'm still having the same problems. I can run my jar file to a certain point and then the application just stops. I know this because I've put come message boxes in the application to let me know where in the app the system is.
    It always dies when it is instantiating the new class called HeidiFrame; done by:
    HeidiFrame heidiFrame = null;
    if I put code in between the above line and before the below line, this code will work fine
    heidiFrame = new HeidiFrame();
    but if I put code after the above line, nothing happens
    As I said this all worked fine until I upgraded to Java 1.5
    If you look at http://java.sun.com/javase/technologies/compatibility.jsp there are 23 compatibility issues with the new release. We're using xml stuff so that was my first problem and the code wouldn't even compiile. Once I added in libraries, the code compiled and ran beautifully.
    However, when creating my jar file so I can deploy this application , I've discovered that the jar file will only run to a certain point, as I've stated previously. So, that's my problem. Not that I can't run it from the command prompt, which I can't, but it's a gui application. I've tried changing things in the classpath file and the manifest to no avail. Nothing changes. The application starts but when it goes to instantiate the HeidiFrame class, which is the class that actually builds the gui it dies and goes bye bye.

  • HELP! Lost ALL my bookmarks & Bookmark Toolbar is empty. Attempts to restore from the backup files yields an error message that says, "Unable to process the backup file." Have tried opening nearly all 10 existing backups w/same result.

    I was in the midst of a Firefox session w/two windows open. Nothing special about the sites. No fancy javascripts or anything. When I closed the second window and opened the "History, Show all History" pull-down, the Library screen had no data in it.
    I looked for the Bookmarks.html file in my profile and it is missing. I tried renaming an old .bak file from a couple years ago and I can open it as a file and see the text of it displayed but Firefox will not recognize it as and open it as the Backups file.
    Following the directions already posted - using "History, Show all History" then the "Import and Backup, Restore" process - allows Firefox to see all the backups, but trying to restore from any of them yields the "Unable to process the backup file" error message.
    I have re-started my machine from a cold start - twice now.

    The file that stores bookmarks is probably damaged, for details on how to fix that see http://kb.mozillazine.org/Unable_to_process_the_backup_file_-_Firefox

  • How to open an InDesign CS5 file in CS4 - error message.

    I worked on a file in Mac's OS Adobe CS5 InDesign
    at school; emailed it to my home address; tried to open it in Windows
    XP Adobe CS4 (I've done the same thing with other InDesign
    files recently without problems) and received the following error message:
    "Cannot open "file name".  Please upgrade your plug-ins to their latest versions, or upgrade to the latest version of Adobe InDesign."  To the left is a list of 18 (!) plug-ins.
    Of course when I click "OK"  I'm sent back to a blank .indd screen.
    Solutions?  Suggestions?  More info needed?
    Any and all assistance will be appreciated.
    phishnet1

    Thank you, Scott;
    I'll give this a try when I return to class on Thursday.  I am puzzled that other InD CS5 files have opened in CS4 after a message that "some data may be lost" - which I have clicked "OK", edited the file and emailed it back to school to open in CS5.  Oh, well, if this works I'll use it on all the CS5 files that I create in class.
    I appreciate your email.
    Sandra

  • "ipod cannot be updated...required file in use" error message HELP!

    So I just updated my itunes with the new 7.0 and everything works great, except-- every 10 mins or so, I get this error message "The ipod "xxx's ipod" cannot be updated. The required file is in use."
    Nothing happens, I just have to click "ok", but its really annoying. And it pops up again in a few minutes.
    I seem to remember this happening before on another update but I don't remember what I did.
    Anyone else experiencing this or know what to do?
    Thanks!!

    I am having the exact same problem -- Itunes version 7 update seems to have created this issue. I get this error message about every five minutes if my Ipod is plugged into my computer, "Ipod cannot be updated. Required file is in use." Super annoying. I noticed a solution posted on this forum but it doesn't seem to work for Macs. Does anyone have any suggestions?
    G5   Mac OS X (10.3.9)  

  • Media Encoder not encoding files?  No 'error' message.

    So I've never had a problem with the media encoder until about a few weeks ago when I tried to make a skiing video.  I'm using version CS4 and when I go to encode the premiere pro file it never encodes.  it says its encoding but it never does anything and after 20 mintues or so it'll just stop and then give me an error message.  Not sure how to fix it, please help.  
    Here is a picture of what it looks like.
    Thanks

    Hi, and welcome to the forums.
    See #D5 in Time Machine - Troubleshooting (or use the link in *User Tips* at the top of this forum).
    If you're in doubt about what was actually backed-up on any particular backup, see #A2 there.

  • Reader does not open files. give and error message that it has to close. uninstall will not work.

    Need help getting reader xi to open files or uninstall. Getting error message that it has to close due to and error when file is being opened. Uninstall give an unrecognized patch message. can you help with this?

    On which OS are you working? Is your Reader updated to the latest?
    If you are on Windows you can use AcroCleaner tool which will remove Reader 11 from your system.
    Reboot after clean up and then try reinstall from here

Maybe you are looking for

  • Why is it not possible to highlite text inside every PDF?

    Hey guys, Does anybody know why I cannot highlight text inside a few PDFs? I know already the following: If you scan a document and save it as a PDF, it is normally an ordinary picture and therefore you cannot highlight anything. However, I can highl

  • Send multiple email attachments using FM SO_NEW_DOCUMENT_ATT_SEND_API1.How?

    Hi All, I have a requirement to send email to an external ID for which I am using FM SO_NEW_DOCUMENT_ATT_SEND_API1.Can anyone give a sample code to send multiple excel attachments using this function module. Points would be rewarded. Thanks Archana.

  • Error while executing ECC_SALESORDERCRTRC web service

    hello, I am getting error while executing the we service ECC_SALESORDERCRTRC using webservice navigator XML Serialization Error. Object content does not correspond to Schema restrictions of type [http://sap.com/xi/APPL/SE/Global][BusinessDocumentMess

  • Unable to get the same font in swf file

    Hi, I've created some swf files in which text was written using one particular font. When I run these swf files in other computers which don't have this font, The text gets displayed in different font. How to get the same font in other computers also

  • BarCode in PDF Question

    Hi, I try to make bar code in a PDF form. Question is, how can I make the value move from one field to another and bypassing something in between those field. For example: On the form on my end, I have Passport Number, Name, Exp. Date, DoB etc...the