I’m out on vacation this week, but you’re in luck. I have to do the Southwest 24 hour check-in thing, so that means I’m stuck on my laptop for a few minutes.

If you’re a command-line kind of guy or gal, then you know all about SQL*Plus. If you’ve spent any time here, then you also know all about SQLcl – our new, modern CLI for Oracle Database.

You’ve probably seen that the tool automatically keeps track of your previous work, and that you can recall it. We call this feature, ‘History’ – and that’s the same name of the command.

Here’s 10 reasons you’re gonna love using this feature.

1. It’s on by default.

You don’t have to do anything to turn it on – it just works out of the box.

2. You don’t need to learn any new commands.

You can just use the up or down arrow keys to cycle through your recent history.

3. You don’t have to worry about exposing critical information, like passwords.

Out of the box, SQLcl does NOT store commands like ‘CONNECT.’ You also don’t have to worry about filling up your history list with a bunch of SET commands. Of course, you can always set the blacklist to dis-allow anything you want.

Use SET HISTORY BLACKLIST to do just that
Use SET HISTORY BLACKLIST to do just that

4. The history isn’t just for this session.

The application stores your history in your OS user $HOME directory, and it’s available from one session to the next.

5. You can change the history limit.

We save 100 of your last ‘things’ out of the box. If you don’t like this limit, you can just change it.

For a CLI, I think 100 is enough for most folks...
For a CLI, I think 100 is enough for most folks…

6. We don’t save ‘bad’ queries in the history…

If your query or script fails, it won’t go into the history. But, you might not like that, so you can change it. Just toggle using the SET HISTORY command.

7. We’re not just saving queries.

If you run an anon block, we’re saving those too. Oh, and they count as just a single entry or ‘statement.’

Use HISTORY FULL command to see more than just the first few characters of your history item.
Use HISTORY FULL command to see more than just the first few characters of your history item.

8. Curious how much time said query took to run?

We auto-magically append the SET TIMING ON numbers to your queries. You can see these with the HISTORY TIME command.

9. Run the same things, over and over?

Don’t worry, you won’t see your

SELECT *
FROM HR.EMPLOYEES;

queries filling up your history list – we just store it once. And if you run HISTORY USAGE, you’ll see just how many times each item has been executed in SQLcl.

10. If you can’t remember anything else, just remember ‘HISTORY.’

Type it. Run it. See your list. Find the item you want, then add it to the buffer via a ‘history #.’ That history item will now be ready for you to execute or edit.

Oh, and about those Southwest boarding passes…

A49 – A52 acquired for the family. I wonder what’s happened in the real-world these past few days?

Author

I'm a Distinguished Product Manager at Oracle. My mission is to help you and your company be more efficient with our database tools.

3 Comments

  1. Rajeshwaran, Jeyabal Reply

    Jeff,

    I am using the latest build of SQLCI (4.2.0), thought “connect” command got backlisted, still see that using HISTORY USAGE.

    demo@ORA12C> conn rajesh/oracle@ora12c
    Connected.

    rajesh@ORA12C> conn demo/demo@ora12c
    Connected.

    demo@ORA12C> history full;
    1 conn sys/Password-1@ora12c as sysdba

    2 $d:\

    3 $dir

    4 $dir d:\app

    5 conn rajesh/oracle@ora12c

    6 conn demo/demo@ora12c

    demo@ORA12C> show history
    HISTORY
    enabled
    blacklist: show,history,connect,set
    Do not show failed statements

    demo@ORA12C>

    Did i miss something ?

Write A Comment