zoukankan      html  css  js  c++  java
  • oracle 设置闪回-flashback

    oracle 设置闪回-flashback

    1.查看是否开启闪回:select flashback_on from v$database;
    2.开启闪回: alter database flashback on;
    3.设置闪回路径: alter system set db_recovery_file_dest='/orcl/app/oracle';
    4.设置闪回大小: alter system set db_recovery_file_dest_size='5G';
    5.重启数据库: shutdown immediate;  startup;
    6.oracle归档默认存储在闪回区,查看归档空间大小: show parameter db_recovery
    
    delete删除的数据闪回
    1.查询当前时间: select  to_char(sysdate,'yyyy-mm-dd hh24:mi:ss') from dual;
    2.查询表test某个时间时的数据: select * from test as of timestamp 
    to_timestamp('2021-02-04 18:00:00','yyyy-MM-dd hh24:mi:ss')
    3.开启test表行移动功能:alter table test  enable row movement;
    4.数据闪回并查看效果: flashback table test to timestamp 
    to_timestamp('2021-02-04 18:00:00','yyyy-MM-dd hh24:mi:ss')
    
    数据误删恢复:
    oracle查询某个时间点的数据
    1.SQL语句是查询某一时间点上的表中的所有数据,可用于恢复误删(全部误删)的数据:
     select * from emps as of timestamp to_Date('2015-12-11 14:00:00','yyyy-mm-dd hh24:mi:ss');
    2.恢复误删数据(全部误删)
    insert inot emps  select * from emps as of timestamp 
    to_Date('2015-12-11 14:00:00','yyyy-mm-dd hh24:mi:ss')
    3.恢复部分误删数据(根据主键只插入误删的数据,将表中存在的数据过滤掉):
    insert into emp   (select * from emps  as of timestamp to_Date
    ('2015-12-11 14:00:00','yyyy-mm-dd hh24:mi:ss')  where emp_id not in (select emp_id from emps))
    
  • 相关阅读:
    spinner下拉列表数据的添加
    inflater的简单使用
    json对象和json数组的简单转化
    线程之间的通讯
    根据网页地址获取页面内容
    ExtJS4 嵌套的border layout
    sql server Truncate清空表内数据,并对自增长列重置归零重新计算
    C# 将多个DLL和exe合成一个exe程序
    ExtJS4 border layout 左侧treePanel 中间 panel
    BugFree 3.0.4 一些操作
  • 原文地址:https://www.cnblogs.com/khtt/p/15238645.html
Copyright © 2011-2022 走看看