| Retrieve sql history [message #536996] |
Sun, 25 December 2011 18:28  |
sanrajar
Messages: 13 Registered: April 2005
|
Junior Member |
|
|
select a.logon_time, dbms_lob.substr(b.sql_fulltext, 4000,1)
from gv$session a,gv$sqlarea b
where 1=1
and a.sql_id=b.sql_id
and a.username='H72728'-- my schema name used to login in toad
and a.logon_time between sysdate - 10 and sysdate
order by a.logon_time desc
I have been running few queries in the system and I forgot to save some of those sqls which I ran.
So instead of rewriting all those sqls again - I am hoping to see if sqls run by a user via TOAD is stored anywhere in Oracle.
If so - it might be easy for me to retrieve my sql (hence save lots of time).
The F8 key used in toad to retrieve historic sqls - is not working for me for some reason.
I am not sure if oracle stores any of this information - but if anyone has an idea of retrieving this information - appreciate if you can share the knowledge.
Thanks,
Sanrajar
|
|
|
|
|
|