文档课题:oracle 11g单表恢复.
数据库:oracle 11.2.0.4 64位
系统:oel 7.9 64位
1、非rman方式
1.1、flashback恢复
[oracle@oel ~]$ export NLS_DATE_FORMAT='yyyy-mm-dd hh24:mi:ss'
[oracle@oel ~]$ export NLS_LANG=AMERICAN
[oracle@oel ~]$ sqlplus / as sysdba
SQL*Plus: Release 11.2.0.4.0 Production on Mon Dec 5 09:55:09 2022
Copyright (c) 1982, 2013, Oracle. All rights reserved.
Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
SQL> conn leo/leo;
Connected.
SQL> create table test as select * from all_objects;
Table created.
SQL> select count(*) from test;
COUNT(*)
----------
84209
SQL> delete from test where rownum<40000;
2000 rows deleted.
SQL> commit;
Commit complete.
SQL> select count(*) from test;
COUNT(*)
----------
0
SQL> conn / as sysdba
Connected.
SQL> select count(*) from leo.test as of timestamp to_timestamp('2022-12-05 10:00:00','yyyy-mm-dd hh24:mi:ss');
COUNT(*)
----------
84209
SQL> flashback table leo.test to timestamp to_timestamp('2022-12-05 10:00:00','yyyy-mm-dd hh24:mi:ss');
flashback table leo.test to timestamp to_timestamp('2022-12-05 10:00:00','yyyy-mm-dd hh24:mi:ss')
*
ERROR at line 1:
ORA-08189: cannot flashback the table because row movement is not enabled
SQL> alter table leo.test enable row movement;
Table altered.
SQL> flashback table leo.test to timestamp to_timestamp('2022-12-05 10:00:00','yyyy-mm-dd hh24:mi:ss');
Flashback complete.
SQL> select count(*) from leo.test;
COUNT(*)
----------
84209
1.2、创建副表
SQL> conn leo/leo;
Connected.
SQL> host date
Mon Dec 5 10:27:50 CST 2022
SQL> delete from test;
84212 rows deleted.
SQL> commit;
Commit complete.
SQL> select count(*) from test;
COUNT(*)
----------
0
SQL> conn / as sysdba
Connected.
SQL> select count(*) from leo.test as of timestamp to_timestamp('2022-12-05 10:27:50','yyyy-mm-dd hh24:mi:ss');
COUNT(*)
----------
84212
SQL> create table leo.testbak as select * from leo.test as of timestamp to_timestamp('2022-12-05 10:27:50','yyyy-mm-dd hh24:mi:ss');
Table created.
SQL> conn leo/leo;
Connected.
SQL> select count(*) from testbak;
COUNT(*)
----------
84212
说明:创建的副表不会有原表存在的主键等约束.
参考网址:https://www.jianshu.com/p/9eb51510b1fc
oracle 11g单表恢复
原创Liujun_Deng 博主文章分类:Oracle ©著作权
文章标签 oracle 单表恢复 flashback table 文章分类 Oracle 数据库
©著作权归作者所有:来自51CTO博客作者Liujun_Deng的原创作品,请联系作者获取转载授权,否则将追究法律责任

提问和评论都可以,用心的回复会被更多人看到
评论
发布评论
相关文章
-
oracle 11g单表恢复
oracle 11g单表恢复
oracle 单表恢复 flashback table -
oracle 11g rman备份恢复—数据文件丢失场景
oracle 11g rman备份恢复—数据文件丢失场景
oracle 11g rman备份恢复