Display SQLID for a statement, no need to use Dynamic Views …
Posted by FatDBA on March 22, 2021
Hi Guys,
I have been busy lately, so couldn’t write much, but I have few things which I will be soon sharing in the form of blog posts, so stay tuned! Alright, so this one is about one of the feature which was though introduced in Oracle 18c, but I first tried it on 19c while doing a recent migration (few stories from that episode too!) – This is to display the SQLID for the currently executed SQL/PLSQL’s.
It’s pretty simple and a really cool feature, so, now you need not to query V$SQL, V$SQLAREA or even V$SESSION to get the SQLID of the last SQL. You only need to set the ‘SET FEEDBACK ON SQL_ID‘ and it’s done, it will first execute your statement and will display the SQLID at the end.
Let me show how to get that, I am doing this test on Oracle 19.3.0.0.0.
SQL>
SQL> SET FEEDBACK ON SQL_ID
SQL>
SQL> select name, open_mode, DBID, database_role from v$database;
NAME OPEN_MODE DBID DATABASE_ROLE
--------- -------------------- ---------- ----------------
DIXITDB READ WRITE 805967680 PRIMARY
1 row selected.
SQL_ID: buv1x6g781ug2
SQL>
Hope It Helped!
Prashant Dixit
Leave a Reply