表空间时间点恢复(TSPITR)是从10g开始有的一个功能,它通过rman脚本自动创建辅助实例的方法,再通过传输表空间的方法,实现
基于表空间时间点的自动化恢复.
以下测试:
db:11.2.0.4
os:centos 6.6
#建测试表空间test及表scott.tb01
[oracle@ct6605 ~]$ sqlplus / as sysdba
SQL> create tablespace test datafile '/u02/oradata/ct6604sb/test01.dbf' size 10m;
Tablespace created.
--这里建表记得加表空间,因为scott的默认表空间是users
SQL> create table scott.tb01 tablespace test as select 1 x from dual;
Table created.
SQL> select sequence# from v$log where status='CURRENT';
SEQUENCE#
----------
31
SQL> exit
#做备份用以恢复
[oracle@ct6605 ~]$ rman target /
RMAN> backup database plus archivelog;
RMAN> exit
#删除test表空间中的表scott.tb01
[oracle@ct6605 ~]$ sqlplus / as sysdba
SQL> alter system switch logfile;
SQL> drop table scott.tb01 purge;
Table dropped.
SQL> select sequence# from v$log where status='CURRENT';
SEQUENCE#
----------
34
SQL> exit
#基于时间点的表空间恢复
[oracle@ct6605 ~]$ rman target /
RMAN> recover tablespace "TEST" until logseq 33 thread 1 auxiliary destination '/home/oracle';
#查看看到表scott.tb01已恢复
[oracle@ct6605 ~]$ sqlplus / as sysdba
SQL> select * from scott.tb01;
X
----------
1
备注:
1.11gr2开始支持对 已删除的表空间的 基于时间点的自动恢复.
2.开始恢复之前,要确定要还原到的time或logseq或scn,并查看备份确认.
3.恢复一次之后,再执行恢复一次时,可能会报RMAN-05073错误,因为第一次恢复时新建的数据文件的时间点大于备份时的时间
点.要处理这个问题11gr2可以删掉重新恢复,11gr2之前版本建议手动建辅助实例恢复.
4.执行完 表空间时间点恢复 后,最好尽快对新加的表空间进行备份.
5.使用sys.ts_pitr_check视图在恢复之前确保恢复集的完整性,并且标识可能用到的其他表空间.
6.使用sys.ts_pitr_objects_to_be_dropped查看表空间恢复到某个时间点后将丢失的这个时间点之后的操作,根据需要确定那些
需要先导出来.
7.不能还原包含sys用户特有对象的表空间,不能恢复含有复制主表的表空间,不支持使用快照日志的表空间,不支持含有回滚段的
表空间.不支持含有varray,嵌套表,外部文件的表空间.
基于表空间时间点的自动化恢复.
以下测试:
db:11.2.0.4
os:centos 6.6
#建测试表空间test及表scott.tb01
[oracle@ct6605 ~]$ sqlplus / as sysdba
SQL> create tablespace test datafile '/u02/oradata/ct6604sb/test01.dbf' size 10m;
Tablespace created.
--这里建表记得加表空间,因为scott的默认表空间是users
SQL> create table scott.tb01 tablespace test as select 1 x from dual;
Table created.
SQL> select sequence# from v$log where status='CURRENT';
SEQUENCE#
----------
31
SQL> exit
#做备份用以恢复
[oracle@ct6605 ~]$ rman target /
RMAN> backup database plus archivelog;
RMAN> exit
#删除test表空间中的表scott.tb01
[oracle@ct6605 ~]$ sqlplus / as sysdba
SQL> alter system switch logfile;
SQL> drop table scott.tb01 purge;
Table dropped.
SQL> select sequence# from v$log where status='CURRENT';
SEQUENCE#
----------
34
SQL> exit
#基于时间点的表空间恢复
[oracle@ct6605 ~]$ rman target /
RMAN> recover tablespace "TEST" until logseq 33 thread 1 auxiliary destination '/home/oracle';
#查看看到表scott.tb01已恢复
[oracle@ct6605 ~]$ sqlplus / as sysdba
SQL> select * from scott.tb01;
X
----------
1
备注:
1.11gr2开始支持对 已删除的表空间的 基于时间点的自动恢复.
2.开始恢复之前,要确定要还原到的time或logseq或scn,并查看备份确认.
3.恢复一次之后,再执行恢复一次时,可能会报RMAN-05073错误,因为第一次恢复时新建的数据文件的时间点大于备份时的时间
点.要处理这个问题11gr2可以删掉重新恢复,11gr2之前版本建议手动建辅助实例恢复.
4.执行完 表空间时间点恢复 后,最好尽快对新加的表空间进行备份.
5.使用sys.ts_pitr_check视图在恢复之前确保恢复集的完整性,并且标识可能用到的其他表空间.
6.使用sys.ts_pitr_objects_to_be_dropped查看表空间恢复到某个时间点后将丢失的这个时间点之后的操作,根据需要确定那些
需要先导出来.
7.不能还原包含sys用户特有对象的表空间,不能恢复含有复制主表的表空间,不支持使用快照日志的表空间,不支持含有回滚段的
表空间.不支持含有varray,嵌套表,外部文件的表空间.
来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/28539951/viewspace-1966175/,如需转载,请注明出处,否则将追究法律责任。
转载于:http://blog.itpub.net/28539951/viewspace-1966175/