login.sql

“Yawn!”, did I hear you say?

Well, it isn’t going to set the world on fire, but in SQL*Plus and SQLcl you can use scripts to set up some things that may be useful at the prompt.

Highlight when you’re logged in as SYS on a production server, have the prompt show which database on which server you’re logged into and know your session ID and serial# without needing to look it up.


Prompt showing DB account hostname, SID, Session ID and Serial#

If you execute a script in login.sql in SQLcl, the following is the response:

login.sql found in the CWD. DB access is restricted for login.sql. Adjust the SQLPATH to include the path to enable full functionality

As of Oracle 12.2 this would not execute automatically.

To allow execution in 12.2 set the SQLPATH.

Coloured prompt in SQLcl

Of course you can customise the script with the colours that suit your purpose.

Logged in as SYS so highlighted in red

The scripts can be fetched from:

git clone https://github.com/johnthomas22/SQLUtils.git

If you find this useful, please let me know.

%d bloggers like this:
search previous next tag category expand menu location phone mail time cart zoom edit close