Posted in database, Editors, emacs, Microsoft, oracle, SQL*Plus, Training, Windows

SQL*Plus on Windows (Part 1)

Welcome to Part 1 in a series of articles on running SQL*Plus on the Windows platform.

Did you know that SQL*Plus under Windows is often preferred to its Unix equivalent?
There are many ways to configure SQL*Plus to suit your individual needs but today I’ll just cover one option that makes life that little bit easier (at least in my opinion).

Many beginner DBA’s (and some senior ones too!) often overlook the usefulness of a login.sql script.

We all have our favorite editors, I personally still float between Sublime Text and emacs, but the choice is truly down to personal preference. SQL*Plus on Windows defaults to notepad, as do most applications that use a text editor in the Windows environment, and we all know how useful that is; but its old and there are much better editors out there these days.

With a few choice commands and a bit of technical know-how you can change the default editor for SQL*Plus to something more DBA/Developer friendly.

Launch SQL*Plus on Windows from either the gui or a command prompt.

C:\>sqlplus /nolog

This will launch sqlplus.

Type:

ed login

By default This will launch you into notepad.exe and you will be editing a new file named “login.sql”, this file will be located in the directory you launched SQL*Plus from so remember where that was (the easiest way to do this is to create a shortcut to launch SQL*Plus which starts in the same directory every time, but this is something for another article).

Now this is where we define your preferred editor, so in my case, I like Sublime Text, therefore the line for setting my default SQL*Plus editor is as follows:

def _editor = “C:\Program Files\Sublime Text 3\subl.exe”

Editor

Save and close your file, then restart SQL*Plus.

Now when you type “ed” within SQL*Plus you will be thrown into your preferred editor.

This is just one of the changes that can be made in the login.sql; there are lots of others documented in the SQL*Plus reference documentation but this is my favorite change to make when first working on a new Windows environment.

Keep an eye out for further articles in my series on running SQL*Plus on a Windows platform.

Author:

I am and have been an Oracle dba for the past twenty something years, with a few deviations to dabble in other areas. I’m certified (or is that certifiable) in both Oracle 10 and 11G OCP. I’m an “old skool” hacker at heart in the traditional sense, pulling apart bits of kit to see how they work, mainly with the intention of fixing it, mostly with the outcome of breaking it! I like toying with hardware, software and new technologies and love Linux, although Windows 10 is looking pretty slick too. I have a keen interest in reading / writing and electronics, and occasionally snap a few photos. If I can help you I will, so if you have any questions feel free to ask by using my contact form. -Lee And now for the disclaimer: Anything I write here is my own opinion and does not represent the view of any company I work for now or have worked for in the past.

Leave a Reply

Your email address will not be published.

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