Excuse the hideous pun in the title.  All will become clear shortly.

Often we use SQL Plus to run scripts on a scheduled basis in our database.  The “problem” is, they need to connect to that database.

Here’s a simple script I want to run:

image

and here’s my very sophisticated Smile batch file (which could just as easily be a Unix shell script) to run it:

image

In my case, I’m planning on using a wallet to not reveal the password (see here for details ).

But what if my wallet is wrong or missing?  Or if I’m explicitly coding a username / password and either are incorrect ?

Then this happens when I run my batch file:

image

Yes my connection failed…but notice that the script did not complete.

It…..just….sat….there.

That’s no good…from an observer’s perspective, it is still “running”.

So here’s a quick tip.  Whenever you launch SQL Plus from within a shell or script, always include the -L parameter (“minus elle”)

image

If you can’t connect, SQL Plus will exit and at least you’ll get some feedback that all is not OK.

So use minus elle, to stop your scripts from going to hell Smile

4 responses to “Are your SQL Plus scripts going to ‘ell ?”

  1. This really is a very good tip. I was checking for this some time ago and now I got it. Thanks! 🙂

  2. Å tefan Oravec Avatar
    Å tefan Oravec

    Thanks!

  3. […] switch is to prevent the user input being required if something is wrong with our connecting (see https://connor-mcdonald.com/2016/03/26/are-your-sql-plus-scripts-going-to-ell/) The -S switch is to prevent a lot of the spammy […]

Got some thoughts? Leave a comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Trending