Toad World® Forums

Get SQL_ID for query


#1

I constantly use the Session Browser to monitor various sessions. The Current Statement tab tells me the SQL code being executed by the particular session. However, when bind variables are involved, the tab just shows the bind variable. I have to go to V$SQL_BIND_CAPTURE to get the bind variable’s values. However, to query that view, I need the SQL_ID. Currently, I’m either going to Oracle’s dbconsole/Enterprise Manager to get it or I query the V$SQL view until I find the correct statement. There has to be a way in TOAD to get the SQL_ID if it knows the SQL code.


#2

The only screen I know of in Toad to see SQLID’s is the Database >
Monitor > SGA Trace/Optimization window

Sounds like an awesome enhancement request for the Session Browser window
though. Maybe even for the explain plan tab window as well for the editor…

Jeff


#3

To make the SQL_ID column visible in the session browser, right-click in the
sessions grid, then choose Visible Columns -> SQL ID.

Be aware though, that V$SQL_BIND_CAPTURE is just a sampling of bind variables.
It may not have binds for the statement you are looking for, and if it does have
them, they may not be the binds for the most recent execution of the query, or
for the session that you are looking at in the session browser.

If you go to database -> Monitor -> SGA Trace/Optimization, you can search
through sql statements in the cache, and there is an option that will substitute
in bind variables if possible. This may help you.


#4

DOH! I was looking for it on the current statement tab and the cursor tab, not
the top level Sessions view.