Oracle SQL Developer has 2 client-side logging mechanisms for capturing SQL that is executed:

  1. SQL History
  2. Statements
I tend to keep both panels hidden or closed until I need them. The recording happens whether they are visible or not on the desktop.
I tend to keep both panels hidden or closed until I need them. The recording happens whether they are visible or not on the desktop.

SQL History

This is the SQL that you have executed in a SQL Worksheet. It’s also any scripts you have executed in a SQL Worksheet. Ran something the other day and forgot to save it to your script? No worries, pull it up in the SQL History.

Mouse hover over a script item, and you'll see that I'm not fibbing about entire scripts going into your history...
Mouse hover over a script item, and you’ll see that I’m not fibbing about entire scripts going into your history…

It’s limited by the size defined in the preferences. 100 is the default. I recommend you bump that to 500 or 1,000.

Don't go crazy - each item is saved in an XML file. If you have a really, really big number here, you're asking your machine to carry a big load and you'll notice a longer startup time.
Don’t go crazy – each item is saved in an XML file. If you have a really, really big number here, you’re asking your machine to carry a big load and you’ll notice a longer startup time.

Statements

Accessible when you open the Log panel. This is EVERY statement that goes across the JDBC driver connection to the database. That’s things that you run explicitly (like a query in a worksheet) and everything SQL Developer runs because you implicitly asked for it to (like opening a table editor.)

This feature is available in version 4.1 and higher. It’s a great reason to upgrade if you haven’t already. I use it to help debug privilege issues with customers. You can use it to figure out how we do things and how the database works. Or maybe you’re curious how we get the stats and plan when using AutoTrace?

Things common to both features

You can filter the list. You can sort the lists. You can see how much time was spent executing the item. You can open the panels from the View menu. You can dock them, anywhere.

Command Line History

The equivalent of the SQL History feature is also in SQLcl.

Running the history command with the time argument will show the execution time with each executable statement.
Running the history command with the time argument will show the execution time with each executable statement.
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.

6 Comments

  1. If I have more than one version of sql developer open, run some queries and then close the sql developers I’ve found the sql history doesn’t always seemed to be saved and is not availableat a later date.

    • Why do you have more than one copy open at a time? Both are trying to write to the same file, so that’s going to create conflict.

    • If I’m working in differnt environments, say for example, if I’m developing new code in dev I migt want to query data in prd. I prefer to have seperate sql developers for those envs.

  2. Hello,

    I’ve a question about Log/Statements. I’ve V 4.1.3.20, I remember I saw the statement window, but I think I’ve closed it accidentally and I can’t have it back. I still see “Messages” and “Logging Page”. I tried to close and reopen it, but it still hidden.

    Thanks

    • You can try, Window > Reset to Factory

      BUT

      If you’re using Thick connections, you won’t see the Statements panel. It only works for Oracle JDBC thin connections.

Write A Comment