ORACLE TSPITR 表空间时间点恢复实验

如果自己搞不定可以找诗檀软件专业ORACLE数据库修复团队成员帮您恢复!

诗檀软件专业数据库修复团队

服务热线 : 13764045638    QQ号:47079569    邮箱:[email protected]

 

ORACLE  TSPITR  是 Tablespace Point-in-Time Recovery的简写

在相同的服务器上

  1. 查询数据文件相关信息
SQL> select tablespace_name,file_id,file_name from dba_data_files order by tablespace_name;

 

TABLESPACE_NAME  FID FILE_NAME

————— —- ————————————————–

EXAMPLE            5 /u01/app/oracle/oradata/dbdao01/example01.dbf

SYSAUX                 2 /u01/app/oracle/oradata/dbdao01/sysaux01.dbf

SYSTEM                1 /u01/app/oracle/oradata/dbdao01/system01.dbf

UNDOTBS1          3 /u01/app/oracle/oradata/dbdao01/undotbs01.dbf

USERS                   4 /u01/app/oracle/oradata/dbdao01/users01.dbf

askmac.cn

 

  1. 创建相应的文件夹并恢复控制文件到创建的位置
[oracle@dbdao01 ~]$ mkdir -p /u01/app/oracle/oradata/aux/

[oracle@dbdao01 ~]$ rman target /

RMAN> restore controlfile to ‘/u01/app/oracle/oradata/aux/control01.ctl’;

askmac.cn

 

  1. 编辑参数文件,添加下面内容
db_name=dbdao01

db_unique_name=aux

control_files=’/u01/app/oracle/oradata/aux/control01.ctl’

 

  1. 启动数据库到mount
SQL> startup mount pfile=?/dbs/initaux.ora

ORACLE instance started.

Total System Global Area  238034944 bytes

Fixed Size              2227136 bytes

Variable Size                180356160 bytes

Database Buffers       50331648 bytes

Redo Buffers                 5120000 bytes

Database mounted.

askmac.cn

 

  1. 使用rman恢复
run {

set until  time “to_date(‘20160722 03:27:39′,’YYYYMMDD HH24:MI:SS’)”;

set newname for datafile 1 to ‘/u01/app/oracle/oradata/aux/system01.dbf’;

set newname for datafile 2 to ‘/u01/app/oracle/oradata/aux/sysaux01.dbf’;

set newname for datafile 3 to ‘/u01/app/oracle/oradata/aux/undotbs01.dbf’;

set newname for datafile 4 to ‘/u01/app/oracle/oradata/aux/users01.dbf’;

set newname for datafile 5 to ‘/u01/app/oracle/oradata/aux/example01.dbf’;

restore datafile 1,2,3,4,5;

switch datafile all;

sql “alter database datafile 1,2,3,4,5 online”;

recover database;

sql “alter database rename file ”/u01/app/oracle/oradata/dbdao01/redo01.log” to ”/u01/app/oracle/oradata/aux/redo01.log””;

sql “alter database rename file ”/u01/app/oracle/oradata/dbdao01/redo02.log” to ”/u01/app/oracle/oradata/aux/redo02.log””;

sql “alter database rename file ”/u01/app/oracle/oradata/dbdao01/redo03.log” to ”/u01/app/oracle/oradata/aux/redo03.log””;

alter database open resetlogs;

}

 

 

 

在不同服务器上

  1. 上传备份集到另一个服务器上
  2. 编辑参数文件
db_name=dbdao01

control_files=/u01/app/oracle/oradata/dbdao01/control01.ctl

  1. 启动数据库到nomount
SQL> startup nomount pfile=?/dbs/initdbdao01.ora

ORACLE instance started.

 

Total System Global Area  238034944 bytes

Fixed Size              2227136 bytes

Variable Size                180356160 bytes

Database Buffers       50331648 bytes

Redo Buffers                 5120000 bytes

  1. 恢复控制文件
RMAN> restore controlfile from ‘/u01/app/oracle/fast_recovery_area/DBDAO01/autobackup/2016_07_22/o1_mf_s_917839555_cs28g43r_.bkp’;
  1. 启动到mount并进行恢复
run{

2> set until  time “to_date(‘20160722 03:27:39′,’YYYYMMDD HH24:MI:SS’)”;

3> recover database;

4>alter database open resetlogs

4> }

 

 


Posted

in

by

Tags:

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *