Oracle SQL Developer has 2 client-side logging mechanisms for capturing SQL that is executed:
- SQL History
- Statements
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.
It’s limited by the size defined in the preferences. 100 is the default. I recommend you bump that to 500 or 1,000.
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.
6 Comments
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.
Understood.
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.