zoukankan      html  css  js  c++  java
  • oracle恢复被覆盖的存储过程

        假设你不小心覆盖了之前的存储过程,那得赶紧闪回,时长越长闪回的可能性越小。原理非常easy,存储过程的定义就是数据字典,改动数据字典跟改动普通表的数据没有差别,此时会把改动前的内容放到undo中,我们能够依据这一点来进行闪回,所以我说要尽快,要不然找不回来了。以下我们来做一个实验:

    1.在用户TEST下14:31下建立存储过程

    create or replace 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;


    2.在用户TEST下在14:33下删除存储过程
    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;

  • 相关阅读:
    Markdown 语法说明 (简体中文版)
    Markdown Reference
    BZOJ 2229 最小割
    BZOJ 3569 DZY Loves Chinese II
    BZOJ 3563 DZY Loves Chinese
    BZOJ 2956 模积和
    BZOJ 2957 楼房重建
    查漏补缺:面向对象设计原则
    添砖加瓦:设计模式(简单工厂模式)
    添砖加瓦:设计模式(总述)
  • 原文地址:https://www.cnblogs.com/yxwkf/p/3858545.html
Copyright © 2011-2022 走看看