Unanswered: v$sql AND v$session info for Inactive sessions
V$sql gives us the statistics for the SQL executed , we can join V$session and
v$sql , which will give sqls
which are being currently executing along with their session values. Once they are done(means their status comes
to inactive), sql_address in v$session will be '00' so if will be difficult to get the session info(who executed that sql) .
Is there any way by which i can track a SQL (say a truncate command) back to its Session info even after the user has logged out and that session has been terminated.
You cant get info on the session after the session has been terminated as their is no record of the session in v$session. What you can do though is to log ddl using a ddl trigger and get then session info at the time of the ddl. I use this on our production databases so that we have a record of who did what ddl (we also log all database errors using an error trigger). However if you cant use this method for DML (i.e. who is changing what data).