• Flashback Query(函数示例)


    Flashback Query 函数,存储过程,包,触发器等对象
    Flashback Drop 可以闪回与表相关联的对象, 如果是其他的对象,比如function,procedure,trigger等。 这时候,就需要使用到ALL_SOURCE 表来进行Flashback Query。
    ALL_SOURCE describes the text source of the stored objects accessible to the current user.
    Related Views
    DBA_SOURCE describes the text source of all stored objects in the database.
    USER_SOURCE describes the text source of the stored objects owned by the current user. This view does not display the OWNER column.
    基于timestamp恢复的语句
    SQL>SELECT text
    FROM dba_source
    AS OF TIMESTAMP TO_TIMESTAMP ('XXXXX', 'YYYY-MM-DD HH24:MI:SS')
    WHERE owner = 'XXXX' AND name = '你删除的对象名'
    ORDER BY line;
    ==========函数=================
    未例:

    SQL> CREATE OR REPLACE function getdate return date
    2 as
    3 v_date date;
    4 begin
    5 select sysdate into v_date from dual;
    6 return v_date;
    7 end;
    8 /
    
    函数已创建。

    ---------------查询函数---------------------------------------

    SQL> ALTER SESSION SET NLS_DATE_FORMAT='YYYY-MM-DD HH24:MI:SS';
    
    会话已更改。
    
    SQL> select getdate() from dual;
    
    GETDATE()
    -------------------
    2014-10-16 21:52:11

    ------------查询dba_source表-----------------------------------

    SQL> select text from dba_source where name='GETDATE' order by line;
    
    TEXT
    --------------------------------------------------------------------------------
    function getdate return date
    as
    v_date date;
    begin
    select sysdate into v_date from dual;
    return v_date;
    end;
    
    已选择7行。

    -----------------------------drop 函数,在查询,记录不存在----------------------

    SQL> drop function getdate;
    
    函数已删除。
    
    SQL> select text from dba_source where name='GETDATE';
    
    未选定行

    --------------------使用flashback query 查询-------------------------------------

    SQL> select text from dba_source as of timestamp to_timestamp('2014-10-16 21:52:11','yyyy-mm-dd hh24:mi:ss') where name='GETDATE' order by line;
    
    TEXT
    --------------------------------------------------------------------------------
    function getdate return date
    as
    v_date date;
    begin
    select sysdate into v_date from dual;
    return v_date;
    end;
    
    已选择7行。

    重新执行该函数的代码即可恢复getdate函数

    《FROM:http://blog.csdn.net/tianlesoftware/article/details/4677378

  • 相关阅读:
    python imageai 对象检测、对象识别
    flask跨域请求三行代码搞定
    图片压缩-KMeans
    电影天堂
    python 时间操作
    时间HTML
    3D滚动效果
    tensorflow基础
    studio显示Surface: getSlotFromBufferLocked: unknown buffer: 0xa2a58be0
    解决github访问慢和clone慢解决方案
  • 原文地址:https://www.cnblogs.com/rusking/p/4029826.html
Copyright © 2020-2023  润新知