How to query current and historically executed sql based on session
How to query the current and historically executed sql according to the session? aiming at this problem, this article introduces the corresponding analysis and solution in detail, hoping to help more partners who want to solve this problem to find a more simple and feasible method.
Share two scripts, mainly through the Oracle session sid to query the currently executed sql and some historically executed sql.
Sql executed based on sid query history
Select sql_text from v$sqlarea a minute vain session b where a.SQL_ID=b.PREV_SQL_ID and b.SID=&sid
Query the currently executed sql based on sid
Select sql_text from v$sqlarea where (hash_value, address) = (select sql_hash_value, sql_address from v$session where sid = & sid)
This is the answer to the question about how to query the current and historically executed sql according to the session. I hope the above content can be of some help to you. If you still have a lot of doubts to be solved, you can follow the industry information channel for more related knowledge.