How Does oracle restore a covered stored procedure?

Source: Internet
Author: User

If you accidentally overwrite the previous stored procedure, You have to flash back quickly. The longer the duration, the less likely it will be to flash back. The principle is very simple. The definition of a stored procedure is a data dictionary. modifying a data dictionary is no different from modifying the data in a common table. In this case, the pre-modification content will be placed in undo, we can flash back based on this point, so we should try to do it as soon as possible, or we will not be able to find it. Here is an experiment:

1. Create a stored procedure at under user TEST
Copy codeThe Code is as follows:
Create or replace procedure GG_TEST
As l_cnt number;
Begin
For I in 10000
Loop
Execute immediate 'select count (*) from t where x = '| I into l_cnt;
End loop;

End;

2. Delete the stored procedure under user TEST
Copy codeThe Code is as follows:
Drop procedure GG_TEST;

3. log on to the sys account
Copy codeThe Code is as follows:
Create table p_temp
Select *
From dba_source as of timestamp TO_TIMESTAMP ('2017-05-04 14:33:00 ', 'yyyy-MM-DD HH24: MI: ss ')
Where TYPE = 'processed'
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 10000
Loop
Execute immediate 'select count (*) from t where x = '| I into l_cnt;
End loop;
End;

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.