一些sql是可以在redo日志里面查到的
创建个存储过程,记录下sql
orahldev@misdev14:/home/orahldev>sqlplus apps/apps
SQL*Plus: Release 9.2.0.6.0 - Production on Fri Apr 29 15:03:32 2011
Copyright (c) 1982, 2002, Oracle Corporation. All rights reserved.
Connected to:
Oracle9i Enterprise Edition Release 9.2.0.6.0 - 64bit Production
With the Partitioning, OLAP and Oracle Data Mining options
JServer Release 9.2.0.6.0 - Production
SQL> create or replace procedure readlog
2 is
3 begin
4 dbms_output.put_line('readlog');
5 end;
6 /
2 is
3 begin
4 dbms_output.put_line('readlog');
5 end;
6 /
Procedure created.
SQL> set serverout on
SQL> exec readlog;
readlog
SQL> exec readlog;
readlog
PL/SQL procedure successfully completed.
查看当前的日志组
SQL> set linesize 1000
SQL> select * from v$log;
SQL> select * from v$log;
GROUP# THREAD# SEQUENCE# BYTES MEMBERS ARC STATUS FIRST_CHANGE# FIRST_TIM
---------- ---------- ---------- ---------- ---------- --- ---------------- ------------- ---------
6 1 47 209715200 2 NO CURRENT 3.5936E+10 29-APR-11
7 1 45 209715200 2 NO INACTIVE 3.5935E+10 29-APR-11
8 1 46 209715200 2 NO ACTIVE 3.5935E+10 29-APR-11
---------- ---------- ---------- ---------- ---------- --- ---------------- ------------- ---------
6 1 47 209715200 2 NO CURRENT 3.5936E+10 29-APR-11
7 1 45 209715200 2 NO INACTIVE 3.5935E+10 29-APR-11
8 1 46 209715200 2 NO ACTIVE 3.5935E+10 29-APR-11
从该日志组里读取执行sql
orahldev@misdev14:/datavg30/hldev/data/hldevdata>strings log06a.log|sed -n '/create or replace procedure readlog/,/end;/p'
create or replace procedure readlog
begin
dbms_output.put_line('readlog');
end;
create or replace procedure readlog
begin
dbms_output.put_line('readlog');
end;
可以看出,刚执行的sql是可以读到的,如果sql执行的时间长了,那就从archivelog里去读取吧。但如果想读到更复杂的sql,那就要很好的去利用unix的字符匹配命令了。
来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/13561774/viewspace-694117/,如需转载,请注明出处,否则将追究法律责任。
转载于:http://blog.itpub.net/13561774/viewspace-694117/