ThatJeffSmith

SQL Developer 4.1 – Log All the Queries!

Tell Others About This Story:

Oracle SQL Developer is a graphical user interface and integrated development environment for Oracle Database. As you can imagine, a few clicks can results in an awful lot of queries being executed on your behalf.

If you don’t like this fact, you can always use a command-line interface like SQL*Plus or the new sdsql. The only thing that runs there is what you explicitly type..mostly.

Anyways, in version 4.1, you can now see all of the queries going across the ‘JDBC wire’ so to speak.

Open the Log

when something is written to a panel for you to see, it changes color...

when something is written to a panel for you to see, it changes color…

The Statements panel is what we’re looking for.

Do Something in SQL Developer

You could start typing in a worksheet, or click on a table, or launch a report, or…just about anything. In this case I’m going to load the tables in tree.

I get this question ALL THE TIME: Why can’t I see my tables?

So, if you wanna see how we get your tables, now you can – without the effort of doing a trace or digging through v$sql_whatever.

Double-click on the cell to get the easier to read query by itself in the popup box

Double-click on the cell to get the easier to read query by itself in the popup box

So you can see we’re doing a lot more than just SELECT * FROM USER_TABLES here.

The ‘Tricks’

There’s no tricks really. We’re always logging. It’s done at JDBC level – there’s no performance overhead for using this feature. This will capture queries SQL Developer itself is generating, queries the user is executing, and even queries that the underlying framework provided by JDeveloper are using. It will even grab whatever queries are being executed by 3rd party extensions.

There’s no turning it ‘on’ or ‘off’ – it’s just a matter of opening the panel to look at the information or not.

You can clear the panel. If you want to see what the tool is doing, clear the log, and ‘do the thing.’ EZ-PZ.

You can filter. Type whatever text you’re looking for…

Type and hit enter in the search box

Type and hit enter in the search box

We capture the queries and record the sequence so you can step through what’s what.

And we capture the binds, so you can see what values are passed over into your queries.

So, What to Do With This?

I’ll be using it to help answer customers’ questions. Easier than drilling through the source code. I imagine many of you will be using it to see who we’re doing stuff, so you can go do the same stuff. Like, how is SQL Developer grabbing waits in the Instance Viewer? I want to do that same thing in MY report…and now you can.

I think this might be a popular feature. So does this guy.

Related Posts Plugin for WordPress, Blogger...
Tell Others About This Story:

Similar Posts by Content Area: , , , ,