oracle数据恢复
2015-09-16 11:07
507 查看
delete 回滚
--利用oracle 回闪机制,恢复对应表的delete操作
select * from mm_rightfee_rec_head
as of timestamp to_timestamp ('2015-02-02 11:00:00','YYYY-MM-DD HH:MI:SS') where marketid = 30 and feeyear=2015
and ffeeno='NLRF1501290002';
select * from mm_rightfee_rec_line
as of timestamp to_timestamp ('2015-02-02 11:00:00','YYYY-MM-DD HH:MI:SS') where
rfeeid=150;
oracle恢复删除的数据
分为两种方法:scn和时间戳两种方法恢复。
一、通过scn恢复删除且已提交的数据
1、获得当前数据库的scn号
select current_scn from v$database; (切换到sys用户或system用户查询)
查询到的scn号为:1499223
2、查询当前scn号之前的scn
select * from 表名 as of scn 1499220; (确定删除的数据是否存在,如果存在,则恢复数据;如果不是,则继续缩小scn号)
3、恢复删除且已提交的数据
flashback table 表名 to scn 1499220;
二、通过时间恢复删除且已提交的数据
1、查询当前系统时间
select to_char(sysdate,'yyyy-mm-dd hh24:mi:ss') from dual;
2、查询删除数据的时间点的数据
select * from 表名 as of timestamp to_timestamp('2013-05-29 15:29:00','yyyy-mm-dd hh24:mi:ss'); (如果不是,则继续缩小范围)
3、恢复删除且已提交的数据
flashback table 表名 to timestamp to_timestamp('2013-05-29 15:29:00','yyyy-mm-dd hh24:mi:ss');
注意:如果在执行上面的语句,出现错误。可以尝试执行 alter table 表名 enable row movement; //允许更改时间戳
--利用oracle 回闪机制,恢复对应表的delete操作
select * from mm_rightfee_rec_head
as of timestamp to_timestamp ('2015-02-02 11:00:00','YYYY-MM-DD HH:MI:SS') where marketid = 30 and feeyear=2015
and ffeeno='NLRF1501290002';
select * from mm_rightfee_rec_line
as of timestamp to_timestamp ('2015-02-02 11:00:00','YYYY-MM-DD HH:MI:SS') where
rfeeid=150;
oracle恢复删除的数据
分为两种方法:scn和时间戳两种方法恢复。
一、通过scn恢复删除且已提交的数据
1、获得当前数据库的scn号
select current_scn from v$database; (切换到sys用户或system用户查询)
查询到的scn号为:1499223
2、查询当前scn号之前的scn
select * from 表名 as of scn 1499220; (确定删除的数据是否存在,如果存在,则恢复数据;如果不是,则继续缩小scn号)
3、恢复删除且已提交的数据
flashback table 表名 to scn 1499220;
二、通过时间恢复删除且已提交的数据
1、查询当前系统时间
select to_char(sysdate,'yyyy-mm-dd hh24:mi:ss') from dual;
2、查询删除数据的时间点的数据
select * from 表名 as of timestamp to_timestamp('2013-05-29 15:29:00','yyyy-mm-dd hh24:mi:ss'); (如果不是,则继续缩小范围)
3、恢复删除且已提交的数据
flashback table 表名 to timestamp to_timestamp('2013-05-29 15:29:00','yyyy-mm-dd hh24:mi:ss');
注意:如果在执行上面的语句,出现错误。可以尝试执行 alter table 表名 enable row movement; //允许更改时间戳
相关文章推荐
- oracle中视图V$PGA_TARGET_ADVICE的用法
- Maven 3 + Hibernate 3.6 + Oracle 11g Example (Annotation)
- oracle中视图v$sql的用途
- oracle安全管理
- How to add Oracle JDBC driver in your Maven local repository
- 不安装oracle客户端,用plsql连接oracle
- oracle笔记
- oracle用户密码过期的处理方法
- oracle触发器
- 在Windows下安装Oracle 11g的XE(Express版)
- Maven 3 + Hibernate 3.6 + Oracle 11g Example (XML Mapping)
- Oracle监听启动失败问题
- oracle_PLSQL 快捷键使用技巧
- VS2010+ASP.NET MVC4+EF4+JqueryEasyUI+Oracle项目开发(转载)
- 使用Goldengate 实现Oracle for Oracle 单向数据同步
- 关于win7系统的Oracle安装时的[INS-30131]问题的解决方案
- oracle中distinct的用法详解
- MYSQL、SQL Server、Oracle数据库排序空值null问题及其解决办法
- Oracle中PL/SQL的执行部分和各种流程控制
- Oracle SQL语句记录