同事在寫Oracle預存程序時候,是在以前已經寫好的過程基礎上修改的,想換個名字,由於疏忽沒有改名字就編譯了,編譯完才意識到。這時原來的那個已經沒有了。找我想辦法恢複回原來的那個過程。
通過查資料想到個方法,也不知道成不成,只能當做試試。
SELECT * FROM source$
AS OF TIMESTAMP TO_TIMESTAMP('2012-9-6 16:50:32', 'YYYY-MM-DD HH24:MI:SS')
where source like '%sp_copy_project%'
order by line;
只查到一些簡單的資訊,不夠恢複資料的。
上邊的是原來那個,下邊的是剛編譯的。
OBJ# LINE SOURCE
---------- ---------- --------------------------------------------------------------------------------
190762 1 procedure sp_copy_project(old_pro_id number, domain_id number, new_pro_id
190471 1 procedure sp_copy_project(dxid number, rtn out number, msg out varchar2(4000)) i
於是有用下邊這句,查到了需要的資訊。選了一個往前30分鐘的時間點。
select * from dba_source
AS OF TIMESTAMP TO_TIMESTAMP('2012-9-6 16:20:00', 'YYYY-MM-DD HH24:MI:SS')
where name like upper('%sp_copy_project%') and owner ='YWMX'
order by line;
過程是一行一行的,於是把全選將其貼到plsql編輯器裡,
文本被接起來,格式也正好。
在前邊加上 “create or replace ”,重新編譯,
被覆蓋的過程回來了。