oracle 11.2.0.1 rman异机恢复 11.2.0.3(windows X64)

问题原因: 误操作,需要时间点恢复。

备份情况:rman 备份,每天一次全备份,并且附带备份当天所有产生的archivelog,无expdp备份

恢复目标: 恢复到9号晚上21点数据

源系统WINDOWS2008R2,数据库版本如下:

SQL> select * from v$version;

BANNER
--------------------------------------------------------------------------------
Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production
PL/SQL Release 11.2.0.1.0 - Production
CORE    11.2.0.1.0      Production
TNS for 64-bit Windows: Version 11.2.0.1.0 - Production
NLSRTL Version 11.2.0.1.0 - Production

 

目标系统: WINDOWS2012 R2 数据库版本如下:

SQL> select * from v$version;

BANNER
--------------------------------------------------------------------------------
Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production
PL/SQL Release 11.2.0.3.0 - Production
CORE    11.2.0.3.0      Production
TNS for 64-bit Windows: Version 11.2.0.3.0 - Production
NLSRTL Version 11.2.0.3.0 - Production

 

恢复步骤:

1:目标系统安装oracle软件,不进行建库操作,略过

2:复制源系统pfile 到 目标系统,路径重新自定义。略过

3:以spfile启动目标数据库到nomount状态。略过

4:目标系统恢复控制文件:

    4.1:目标系统恢复控制文件:

   

RMAN> restore controlfile from 'c:\db\FULL_COMPRESSD_G8TKC9OO_1_1.BAK';

Starting restore at 14-DEC-18
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=127 device type=DISK

channel ORA_DISK_1: restoring control file
channel ORA_DISK_1: restore complete, elapsed time: 00:00:03
output file name=C:\APP\ADMINISTRATOR\ADMIN\ORCL\CONTROL.CTL
Finished restore at 14-DEC-18

 

     4.2:目标系统 rman 注册备份集路径:

RMAN> alter database mount;

database mounted
released channel: ORA_DISK_1

RMAN> catalog start with 'c:\db';

searching for all files that match the pattern c:\db

List of Files Unknown to the Database
=====================================
File Name: C:\db\ARCH_GATKC9TQ_1_1.BAK
File Name: C:\db\ARCH_GBTKC9TR_1_1.BAK
File Name: C:\db\ARCH_GGTKEU9G_1_1.BAK
File Name: C:\db\ARCH_GHTKEU9H_1_1.BAK
File Name: C:\db\FULL_COMPRESSD_G6TKC9ML_1_1.BAK
File Name: C:\db\FULL_COMPRESSD_G7TKC9ML_1_1.BAK
File Name: C:\db\FULL_COMPRESSD_G8TKC9OO_1_1.BAK

Do you really want to catalog the above files (enter YES or NO)? y
cataloging files...
cataloging done

List of Cataloged Files
=======================
File Name: C:\db\ARCH_GATKC9TQ_1_1.BAK
File Name: C:\db\ARCH_GBTKC9TR_1_1.BAK
File Name: C:\db\ARCH_GGTKEU9G_1_1.BAK
File Name: C:\db\ARCH_GHTKEU9H_1_1.BAK
File Name: C:\db\FULL_COMPRESSD_G6TKC9ML_1_1.BAK
File Name: C:\db\FULL_COMPRESSD_G7TKC9ML_1_1.BAK
File Name: C:\db\FULL_COMPRESSD_G8TKC9OO_1_1.BAK

 

 5:目标系统进行数据文件还原:

RMAN> run{
2> set newname for datafile 1 to "C:\app\Administrator\admin\orcl\oradata\system01.dbf";
3> set newname for datafile 2 to "C:\app\Administrator\admin\orcl\oradata\sysaux01.dbf";
4> set newname for datafile 3 to "C:\app\Administrator\admin\orcl\oradata\undotbs01.dbf";
5> set newname for datafile 4 to "C:\app\Administrator\admin\orcl\oradata\users01.dbf";
6> set newname for datafile 5 to "C:\app\Administrator\admin\orcl\oradata\example01.dbf";
7> set newname for datafile 6 to "C:\app\Administrator\admin\orcl\oradata\FLIGHTRADAR.DBF.dbf";
8> restore database;
9> switch datafile all;
10> }

executing command: SET NEWNAME

executing command: SET NEWNAME

executing command: SET NEWNAME

executing command: SET NEWNAME

executing command: SET NEWNAME

executing command: SET NEWNAME

Starting restore at 14-DEC-18
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=65 device type=DISK

