假設你不小心覆蓋了之前的存儲過程,那得趕緊閃回,時長越長閃回的可能性越小。原理非常easy,存儲過程的定義就是數據字典,改動數據字典跟改動普通表的數據沒有差別,此時會把改動前的內容放到undo中,我們能夠依據這一點來進行閃回,所以我說要盡快,要不然找不回來了。以下我們來做一個實驗:
1.在用戶TEST下14:31下建立存儲過程
create or replace procedure GG_TESTas l_cnt number;
begin
for i in 1 .. 10000
loop
execute immediate 'select count(*) from t where x = ' || i into l_cnt;
end loop;
end;
drop procedure GG_TEST;
3.登錄到sys賬戶下
create table p_temp as
select *
from dba_source as of timestamp TO_TIMESTAMP('2014-05-04 14:33:00', 'YYYY-MM-DD HH24:MI:SS')
where TYPE = 'PROCEDURE'
And owner = 'TEST'
And Name = 'GG_TEST';
select text
from p_temp
where name like upper('%GG_TEST%')
and owner = 'TEST'
order by line;
TEXT
---------------------------------------------------------------------------
procedure GG_TEST
as l_cnt number;
begin
for i in 1 .. 10000
loop
execute immediate 'select count(*) from t where x = ' || i into l_cnt;
end loop;
end;