v$sql_plan + V$open_cursor.
q1) My requirement is, i want sql_id from v$session view to query execution plan using dbms_xplan. i tried getting sql_id of running sql from v$open_cursor but it showing so many sql_id s for one sid. so how can we check from v$open_cursor that which sql_id is belongs to currently running sid which i have seen in v$session view?
q2) is there a script if i give it a sid or ospid then it gives us exicution_plan of the currently running query + diffrent waits it has gone through using v$active_session_history view?