channel ORA_DISK_1: starting datafile backup set restore
channel ORA_DISK_1: specifying datafile(s) to restore from backup set
channel ORA_DISK_1: restoring datafile 00001 to C:\app\Administrator\admin\orcl\oradata\system01.dbf
channel ORA_DISK_1: restoring datafile 00002 to C:\app\Administrator\admin\orcl\oradata\sysaux01.dbf
channel ORA_DISK_1: restoring datafile 00003 to C:\app\Administrator\admin\orcl\oradata\undotbs01.dbf
channel ORA_DISK_1: reading from backup piece D:\DBBACKUP\RMAN\FULL_COMPRESSD_G7TKC9ML_1_1.BAK
channel ORA_DISK_1: errors found reading piece handle=D:\DBBACKUP\RMAN\FULL_COMPRESSD_G7TKC9ML_1_1.BAK
channel ORA_DISK_1: failover to piece handle=C:\DB\FULL_COMPRESSD_G7TKC9ML_1_1.BAK tag=TAG20181209T210004
channel ORA_DISK_1: restored backup piece 1
channel ORA_DISK_1: restore complete, elapsed time: 00:01:25
channel ORA_DISK_1: starting datafile backup set restore
channel ORA_DISK_1: specifying datafile(s) to restore from backup set
channel ORA_DISK_1: restoring datafile 00004 to C:\app\Administrator\admin\orcl\oradata\users01.dbf
channel ORA_DISK_1: restoring datafile 00005 to C:\app\Administrator\admin\orcl\oradata\example01.dbf
channel ORA_DISK_1: restoring datafile 00006 to C:\app\Administrator\admin\orcl\oradata\FLIGHTRADAR.DBF.dbf
channel ORA_DISK_1: reading from backup piece C:\DB\FULL_COMPRESSD_G6TKC9ML_1_1.BAK
channel ORA_DISK_1: piece handle=C:\DB\FULL_COMPRESSD_G6TKC9ML_1_1.BAK tag=TAG20181209T210004
channel ORA_DISK_1: restored backup piece 1
channel ORA_DISK_1: restore complete, elapsed time: 00:04:26
Finished restore at 14-DEC-18

datafile 1 switched to datafile copy
input datafile copy RECID=8 STAMP=994847838 file name=C:\APP\ADMINISTRATOR\ADMIN\ORCL\ORADATA\SYSTEM01.DBF
datafile 2 switched to datafile copy
input datafile copy RECID=9 STAMP=994847838 file name=C:\APP\ADMINISTRATOR\ADMIN\ORCL\ORADATA\SYSAUX01.DBF
datafile 3 switched to datafile copy
input datafile copy RECID=10 STAMP=994847838 file name=C:\APP\ADMINISTRATOR\ADMIN\ORCL\ORADATA\UNDOTBS01.DBF
datafile 4 switched to datafile copy
input datafile copy RECID=11 STAMP=994847839 file name=C:\APP\ADMINISTRATOR\ADMIN\ORCL\ORADATA\USERS01.DBF
datafile 5 switched to datafile copy
input datafile copy RECID=12 STAMP=994847839 file name=C:\APP\ADMINISTRATOR\ADMIN\ORCL\ORADATA\EXAMPLE01.DBF
datafile 6 switched to datafile copy
input datafile copy RECID=13 STAMP=994847840 file name=C:\APP\ADMINISTRATOR\ADMIN\ORCL\ORADATA\FLIGHTRADAR.DBF.DBF

6:还原一个归档日志:

RMAN> run{
2> set until sequence 14040 thread 1;
3> recover database;
4> }

executing command: SET until clause

Starting recover at 14-DEC-18
using channel ORA_DISK_1

starting media recovery

channel ORA_DISK_1: starting archived log restore to default destination
channel ORA_DISK_1: restoring archived log
archived log thread=1 sequence=14039
channel ORA_DISK_1: reading from backup piece C:\DB\ARCH_GHTKEU9H_1_1.BAK
channel ORA_DISK_1: piece handle=C:\DB\ARCH_GHTKEU9H_1_1.BAK tag=TAG20181210T210341
channel ORA_DISK_1: restored backup piece 1
channel ORA_DISK_1: restore complete, elapsed time: 00:00:26
archived log file name=C:\APP\ADMINISTRATOR\PRODUCT\11.2.0\DBHOME_1\RDBMS\ARC0000014039_0897388701.0001 thread=1 sequence=14039
media recovery complete, elapsed time: 00:00:03
Finished recover at 14-DEC-18

7:resetlogs打开目标数据库,由于目标数据库版本过高,提示:ORA-00704: 引导程序进程失败
ORA-39700: 必须用 UPGRADE 选项打开数据库

alter database open resetlogs
.........
ORA-39700: 必须用 UPGRADE 选项打开数据库

 

8:重新连接数据库执行升级:

SQL>startup upgrade;
SQL>@C:\app\Administrator\product\11.2.0\dbhome_1\RDBMS\ADMIN\catupgrd.sql   --重建数据字典视图脚本
执行完毕后数据库自动关闭,再次启动数据库
SQL>startup
SQL>@C:\app\Administrator\product\11.2.0\dbhome_1\RDBMS\ADMIN\utlrp.sql     --编译无效对象

 

 

 

              

 

posted @ 2018-12-14 14:38  monkeybron  阅读(1021)  评论(0编辑  收藏  举报