查询分区表信息
SQL> select count(*) from t partition(test_1991);
COUNT(*)
----------
12
1、闪回至还原点
1.1、关闭所有实例,将其中一节点实例启动为mount状态
1.2、开启flashback和force logging
SQL> alter database flashback on;
Database altered.
SQL>alter database force logging;
Database altered.
select flashback_on,force_logging from v$database;
FLASHBACK_ON FOR
------------------ ---
YES YES
1.3、修改闪回归档路径和大小
SQL> alter system set db_recovery_file_dest='/u01/app/flashback' scope=both;
System altered.
SQL> show parameter db_recovery_file_dest
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
db_recovery_file_dest string /u01/app/flashback
db_recovery_file_dest_size big integer 2G
SQL> alter system set db_recovery_file_dest_size =5g scope=both;
System altered.
1.4、查看保留时间
SQL> show parameter flashback
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
db_flashback_retention_target integer 1440
1.5、创建闪回还原点
SQL> create restore point rp guarantee flashback database;
Restore point created.
SQL> select name from v$restore_point;
NAME
--------------------------------------------------------------------------------
RP
1.6、启动数据库
1.7、删除数据
SQL> conn test1/test
alter table t drop partition test_1991;
SQL> select count(*) from t partition(test_1991);
select count(*) from t partition(test_1991)
*
ERROR at line 1:
ORA-02149: Specified partition does not exist
SQL> select count(*) from t partition(test_1992);
COUNT(*)
----------
10
SQL> alter table t drop partition test_1992;
Table altered.
1.7 停两节点 srvctl stop database -d rac10 ,1节点mount状态下
1.8 flashbak
SQL> flashback database to restore point rp;
1.9 以read only模式开库
SQL> alter database open read only;
Database altered.
验证数据
SQL> select count(*) from t partition(test_1992);
COUNT(*)
----------
10
1.10 resetlogs开库
1.11在启动2节点
2、闪回scn
2.1、查看scn
SQL> select current_scn from v$database;
CURRENT_SCN
-----------
1018700
2.2、删除表分区
SQL> alter table t drop partition test_1991;
2.3、将数据库闪回到scn时间点
SQL> flashback database to scn 1018700
2.4、read only模式下验证
2.6、删除还原点,关闭flashback database
drop restore point rp;
alter database flashback off;
alter database no force logging;
select flashback_on,force_logging from v$database;
FLASHBACK_ON FOR
------------------ ---
NO NO