新来上班,想看看数据库都跑些什么sql.就写了一个匿名包跑了下.
declare
f utl_file.file_type;
buffe varchar2(30000);
offest int := 1;
amount int;
begin
f := utl_file.fopen('TEST', 'aa.sql', 'w', 30000);
for x in (select sql_fulltext, last_load_time
from v$sql
where to_date(last_load_time, 'yyyy-mm-dd/hh24:mi:ss') >
trunc(sysdate)
order by 2) loop
amount := dbms_lob.getlength(x.sql_fulltext);
dbms_lob.read(x.sql_fulltext, amount, offest, buffe);
utl_file.put_line(f, buffe);
end loop;
utl_file.fclose(f);
end;
/
[@more@]来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/21492320/viewspace-1058992/,如需转载,请注明出处,否则将追究法律责任。
转载于:http://blog.itpub.net/21492320/viewspace-1058992/