时间点恢复

1.查询恢复期间可能丢失的对象

  1. SELECT * FROM SYS.ts_pitr_objects_to_be_dropped WHERE tablespace_name='FIXF';

备份所有对象

2.执行TSPITR

  1. recover tablespace FIXF
  2. until database "to_date('2019-11-25 10:30:00','yyyy-mm-dd hh24:mi:ss')"
  3. auxiliary destination '/opt/oracle/back';

3.修改表空间为联机状态

  1. alter tablespcace FIXF online;

4.恢复失败删除辅助实例

  1. exec dbms_backup_restore.manageauxinstance
  2. ('auxiliary_sid_name',1);

CDB级别的表空间不完全恢复

  1. archive log list;
  2. create tablespace TS_XXT3 datafile '/u04/oradata/CDBLHR/TS_XXT30xx.dbf' size 10M;
  3. create user c##lhrts identified by lhr;
  4. grant dba to c##lhrts;
  5. create table c##lhrts.xxt6 tablespace TS_XXT3 as select * from dual;
  6. run{
  7. backup database;
  8. alter system archive log current;
  9. backup archivelog all;
  10. backup current controlfile;
  11. }
  12. select current_scn from v$database;
  13. alter system switch logfile;
  14. drop table c##lhrts.xxt6;
  15. rman target /
  16. RMAN> RECOVER TABLESPACE TS_XXT3 UNTIL SCN 1756899 AUXILIARY DESTINATION '/u01/app/oracle/oradata';
  17. RMAN> ALTER TABLESPACE TS_XXT3 ONLINE;
  18. select * from c##lhrts.xxt6;

pdb表空间不完全恢复

  1. archive log list;
  2. alter session set container=PDBLHR1;
  3. create tablespace TS_XXT datafile '/u04/oradata/CDBLHR/PDBLHR1/ts_xxt01.dbf' size 10M;
  4. grant dba to lhr;
  5. create table lhr.xxt tablespace ts_xxt as select * from dual;
  6. run{
  7. backup database;
  8. alter system archive log current;
  9. backup archivelog all;
  10. backup current controlfile;
  11. }
  12. select current_scn from v$database;
  13. alter system switch logfile;
  14. alter session set container=PDBLHR1;
  15. drop table lhr.xxt;
  16. rman target /
  17. RMAN> RECOVER TABLESPACE PDBLHR1:TS_XXT UNTIL SCN 832972 AUXILIARY DESTINATION '/u01/app/oracle/oradata';
  18. RMAN> ALTER TABLESPACE PDBLHR1:TS_XXT ONLINE;