ITPub博客

首页 > 数据库 > Oracle > 【RAC】将单实例备份集恢复为rac数据库

【RAC】将单实例备份集恢复为rac数据库

原创 Oracle 作者:lhrbest 时间:2015-06-02 15:18:41 0 删除 编辑

RAC】将单实例备份集恢复为rac数据库

一.1  BLOG文档结构图

 

wpsE532.tmp

 

一.2  前言部分

 

一.2.1  导读

各位技术爱好者,看完本文后,你可以掌握如下的技能,也可以学到一些其它你所不知道的知识,~O(∩_∩)O~:

单实例环境的备份集如何恢复到rac环境(重点)

rman恢复数据库的一般步骤

rac环境的简单操作

 

注意:本篇BLOG中代码部分需要特别关注的地方我都用黄色背景和红色字体来表示,比如下边的例子中,thread 1的最大归档日志号为33thread 2的最大归档日志号为43是需要特别关注的地方。

  List of Archived Logs in backup set 11

  Thrd Seq     Low SCN    Low Time            Next SCN   Next Time

  ---- ------- ---------- ------------------- ---------- ---------

  1    32      1621589    2015-05-29 11:09:52 1625242    2015-05-29 11:15:48

  1    33      1625242    2015-05-29 11:15:48 1625293    2015-05-29 11:15:58

  2    42      1613951    2015-05-29 10:41:18 1625245    2015-05-29 11:15:49

  2    43      1625245    2015-05-29 11:15:49 1625253    2015-05-29 11:15:53

 

 

 

 

本文如有错误或不完善的地方请大家多多指正,ITPUB留言或QQ皆可,您的批评指正是我写作的最大动力。

 

一.2.2  实验环境介绍

 

源库:11.2.0.1   RHEL6.5 单实例

目标库:11.2.0.1  RHEL6.5  rac环境

 

 

一.2.3  相关参考文章链接

 

RAC】将RAC备份集恢复为单实例数据库  http://blog.itpub.net/26736162/viewspace-1682255/

RAC】将单实例备份集恢复为rac数据库 http://blog.itpub.net/26736162/viewspace-1682250/ 

RACrac环境下的数据库备份与还原 http://blog.itpub.net/26736162/viewspace-1682237/



rac安装系列:

【推荐】 一步一步搭建11gR2 rac+dg之结尾篇(十) 

http://blog.itpub.net/26736162/viewspace-1328156/ 

【推荐】 一步一步搭建11gR2 rac+dg之DG SWITCHOVER功能(九) 

http://blog.itpub.net/26736162/viewspace-1328050/ 

一步一步搭建11gR2 rac+dg之配置单实例的DG(八) 

http://blog.itpub.net/26736162/viewspace-1298735/ 

一步一步搭建11gR2 rac+dg之DG 机器配置(七) 

http://blog.itpub.net/26736162/viewspace-1298733/ 

一步一步搭建11gR2 rac+dg之安装rac出现问题解决(六) 

http://blog.itpub.net/26736162/viewspace-1297128/ 

一步一步搭建oracle 11gR2 rac+dg之database安装(五) 

http://blog.itpub.net/26736162/viewspace-1297113/ 

一步一步搭建 oracle 11gR2 rac+dg之grid安装(四) 

http://blog.itpub.net/26736162/viewspace-1297101/ 

【推荐】 一步一步搭建oracle 11gR2 rac+dg之共享磁盘设置(三) 

http://blog.itpub.net/26736162/viewspace-1291144/ 

【推荐】 一步一步搭建oracle 11gR2 rac+dg之环境准备(二) 

http://blog.itpub.net/26736162/viewspace-1290416/ 

【推荐】 一步一步搭建 oracle 11gR2 rac + dg 之前传 (一) 

http://blog.itpub.net/26736162/viewspace-1290405/ 

 

 

一.2.4  本文简介

 

 

本文基于如何将单实例的数据库备份恢复到rac环境下,至于rac环境的备份集如何恢复到单实例及rac环境的备份集恢复到rac环境的实验请参考相关文章链接部分。

 

实验的一些数据库环境参考如下表格:

项目

source db

target  db

db 类型

单实例

rac环境

db version

11.2.0.1

11.2.0.1

ORACLE_SID

orastrac

orastrac1 orastrac2

db_name

orastrac

orastrac

主机IP地址:

 

192.168.59.129

192.168.1.31

192.168.1.32

 

 

 

先描述下大致步骤:

? 源端创建备份集;

? 目标端安装数据库软件和集群件,并配置好共享存储(安装rac的时候一般已经配置好了

? 复制源端备份集到目标端;

? 目录端任意节点执行正常恢复,恢复时注意要将 spfile,controlfile,datafile,redofile 等路径改到共享存储上,恢复完后这会儿仍然是个单实例数据库;

? 修改初始化参数、增加 UNDO 表空间、增加 REDOLOG 线程组,重建密钥文件,目标端任意节点执行;

? 目标端各个节点配置监听及网络服务名;

? 将新建的数据库配置到 crs,目标端任意节点执行即可。

 

一.3  实验部分

 

一.3.1  实验目标

 

将单实例的备份集成功的恢复到rac环境下,并添加数据库到crs环境。

一.3.2  源库操作

 

source库上需要做的操作主要是备份和创建测试用户。

 

一.3.2.1  静默创建一个单实例的测试库

 

首先修改归档模式,这样创建的数据库默认为归档模式,然后我们在源库上静默创建一个单实例的库,sidorastrac,为oracle single instance to rac,关于静默安装数据库参考:

静默安装系列 

 

【推荐】 【DBCA -SILENT】静默方式安装11gR2 oracle数据库软件 

http://blog.itpub.net/26736162/viewspace-1589769/ 

【推荐】 【DBCA -SILENT】静默安装之rac数据库安装 

http://blog.itpub.net/26736162/viewspace-1586352/ 

【推荐】 【DBCA -SILENT】静默安装如何启用归档模式 

http://blog.itpub.net/26736162/viewspace-1585925/ 

【推荐】  DBCA静默方式建库 

http://blog.itpub.net/26736162/viewspace-1448220/ 

 

[oracle@orcltest ~]$ echo $ORACLE_HOME

/u01/app/oracle/product/11.2.0/dbhome_1

[oracle@orcltest ~]$ sqlplus -v

 

SQL*Plus: Release 11.2.0.1.0 Production

 

[oracle@orcltest ~]$ strings $ORACLE_HOME/assistants/dbca/templates/General_Purpose.dbc | grep -i arch

         false

[oracle@orcltest ~]$ vi $ORACLE_HOME/assistants/dbca/templates/General_Purpose.dbc

  

     

     

     

     

     

        

     

     

        

     

     

     

        

     

     

        

     

     

     

     

  

  

  

  

     

        

        

        

        

        

        

        

        

        

        

        

        

        

        

        

     

     

         MULTIPURPOSE

         20

         40

         false

         true

         {ORACLE_BASE}/admin/{DB_UNIQUE_NAME}/pfile/init.ora

     

      {ORACLE_HOME}/dbs/spfile{SID}.ora

  

  

     

"/u01/app/oracle/product/11.2.0/dbhome_1/assistants/dbca/templates/General_Purpose.dbc" 95L, 4985C written                                                                                     

[oracle@orcltest ~]$ strings $ORACLE_HOME/assistants/dbca/templates/General_Purpose.dbc | grep -i arch

         true

[oracle@orcltest ~]$ dbca -silent -createDatabase -templateName General_Purpose.dbc -gdbname orastrac -sid orastrac -sysPassword lhr -systemPassword lhr -responseFile NO_VALUE -datafileDestination /u01/app/oracle/oradata -redoLogFileSize 50 -recoveryAreaDestination /u01/app/oracle/flash_recovery_area -storageType FS -characterSet ZHS16GBK -nationalCharacterSet AL16UTF16 -sampleSchema true -memoryPercentage 30 -totalMemory 200 -databaseType OLTP -emConfiguration NONE  -automaticMemoryManagement true

Copying database files

1% complete

3% complete

10% complete

17% complete

24% complete

35% complete

Creating and starting Oracle instance

37% complete

42% complete

47% complete

52% complete

53% complete

56% complete

58% complete

Registering database with Oracle Restart

64% complete

Completing Database Creation

68% complete

71% complete

75% complete

85% complete

86% complete

96% complete

100% complete

Look at the log file "/u01/app/oracle/cfgtoollogs/dbca/orastrac/orastrac.log" for further details.

[oracle@orcltest ~]$

[oracle@orcltest ~]$ ORACLE_SID=orastrac

[oracle@orcltest ~]$ sqlplus / as sysdba

 

SQL*Plus: Release 11.2.0.1.0 Production on Mon Jun 1 11:09:02 2015

 

Copyright (c) 1982, 2009, Oracle.  All rights reserved.

 

 

Connected to:

Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production

With the Partitioning, OLAP, Data Mining and Real Application Testing options

 

SQL> show parameter name

 

NAME                                 TYPE        VALUE

------------------------------------ ----------- ------------------------------

db_file_name_convert                 string

db_name                              string      orastrac

db_unique_name                       string      orastrac

global_names                         boolean     FALSE

instance_name                        string      orastrac

lock_name_space                      string

log_file_name_convert                string

service_names                        string      orastrac

SQL> create user lhr identified by lhr;

 

User created.

 

SQL> grant dba to lhr;

 

Grant succeeded.

 

SQL> create table lhr.test_rac as select * from dba_objects;

 

Table created.

 

SQL> select count(1) FROM LHR.TEST_RAC;

 

  COUNT(1)

----------

     72468

 

SQL>

SQL> archive log list;

Database log mode              Archive Mode

Automatic archival             Enabled

Archive destination            USE_DB_RECOVERY_FILE_DEST

Oldest online log sequence     3

Next log sequence to archive   5

Current log sequence           5

SQL>

 

SQL> show parameter spfile

 

NAME                                 TYPE        VALUE

------------------------------------ ----------- ------------------------------

spfile                               string      /u01/app/oracle/product/11.2.0

                                                 /dbhome_1/dbs/spfileorastrac.o

                                                 ra

SQL>

 

 

一.3.2.2  source库执行备份操作

 

 

备份脚本如下,注意控制文件需要最后备份:

run

{

allocate channel c1 type disk;

allocate channel c2 type disk;

backup database format  '/home/oracle/rman_back/full_%n_%T_%t_%s_%p.bak';

sql 'alter system archive log current';

backup archivelog all format '/home/oracle/rman_back/arch_%d_%T_%s_%p.bak' delete input;

backup current controlfile format '/home/oracle/rman_back/ctl_%d_%T_%s_%p.bak';

release channel c1;

release channel c2;

}

 

 

执行过程如下:

[oracle@orcltest ~]$ rman target /

 

Recovery Manager: Release 11.2.0.1.0 - Production on Mon Jun 1 11:12:15 2015

 

Copyright (c) 1982, 2009, Oracle and/or its affiliates.  All rights reserved.

 

connected to target database: ORASTRAC (DBID=1317814272)

 

RMAN> run

2> {

3>  allocate channel c1 type disk;

4>  allocate channel c2 type disk;

5>  backup database format  '/home/oracle/rman_back/full_%n_%T_%t_%s_%p.bak';

6>  sql 'alter system archive log current';

7>  backup archivelog all format '/home/oracle/rman_back/arch_%d_%T_%s_%p.bak' delete input;

8>  backup current controlfile format '/home/oracle/rman_back/ctl_%d_%T_%s_%p.bak';

9>  release channel c1;

10>  release channel c2;

11> }

 

using target database control file instead of recovery catalog

allocated channel: c1

channel c1: SID=142 device type=DISK

 

allocated channel: c2

channel c2: SID=20 device type=DISK

 

Starting backup at 2015-06-01 11:12:28

channel c1: starting full datafile backup set

channel c1: specifying datafile(s) in backup set

input datafile file number=00001 name=/u01/app/oracle/oradata/orastrac/system01.dbf

input datafile file number=00004 name=/u01/app/oracle/oradata/orastrac/users01.dbf

channel c1: starting piece 1 at 2015-06-01 11:12:29

channel c2: starting full datafile backup set

channel c2: specifying datafile(s) in backup set

input datafile file number=00002 name=/u01/app/oracle/oradata/orastrac/sysaux01.dbf

input datafile file number=00005 name=/u01/app/oracle/oradata/orastrac/example01.dbf

input datafile file number=00003 name=/u01/app/oracle/oradata/orastrac/undotbs01.dbf

channel c2: starting piece 1 at 2015-06-01 11:12:29

channel c2: finished piece 1 at 2015-06-01 11:15:26

piece handle=/home/oracle/rman_back/full_ORASTRAC_20150601_881233949_2_1.bak tag=TAG20150601T111228 comment=NONE

channel c2: backup set complete, elapsed time: 00:02:59

channel c2: starting full datafile backup set

channel c2: specifying datafile(s) in backup set

including current control file in backup set

channel c2: starting piece 1 at 2015-06-01 11:15:48

channel c2: finished piece 1 at 2015-06-01 11:15:49

piece handle=/home/oracle/rman_back/full_ORASTRAC_20150601_881234138_3_1.bak tag=TAG20150601T111228 comment=NONE

channel c2: backup set complete, elapsed time: 00:00:01

channel c2: starting full datafile backup set

channel c2: specifying datafile(s) in backup set

including current SPFILE in backup set

channel c2: starting piece 1 at 2015-06-01 11:15:50

channel c2: finished piece 1 at 2015-06-01 11:15:51

piece handle=/home/oracle/rman_back/full_ORASTRAC_20150601_881234150_4_1.bak tag=TAG20150601T111228 comment=NONE

channel c2: backup set complete, elapsed time: 00:00:01

channel c1: finished piece 1 at 2015-06-01 11:15:53

piece handle=/home/oracle/rman_back/full_ORASTRAC_20150601_881233948_1_1.bak tag=TAG20150601T111228 comment=NONE

channel c1: backup set complete, elapsed time: 00:03:24

Finished backup at 2015-06-01 11:15:53

 

sql statement: alter system archive log current

 

Starting backup at 2015-06-01 11:16:05

current log archived

channel c1: starting archived log backup set

channel c1: specifying archived log(s) in backup set

input archived log thread=1 sequence=5 RECID=1 STAMP=881234164

channel c1: starting piece 1 at 2015-06-01 11:16:05

channel c2: starting archived log backup set

channel c2: specifying archived log(s) in backup set

input archived log thread=1 sequence=6 RECID=2 STAMP=881234165

channel c2: starting piece 1 at 2015-06-01 11:16:06

channel c1: finished piece 1 at 2015-06-01 11:16:09

piece handle=/home/oracle/rman_back/arch_ORASTRAC_20150601_5_1.bak tag=TAG20150601T111605 comment=NONE

channel c1: backup set complete, elapsed time: 00:00:04

channel c1: deleting archived log(s)

archived log file name=/u01/app/oracle/flash_recovery_area/ORASTRAC/archivelog/2015_06_01/o1_mf_1_5_bpqmmhbp_.arc RECID=1 STAMP=881234164

channel c2: finished piece 1 at 2015-06-01 11:16:10

piece handle=/home/oracle/rman_back/arch_ORASTRAC_20150601_6_1.bak tag=TAG20150601T111605 comment=NONE

channel c2: backup set complete, elapsed time: 00:00:04

channel c2: deleting archived log(s)

archived log file name=/u01/app/oracle/flash_recovery_area/ORASTRAC/archivelog/2015_06_01/o1_mf_1_6_bpqmmo4t_.arc RECID=2 STAMP=881234165

Finished backup at 2015-06-01 11:16:10

 

Starting backup at 2015-06-01 11:16:10

channel c1: starting full datafile backup set

channel c1: specifying datafile(s) in backup set

including current control file in backup set

channel c1: starting piece 1 at 2015-06-01 11:16:11

channel c1: finished piece 1 at 2015-06-01 11:16:12

piece handle=/home/oracle/rman_back/ctl_ORASTRAC_20150601_7_1.bak tag=TAG20150601T111610 comment=NONE

channel c1: backup set complete, elapsed time: 00:00:01

Finished backup at 2015-06-01 11:16:12

 

released channel: c1

 

released channel: c2

 

RMAN> list backupset;

 

 

List of Backup Sets

===================

 

 

BS Key  Type LV Size       Device Type Elapsed Time Completion Time   

------- ---- -- ---------- ----------- ------------ -------------------

1       Full    501.84M    DISK        00:02:42     2015-06-01 11:15:11

        BP Key: 1   Status: AVAILABLE  Compressed: NO  Tag: TAG20150601T111228

        Piece Name: /home/oracle/rman_back/full_ORASTRAC_20150601_881233949_2_1.bak

  List of Datafiles in backup set 1

  File LV Type Ckp SCN    Ckp Time            Name

  ---- -- ---- ---------- ------------------- ----

  2       Full 1027268    2015-06-01 11:12:29 /u01/app/oracle/oradata/orastrac/sysaux01.dbf

  3       Full 1027268    2015-06-01 11:12:29 /u01/app/oracle/oradata/orastrac/undotbs01.dbf

  5       Full 1027268    2015-06-01 11:12:29 /u01/app/oracle/oradata/orastrac/example01.dbf

 

BS Key  Type LV Size       Device Type Elapsed Time Completion Time   

------- ---- -- ---------- ----------- ------------ -------------------

2       Full    9.33M      DISK        00:00:10     2015-06-01 11:15:48

        BP Key: 2   Status: AVAILABLE  Compressed: NO  Tag: TAG20150601T111228

        Piece Name: /home/oracle/rman_back/full_ORASTRAC_20150601_881234138_3_1.bak

  Control File Included: Ckp SCN: 1027334      Ckp time: 2015-06-01 11:15:38

 

BS Key  Type LV Size       Device Type Elapsed Time Completion Time   

------- ---- -- ---------- ----------- ------------ -------------------

3       Full    80.00K     DISK        00:00:00     2015-06-01 11:15:50

        BP Key: 3   Status: AVAILABLE  Compressed: NO  Tag: TAG20150601T111228

        Piece Name: /home/oracle/rman_back/full_ORASTRAC_20150601_881234150_4_1.bak

  SPFILE Included: Modification time: 2015-06-01 11:12:28

  SPFILE db_unique_name: ORASTRAC

 

BS Key  Type LV Size       Device Type Elapsed Time Completion Time   

------- ---- -- ---------- ----------- ------------ -------------------

4       Full    599.97M    DISK        00:03:24     2015-06-01 11:15:52

        BP Key: 4   Status: AVAILABLE  Compressed: NO  Tag: TAG20150601T111228

        Piece Name: /home/oracle/rman_back/full_ORASTRAC_20150601_881233948_1_1.bak

  List of Datafiles in backup set 4

  File LV Type Ckp SCN    Ckp Time            Name

  ---- -- ---- ---------- ------------------- ----

  1       Full 1027267    2015-06-01 11:12:29 /u01/app/oracle/oradata/orastrac/system01.dbf

  4       Full 1027267    2015-06-01 11:12:29 /u01/app/oracle/oradata/orastrac/users01.dbf

 

BS Key  Size       Device Type Elapsed Time Completion Time   

------- ---------- ----------- ------------ -------------------

5       41.16M     DISK        00:00:02     2015-06-01 11:16:07

        BP Key: 5   Status: AVAILABLE  Compressed: NO  Tag: TAG20150601T111605

        Piece Name: /home/oracle/rman_back/arch_ORASTRAC_20150601_5_1.bak

 

  List of Archived Logs in backup set 5

  Thrd Seq     Low SCN    Low Time            Next SCN   Next Time

  ---- ------- ---------- ------------------- ---------- ---------

  1    5       1012317    2015-06-01 11:04:50 1027356    2015-06-01 11:15:59

 

BS Key  Size       Device Type Elapsed Time Completion Time   

------- ---------- ----------- ------------ -------------------

6       2.00K      DISK        00:00:02     2015-06-01 11:16:07

        BP Key: 6   Status: AVAILABLE  Compressed: NO  Tag: TAG20150601T111605

        Piece Name: /home/oracle/rman_back/arch_ORASTRAC_20150601_6_1.bak

 

  List of Archived Logs in backup set 6

  Thrd Seq     Low SCN    Low Time            Next SCN   Next Time

  ---- ------- ---------- ------------------- ---------- ---------

  1    6       1027356    2015-06-01 11:15:59 1027365    2015-06-01 11:16:05

 

BS Key  Type LV Size       Device Type Elapsed Time Completion Time   

------- ---- -- ---------- ----------- ------------ -------------------

7       Full    9.33M      DISK        00:00:02     2015-06-01 11:16:12

        BP Key: 7   Status: AVAILABLE  Compressed: NO  Tag: TAG20150601T111610

        Piece Name: /home/oracle/rman_back/ctl_ORASTRAC_20150601_7_1.bak

  Control File Included: Ckp SCN: 1027386      Ckp time: 2015-06-01 11:16:10

 

RMAN> list backupset summary;

 

 

List of Backups

===============

Key     TY LV S Device Type Completion Time     #Pieces #Copies Compressed Tag

------- -- -- - ----------- ------------------- ------- ------- ---------- ---

1       B  F  A DISK        2015-06-01 11:15:11 1       1       NO         TAG20150601T111228

2       B  F  A DISK        2015-06-01 11:15:48 1       1       NO         TAG20150601T111228

3       B  F  A DISK        2015-06-01 11:15:50 1       1       NO         TAG20150601T111228

4       B  F  A DISK        2015-06-01 11:15:52 1       1       NO         TAG20150601T111228

5       B  A  A DISK        2015-06-01 11:16:07 1       1       NO         TAG20150601T111605

6       B  A  A DISK        2015-06-01 11:16:07 1       1       NO         TAG20150601T111605

7       B  F  A DISK        2015-06-01 11:16:12 1       1       NO         TAG20150601T111610

 

RMAN>

 

 

 

一.3.2.3  将备份传递到target

这个方法就多了,可以采用ftp上传下载,也可以采用NFS网络文件系统,或者scp命令都可以,这里我们采用scp直接传递到rac环境的第一个节点。

 

源库scp操作:

[oracle@orcltest ~]$ cd rman_back/

[oracle@orcltest rman_back]$ ll

total 1189660

-rw-r----- 1 oracle asmadmin  43154944 Jun  1 11:16 arch_ORASTRAC_20150601_5_1.bak

-rw-r----- 1 oracle asmadmin      2560 Jun  1 11:16 arch_ORASTRAC_20150601_6_1.bak

-rw-r----- 1 oracle asmadmin   9797632 Jun  1 11:16 ctl_ORASTRAC_20150601_7_1.bak

-rw-r----- 1 oracle asmadmin 629121024 Jun  1 11:15 full_ORASTRAC_20150601_881233948_1_1.bak

-rw-r----- 1 oracle asmadmin 526229504 Jun  1 11:14 full_ORASTRAC_20150601_881233949_2_1.bak

-rw-r----- 1 oracle asmadmin   9797632 Jun  1 11:15 full_ORASTRAC_20150601_881234138_3_1.bak

-rw-r----- 1 oracle asmadmin     98304 Jun  1 11:15 full_ORASTRAC_20150601_881234150_4_1.bak

[oracle@orcltest rman_back]$ ll -h

total 1.2G

-rw-r----- 1 oracle asmadmin  42M Jun  1 11:16 arch_ORASTRAC_20150601_5_1.bak

-rw-r----- 1 oracle asmadmin 2.5K Jun  1 11:16 arch_ORASTRAC_20150601_6_1.bak

-rw-r----- 1 oracle asmadmin 9.4M Jun  1 11:16 ctl_ORASTRAC_20150601_7_1.bak

-rw-r----- 1 oracle asmadmin 600M Jun  1 11:15 full_ORASTRAC_20150601_881233948_1_1.bak

-rw-r----- 1 oracle asmadmin 502M Jun  1 11:14 full_ORASTRAC_20150601_881233949_2_1.bak

-rw-r----- 1 oracle asmadmin 9.4M Jun  1 11:15 full_ORASTRAC_20150601_881234138_3_1.bak

-rw-r----- 1 oracle asmadmin  96K Jun  1 11:15 full_ORASTRAC_20150601_881234150_4_1.bak

[oracle@orcltest rman_back]$

[oracle@orcltest rman_back]$ scp -r /home/oracle/rman_back  oracle@192.168.1.31:/home/oracle

oracle@192.168.1.31's password:

ctl_ORASTRAC_20150601_7_1.bak                                                                                                                                                  100%  9.4MB  17.7MB/s   00:01   

arch_ORASTRAC_20150601_5_1.bak                                                                                                                                                 100%   42MB  27.0MB/s   00:03   

arch_ORASTRAC_20150601_6_1.bak                                                                                                                                                 100%  2.5KB  16.5MB/s   00:02   

full_ORASTRAC_20150601_881233948_1_1.bak                                                                                                                                       100%   18MB  17.7MB/s   00:01   

full_ORASTRAC_20150601_881233949_2_1.bak                                                                                                                                       100%  618MB  12.4MB/s   00:50   

full_ORASTRAC_20150601_881234138_3_1.bak                                                                                                                                       100%  500MB  15.2MB/s   00:33   

full_ORASTRAC_20150601_881234150_4_1.bak                                                                                                                                       100%   96KB  96.0KB/s   00:00   

[oracle@node2 rman_back]$

 

 

 

 

 

target库查看备份文件:

[oracle@node1 rman_back]$ ll -h

total 1.2G

-rw-r----- 1 oracle oinstall  42M Jun  1 11:19 arch_ORASTRAC_20150601_5_1.bak

-rw-r----- 1 oracle oinstall 2.5K Jun  1 11:23 arch_ORASTRAC_20150601_6_1.bak

-rw-r----- 1 oracle oinstall 9.4M Jun  1 11:21 ctl_ORASTRAC_20150601_7_1.bak

-rw-r----- 1 oracle oinstall 600M Jun  1 11:23 full_ORASTRAC_20150601_881233948_1_1.bak

-rw-r----- 1 oracle oinstall 502M Jun  1 11:21 full_ORASTRAC_20150601_881233949_2_1.bak

-rw-r----- 1 oracle oinstall 9.4M Jun  1 11:21 full_ORASTRAC_20150601_881234138_3_1.bak

-rw-r----- 1 oracle oinstall  96K Jun  1 11:23 full_ORASTRAC_20150601_881234150_4_1.bak

[oracle@node1 rman_back]$

 

 

一.3.3  target库操作

 

以下操作若无特殊说明均在节点一操作。

 

一.3.3.1  查看rac环境

 

target库已经有3个库,都处于close状态。

[root@node2 ~]# crsstat

Name                           Type                       Target     State      Host      

------------------------------ -------------------------- ---------- ---------  -------  

ora.ARCH.dg                    ora.diskgroup.type         ONLINE     ONLINE     node1    

ora.DATA.dg                    ora.diskgroup.type         ONLINE     ONLINE     node1    

ora.LISTENER.lsnr              ora.listener.type          ONLINE     ONLINE     node1    

ora.LISTENER_SCAN1.lsnr        ora.scan_listener.type     ONLINE     ONLINE     node1    

ora.OVDISK.dg                  ora.diskgroup.type         ONLINE     ONLINE     node1    

ora.TEST.dg                    ora.diskgroup.type         ONLINE     ONLINE     node1    

ora.asm                        ora.asm.type               ONLINE     ONLINE     node1    

ora.db.db                      ora.database.type          OFFLINE    OFFLINE             

ora.eons                       ora.eons.type              ONLINE     ONLINE     node1    

ora.gsd                        ora.gsd.type               OFFLINE    OFFLINE             

ora.jmrac.db                   ora.database.type          ONLINE     ONLINE     node1    

ora.jmrac.haha.svc             ora.service.type           ONLINE     ONLINE     node1    

ora.net1.network               ora.network.type           ONLINE     ONLINE     node1    

ora.node1.ASM1.asm             application                ONLINE     ONLINE     node1    

ora.node1.LISTENER_NODE1.lsnr  application                ONLINE     ONLINE     node1    

ora.node1.gsd                  application                OFFLINE    OFFLINE             

ora.node1.ons                  application                ONLINE     ONLINE     node1    

ora.node1.vip                  ora.cluster_vip_net1.type  ONLINE     ONLINE     node1    

ora.node2.ASM2.asm             application                ONLINE     ONLINE     node2    

ora.node2.LISTENER_NODE2.lsnr  application                ONLINE     ONLINE     node2    

ora.node2.gsd                  application                OFFLINE    OFFLINE             

ora.node2.ons                  application                ONLINE     ONLINE     node2    

ora.node2.vip                  ora.cluster_vip_net1.type  ONLINE     ONLINE     node2    

ora.oc4j                       ora.oc4j.type              OFFLINE    OFFLINE             

ora.ons                        ora.ons.type               ONLINE     ONLINE     node1    

ora.ora11g.db                  ora.database.type          OFFLINE    OFFLINE             

ora.registry.acfs              ora.registry.acfs.type     ONLINE     ONLINE     node1    

ora.scan1.vip                  ora.scan_vip.type          ONLINE     ONLINE     node1

[root@node2 ~]# crsstat | grep ora.database.type

ora.db.db                      ora.database.type          OFFLINE    OFFLINE             

ora.jmrac.db                   ora.database.type          OFFLINE    OFFLINE             

ora.ora11g.db                  ora.database.type          OFFLINE    OFFLINE             

[root@node2 ~]#

 

 

查看磁盘组的情况,确保有足够的空间来还原数据库:

[root@node2 ~]# su - grid

[grid@node2 ~]$ asmcmd

ASMCMD>

ASMCMD> lsdg

State    Type    Rebal  Sector  Block       AU  Total_MB  Free_MB  Req_mir_free_MB  Usable_file_MB  Offline_disks  Voting_files  Name

MOUNTED  EXTERN  N         512   4096  1048576      9999     8905                0            8905              0             N  ARCH/

MOUNTED  EXTERN  N         512   4096  1048576     19999    11604                0           11604              0             N  DATA/

MOUNTED  EXTERN  N         512   4096  1048576      3099     2703                0            2703              0             N  OVDISK/

MOUNTED  EXTERN  N         512   4096  1048576      1024      929                0             929              0             N  TEST/

ASMCMD>

 

[root@node2 ~]# cat /etc/hosts

# Do not remove the following line, or various programs

# that require network functionality will fail.

127.0.0.1       localhost.localdomain localhost

::1             localhost6.localdomain6 localhost6

 

#public

192.168.1.31     node1

192.168.1.32     node2

#vip

192.168.1.131   node1-vip

192.168.1.132   node2-vip

#priv

9.9.9.31    node1-priv

9.9.9.32    node2-priv

 

#scan

192.168.1.35     cluster-scan

 

 

 

[root@node2 ~]# ifconfig

eth0      Link encap:Ethernet  HWaddr 00:0C:29:79:BA:86 

          inet addr:192.168.1.32 Bcast:192.168.1.255  Mask:255.255.255.0

          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1

          RX packets:150190 errors:0 dropped:0 overruns:0 frame:0

          TX packets:109804 errors:0 dropped:0 overruns:0 carrier:0

          collisions:0 txqueuelen:1000

          RX bytes:205303912 (195.7 MiB)  TX bytes:20182601 (19.2 MiB)

 

eth0:1    Link encap:Ethernet  HWaddr 00:0C:29:79:BA:86 

          inet addr:192.168.1.132  Bcast:192.168.1.255  Mask:255.255.255.0

          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1

 

eth1      Link encap:Ethernet  HWaddr 00:0C:29:79:BA:90 

          inet addr:9.9.9.32  Bcast:9.9.9.255  Mask:255.255.255.0

          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1

          RX packets:49075 errors:0 dropped:0 overruns:0 frame:0

          TX packets:49811 errors:0 dropped:0 overruns:0 carrier:0

          collisions:0 txqueuelen:1000

          RX bytes:23642469 (22.5 MiB)  TX bytes:31528595 (30.0 MiB)

 

lo        Link encap:Local Loopback 

          inet addr:127.0.0.1  Mask:255.0.0.0

          UP LOOPBACK RUNNING  MTU:16436  Metric:1

          RX packets:16496 errors:0 dropped:0 overruns:0 frame:0

          TX packets:16496 errors:0 dropped:0 overruns:0 carrier:0

          collisions:0 txqueuelen:0

          RX bytes:15118447 (14.4 MiB)  TX bytes:15118447 (14.4 MiB)

 

[root@node2 ~]#

 

 

一.3.3.2  恢复spfilepfile,修改pfile,创建相关路径:

 

 

首先利用rman恢复spfile

[oracle@node1 rman_back]$ ORACLE_SID=orastrac

[oracle@node1 rman_back]$ rman target /

 

Recovery Manager: Release 11.2.0.1.0 - Production on Mon Jun 1 13:25:33 2015

 

Copyright (c) 1982, 2009, Oracle and/or its affiliates.  All rights reserved.

 

connected to target database (not started)

 

RMAN> set dbid 1317814272

 

executing command: SET DBID

 

RMAN> startup nomount;

 

startup failed: ORA-01078: failure in processing system parameters

LRM-00109: could not open parameter file '/u01/app/oracle/product/11.2.0/dbhome_1/dbs/initorastrac.ora'

 

starting Oracle instance without parameter file for retrieval of spfile

Oracle instance started

 

Total System Global Area     158662656 bytes

 

Fixed Size                     2211448 bytes

Variable Size                 96469384 bytes

Database Buffers              54525952 bytes

Redo Buffers                   5455872 bytes

 

RMAN> restore spfile to pfile '?/dbs/initorastrac.ora' from '/home/oracle/rman_back/full_ORASTRAC_20150601_881234150_4_1.bak';

 

Starting restore at 01-JUN-2015 13:25:59

using target database control file instead of recovery catalog

allocated channel: ORA_DISK_1

channel ORA_DISK_1: SID=25 device type=DISK

 

channel ORA_DISK_1: restoring spfile from AUTOBACKUP /home/oracle/rman_back/full_ORASTRAC_20150601_881234150_4_1.bak

channel ORA_DISK_1: SPFILE restore from AUTOBACKUP complete

Finished restore at 01-JUN-2015 13:26:00

 

RMAN>

RMAN> exit

 

 

Recovery Manager complete.

[oracle@node1 rman_back]$ ll /u01/app/oracle/product/11.2.0/dbhome_1/dbs/initorastrac.ora

-rw-r--r-- 1 oracle asmadmin 997 Jun  1 13:25 /u01/app/oracle/product/11.2.0/dbhome_1/dbs/initorastrac.ora

[oracle@node1 rman_back]$

[oracle@node1 rman_back]$ more /u01/app/oracle/product/11.2.0/dbhome_1/dbs/initorastrac.ora

orastrac.__db_cache_size=121634816

orastrac.__java_pool_size=4194304

orastrac.__large_pool_size=4194304

orastrac.__oracle_base='/u01/app/oracle'#ORACLE_BASE set from environment

orastrac.__pga_aggregate_target=167772160

orastrac.__sga_target=243269632

orastrac.__shared_io_pool_size=0

orastrac.__shared_pool_size=100663296

orastrac.__streams_pool_size=0

*.audit_file_dest='/u01/app/oracle/admin/orastrac/adump'

*.audit_trail='db'

*.compatible='11.2.0.0.0'

*.control_files='/u01/app/oracle/oradata/orastrac/control01.ctl','/u01/app/oracle/flash_recovery_area/orastrac/control02.ctl'

*.db_block_size=8192

*.db_domain=''

*.db_name='orastrac'

*.db_recovery_file_dest='/u01/app/oracle/flash_recovery_area'

*.db_recovery_file_dest_size=4070572032

*.diagnostic_dest='/u01/app/oracle'

*.dispatchers='(PROTOCOL=TCP) (SERVICE=orastracXDB)'

*.log_archive_format='%t_%s_%r.dbf'

*.memory_target=408944640

*.open_cursors=300

*.processes=150

*.remote_login_passwordfile='EXCLUSIVE'

*.undo_tablespace='UNDOTBS1'

[oracle@node1 rman_back]$

 

 

修改与路径相关的参数,修改后如下:

[oracle@node1 dbs]$ more initorastrac.ora

*.audit_file_dest='/u01/app/oracle/admin/orastrac/adump'

*.audit_trail='db'

*.compatible='11.2.0.0.0'

*.control_files='+DATA/orastrac/controlfile/control01.ctl'

*.db_block_size=8192

*.db_domain=''

*.db_name='orastrac'

*.db_recovery_file_dest='+ARCH'

*.db_recovery_file_dest_size=4070572032

*.diagnostic_dest='/u01/app/oracle'

*.dispatchers='(PROTOCOL=TCP) (SERVICE=orastracXDB)'

*.log_archive_format='%t_%s_%r.dbf'

*.memory_target=408944640

*.open_cursors=300

*.processes=150

*.remote_login_passwordfile='EXCLUSIVE'

*.undo_tablespace='UNDOTBS1'

 

 

插曲:注意,这里如果想让控制文件的格式为ASM格式,可以这样设置控制文件的路径:

 

pfile文件中的control_files这样写: *.control_files='+DATA','+ARCH',然后还原的时候就可以直接还原为asm格式的文件了,我这里由于是后边补上的,所以就不采用如下的形式了,如下:

 

 

RMAN> restore controlfile   from '/home/oracle/rman_back/ctl_ORASTRAC_20150601_7_1.bak';

 

Starting restore at 01-JUN-2015 17:59:39

using channel ORA_DISK_1

 

channel ORA_DISK_1: restoring control file

channel ORA_DISK_1: restore complete, elapsed time: 00:00:01

output file name=+DATA/orastrac/controlfile/current.357.881258379

output file name=+ARCH/orastrac/controlfile/current.369.881258379

Finished restore at 01-JUN-2015 17:59:40

 

RMAN>

 

 

创建os文件路径,注意在节点一和节点二都执行:

[oracle@node1 ~]$ mkdir -p /u01/app/oracle/admin/orastrac/adump

[oracle@node1 ~]$

 

 

注意哟,创建的 spfile 可是要放到共享存储上去的: 

 

[oracle@node1 dbs]$ sqlplus / as sysdba

 

SQL*Plus: Release 11.2.0.1.0 Production on Mon Jun 1 15:49:22 2015

 

Copyright (c) 1982, 2009, Oracle.  All rights reserved.

 

 

Connected to:

Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production

With the Partitioning, Real Application Clusters, Automatic Storage Management, OLAP,

Data Mining and Real Application Testing options

 

SQL>  create spfile='+DATA' from pfile;

 

File created.

 

SQL>

File created.

SQL> show parameter spfile

 

NAME                                 TYPE        VALUE

------------------------------------ ----------- ------------------------------

spfile                               string

SQL>

 

 

查看新创建的spfile的文件名:

ASMCMD> pwd

+DATA/orastrac/PARAMETERFILE

ASMCMD> ls

spfile.335.881250575

ASMCMD>

 

 

[oracle@node1 dbs]$ cp initorastrac.ora initorastrac.ora_bk2

[oracle@node1 dbs]$ echo "SPFILE='+DATA/ORASTRAC/PARAMETERFILE/spfile.335.881250575'" > $ORACLE_HOME/dbs/initorastrac.ora

[oracle@node1 dbs]$

[oracle@node1 dbs]$ more initorastrac.ora

SPFILE='+DATA/ORASTRAC/PARAMETERFILE/spfile.335.881250575'

[oracle@node1 dbs]$

 

一.3.3.3  恢复控制文件

 

[oracle@node1 dbs]$ rman target /

 

Recovery Manager: Release 11.2.0.1.0 - Production on Mon Jun 1 15:46:55 2015

 

Copyright (c) 1982, 2009, Oracle and/or its affiliates.  All rights reserved.

 

connected to target database (not started)

 

RMAN> startup nomount force;

 

Oracle instance started

 

Total System Global Area     409194496 bytes

 

Fixed Size                     2213856 bytes

Variable Size                272631840 bytes

Database Buffers             130023424 bytes

Redo Buffers                   4325376 bytes

 

RMAN> restore controlfile   from '/home/oracle/rman_back/ctl_ORASTRAC_20150601_7_1.bak';

 

Starting restore at 01-JUN-2015 15:47:14

using target database control file instead of recovery catalog

allocated channel: ORA_DISK_1

channel ORA_DISK_1: SID=29 device type=DISK

 

channel ORA_DISK_1: restoring control file

channel ORA_DISK_1: restore complete, elapsed time: 00:00:07

output file name=+DATA/orastrac/controlfile/control01.ctl

Finished restore at 01-JUN-2015 15:47:21

 

RMAN> alter database mount;

 

database mounted

released channel: ORA_DISK_1

 

RMAN>

 

 

 

 

 

一.3.3.4  还原及恢复数据文件

 

首先得到运行的脚本:

[oracle@node1 dbs]$ sqlplus / as sysdba

 

SQL*Plus: Release 11.2.0.1.0 Production on Mon Jun 1 15:58:47 2015

 

Copyright (c) 1982, 2009, Oracle.  All rights reserved.

 

 

Connected to:

Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production

With the Partitioning, Real Application Clusters, Automatic Storage Management, OLAP,

Data Mining and Real Application Testing options

 

SQL> set line 9999 pagesize 9999

SQL> col FILE_NAME format a60

SQL> select 'datafile' file_type, file#,name FILE_NAME,status,enabled from v$datafile

  2  union all

  3  select 'tempfile',file#,name FILE_NAME,status,enabled from v$tempfile

  4  union all

  5  select 'logfile',group# file#,member FILE_NAME,status,'' from v$logfile

  6  union all

  7  select 'controlfile', to_number('') ,name FILE_NAME,status,'' from v$controlfile

  8  ;

 

FILE_TYPE        FILE# FILE_NAME                                                    STATUS  ENABLED

----------- ---------- ------------------------------------------------------------ ------- ----------

datafile             1 /u01/app/oracle/oradata/orastrac/system01.dbf                SYSTEM  READ WRITE

datafile             2 /u01/app/oracle/oradata/orastrac/sysaux01.dbf                ONLINE  READ WRITE

datafile             3 /u01/app/oracle/oradata/orastrac/undotbs01.dbf               ONLINE  READ WRITE

datafile             4 /u01/app/oracle/oradata/orastrac/users01.dbf                 ONLINE  READ WRITE

datafile             5 /u01/app/oracle/oradata/orastrac/example01.dbf               ONLINE  READ WRITE

tempfile             1 /u01/app/oracle/oradata/orastrac/temp01.dbf                  ONLINE  READ WRITE

logfile              3 /u01/app/oracle/oradata/orastrac/redo03.log

logfile              2 /u01/app/oracle/oradata/orastrac/redo02.log

logfile              1 /u01/app/oracle/oradata/orastrac/redo01.log

controlfile            +DATA/orastrac/controlfile/control01.ctl

 

10 rows selected.

 

SQL> set pagesize  200 linesize 200

SQL> select 'set newname for datafile ' || a.FILE# || ' to "' || a.NAME || '";'

  2    from v$datafile a

  3  union all

  4  select 'set newname for tempfile ' || a.FILE# || ' to "' || a.NAME || '";'

  5    from v$tempfile a

  6  union all

  7  SELECT 'SQL "ALTER DATABASE RENAME FILE ''''' || a.MEMBER || '''''  to  ''''' ||

  8         a.MEMBER || ''''' ";'

  9    FROM v$logfile a;

 

'SETNEWNAMEFORDATAFILE'||A.FILE#||'TO"'||A.NAME||'";'

--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

set newname for datafile 1 to "/u01/app/oracle/oradata/orastrac/system01.dbf";

set newname for datafile 2 to "/u01/app/oracle/oradata/orastrac/sysaux01.dbf";

set newname for datafile 3 to "/u01/app/oracle/oradata/orastrac/undotbs01.dbf";

set newname for datafile 4 to "/u01/app/oracle/oradata/orastrac/users01.dbf";

set newname for datafile 5 to "/u01/app/oracle/oradata/orastrac/example01.dbf";

set newname for tempfile 1 to "/u01/app/oracle/oradata/orastrac/temp01.dbf";

SQL "ALTER DATABASE RENAME FILE ''/u01/app/oracle/oradata/orastrac/redo03.log''  to  ''/u01/app/oracle/oradata/orastrac/redo03.log'' ";

SQL "ALTER DATABASE RENAME FILE ''/u01/app/oracle/oradata/orastrac/redo02.log''  to  ''/u01/app/oracle/oradata/orastrac/redo02.log'' ";

SQL "ALTER DATABASE RENAME FILE ''/u01/app/oracle/oradata/orastrac/redo01.log''  to  ''/u01/app/oracle/oradata/orastrac/redo01.log'' ";

 

9 rows selected.

 

SQL>

 

 

 

 

查看备份集及还原数据库:

RMAN> list backupset;

 

 

List of Backup Sets

===================

 

 

BS Key  Type LV Size       Device Type Elapsed Time Completion Time    

------- ---- -- ---------- ----------- ------------ --------------------

1       Full    501.84M    DISK        00:02:42     01-JUN-2015 11:15:11

        BP Key: 1   Status: AVAILABLE  Compressed: NO  Tag: TAG20150601T111228

        Piece Name: /home/oracle/rman_back/full_ORASTRAC_20150601_881233949_2_1.bak

  List of Datafiles in backup set 1

  File LV Type Ckp SCN    Ckp Time             Name

  ---- -- ---- ---------- -------------------- ----

  2       Full 1027268    01-JUN-2015 11:12:29 /u01/app/oracle/oradata/orastrac/sysaux01.dbf

  3       Full 1027268    01-JUN-2015 11:12:29 /u01/app/oracle/oradata/orastrac/undotbs01.dbf

  5       Full 1027268    01-JUN-2015 11:12:29 /u01/app/oracle/oradata/orastrac/example01.dbf

 

BS Key  Type LV Size       Device Type Elapsed Time Completion Time    

------- ---- -- ---------- ----------- ------------ --------------------

2       Full    9.33M      DISK        00:00:10     01-JUN-2015 11:15:48

        BP Key: 2   Status: AVAILABLE  Compressed: NO  Tag: TAG20150601T111228

        Piece Name: /home/oracle/rman_back/full_ORASTRAC_20150601_881234138_3_1.bak

  Control File Included: Ckp SCN: 1027334      Ckp time: 01-JUN-2015 11:15:38

 

BS Key  Type LV Size       Device Type Elapsed Time Completion Time    

------- ---- -- ---------- ----------- ------------ --------------------

3       Full    80.00K     DISK        00:00:00     01-JUN-2015 11:15:50

        BP Key: 3   Status: AVAILABLE  Compressed: NO  Tag: TAG20150601T111228

        Piece Name: /home/oracle/rman_back/full_ORASTRAC_20150601_881234150_4_1.bak

  SPFILE Included: Modification time: 01-JUN-2015 11:12:28

  SPFILE db_unique_name: ORASTRAC

 

BS Key  Type LV Size       Device Type Elapsed Time Completion Time    

------- ---- -- ---------- ----------- ------------ --------------------

4       Full    599.97M    DISK        00:03:24     01-JUN-2015 11:15:52

        BP Key: 4   Status: AVAILABLE  Compressed: NO  Tag: TAG20150601T111228

        Piece Name: /home/oracle/rman_back/full_ORASTRAC_20150601_881233948_1_1.bak

  List of Datafiles in backup set 4

  File LV Type Ckp SCN    Ckp Time             Name

  ---- -- ---- ---------- -------------------- ----

  1       Full 1027267    01-JUN-2015 11:12:29 /u01/app/oracle/oradata/orastrac/system01.dbf

  4       Full 1027267    01-JUN-2015 11:12:29 /u01/app/oracle/oradata/orastrac/users01.dbf

 

BS Key  Size       Device Type Elapsed Time Completion Time    

------- ---------- ----------- ------------ --------------------

5       41.16M     DISK        00:00:02     01-JUN-2015 11:16:07

        BP Key: 5   Status: AVAILABLE  Compressed: NO  Tag: TAG20150601T111605

        Piece Name: /home/oracle/rman_back/arch_ORASTRAC_20150601_5_1.bak

 

  List of Archived Logs in backup set 5

  Thrd Seq     Low SCN    Low Time             Next SCN   Next Time

  ---- ------- ---------- -------------------- ---------- ---------

  1    5       1012317    01-JUN-2015 11:04:50 1027356    01-JUN-2015 11:15:59

 

BS Key  Size       Device Type Elapsed Time Completion Time    

------- ---------- ----------- ------------ --------------------

6       2.00K      DISK        00:00:02     01-JUN-2015 11:16:07

        BP Key: 6   Status: AVAILABLE  Compressed: NO  Tag: TAG20150601T111605

        Piece Name: /home/oracle/rman_back/arch_ORASTRAC_20150601_6_1.bak

 

  List of Archived Logs in backup set 6

  Thrd Seq     Low SCN    Low Time             Next SCN   Next Time

  ---- ------- ---------- -------------------- ---------- ---------

  1   6       1027356    01-JUN-2015 11:15:59 1027365    01-JUN-2015 11:16:05

 

RMAN>

RMAN> run {

2> ALLOCATE CHANNEL c1 DEVICE TYPE DISK;

3> set newname for datafile 1 to "+DATA";

4> set newname for datafile 2 to "+DATA";

5> set newname for datafile 3 to "+DATA";

6> set newname for datafile 4 to "+DATA";

7> set newname for datafile 5 to "+DATA";

8> set newname for tempfile 1 to "+DATA";

9> SQL "ALTER DATABASE RENAME FILE ''/u01/app/oracle/oradata/orastrac/redo03.log''  to  ''+DATA'' ";

10> SQL "ALTER DATABASE RENAME FILE ''/u01/app/oracle/oradata/orastrac/redo02.log''  to  ''+DATA'' ";

11> SQL "ALTER DATABASE RENAME FILE ''/u01/app/oracle/oradata/orastrac/redo01.log''  to  ''+DATA'' ";

12> restore database;

13> SWITCH DATAFILE ALL;

14> SWITCH TEMPFILE ALL;

15> release channel c1;

16> }

 

allocated channel: c1

channel c1: SID=27 device type=DISK

 

executing command: SET NEWNAME

 

executing command: SET NEWNAME

 

executing command: SET NEWNAME

 

executing command: SET NEWNAME

 

executing command: SET NEWNAME

 

executing command: SET NEWNAME

 

sql statement: ALTER DATABASE RENAME FILE ''/u01/app/oracle/oradata/orastrac/redo03.log''  to  ''+DATA''

 

sql statement: ALTER DATABASE RENAME FILE ''/u01/app/oracle/oradata/orastrac/redo02.log''  to  ''+DATA''

 

sql statement: ALTER DATABASE RENAME FILE ''/u01/app/oracle/oradata/orastrac/redo01.log''  to  ''+DATA''

 

Starting restore at 01-JUN-2015 16:04:19

Starting implicit crosscheck backup at 01-JUN-2015 16:04:19

Crosschecked 6 objects

Finished implicit crosscheck backup at 01-JUN-2015 16:04:19

 

Starting implicit crosscheck copy at 01-JUN-2015 16:04:19

Finished implicit crosscheck copy at 01-JUN-2015 16:04:19

 

searching for all files in the recovery area

cataloging files...

no files cataloged

 

 

channel c1: starting datafile backup set restore

channel c1: specifying datafile(s) to restore from backup set

channel c1: restoring datafile 00002 to +DATA

channel c1: restoring datafile 00003 to +DATA

channel c1: restoring datafile 00005 to +DATA

channel c1: reading from backup piece /home/oracle/rman_back/full_ORASTRAC_20150601_881233949_2_1.bak

channel c1: piece handle=/home/oracle/rman_back/full_ORASTRAC_20150601_881233949_2_1.bak tag=TAG20150601T111228

channel c1: restored backup piece 1

channel c1: restore complete, elapsed time: 00:00:48

channel c1: starting datafile backup set restore

channel c1: specifying datafile(s) to restore from backup set

channel c1: restoring datafile 00001 to +DATA

channel c1: restoring datafile 00004 to +DATA

channel c1: reading from backup piece /home/oracle/rman_back/full_ORASTRAC_20150601_881233948_1_1.bak

channel c1: piece handle=/home/oracle/rman_back/full_ORASTRAC_20150601_881233948_1_1.bak tag=TAG20150601T111228

channel c1: restored backup piece 1

channel c1: restore complete, elapsed time: 00:00:49

Finished restore at 01-JUN-2015 16:05:58

 

datafile 1 switched to datafile copy

input datafile copy RECID=7 STAMP=881251559 file name=+DATA/orastrac/datafile/system.330.881251509

datafile 2 switched to datafile copy

input datafile copy RECID=8 STAMP=881251559 file name=+DATA/orastrac/datafile/sysaux.331.881251461

datafile 3 switched to datafile copy

input datafile copy RECID=9 STAMP=881251559 file name=+DATA/orastrac/datafile/undotbs1.329.881251463

datafile 4 switched to datafile copy

input datafile copy RECID=10 STAMP=881251559 file name=+DATA/orastrac/datafile/users.327.881251511

datafile 5 switched to datafile copy

input datafile copy RECID=11 STAMP=881251559 file name=+DATA/orastrac/datafile/example.332.881251463

 

renamed tempfile 1 to +DATA in control file

 

released channel: c1

 

RMAN>

 

RMAN> RUN

2> {

3> set until sequence 6; 

4> recover database;

5> }

 

executing command: SET until clause

 

Starting recover at 01-JUN-2015 16:08:53

allocated channel: ORA_DISK_1

channel ORA_DISK_1: SID=27 device type=DISK

 

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=5

channel ORA_DISK_1: reading from backup piece /home/oracle/rman_back/arch_ORASTRAC_20150601_5_1.bak

channel ORA_DISK_1: piece handle=/home/oracle/rman_back/arch_ORASTRAC_20150601_5_1.bak tag=TAG20150601T111605

channel ORA_DISK_1: restored backup piece 1

channel ORA_DISK_1: restore complete, elapsed time: 00:00:03

archived log file name=+ARCH/orastrac/archivelog/2015_06_01/thread_1_seq_5.350.881251737 thread=1 sequence=5

channel default: deleting archived log(s)

archived log file name=+ARCH/orastrac/archivelog/2015_06_01/thread_1_seq_5.350.881251737 RECID=3 STAMP=881251739

media recovery complete, elapsed time: 00:00:02

Finished recover at 01-JUN-2015 16:09:01

 

RMAN>

 

 

 

 

 

 

告警日志:

 

ALTER DATABASE RENAME FILE '/u01/app/oracle/oradata/orastrac/redo03.log'  to  '+DATA'

Completed: ALTER DATABASE RENAME FILE '/u01/app/oracle/oradata/orastrac/redo03.log'  to  '+DATA'

ALTER DATABASE RENAME FILE '/u01/app/oracle/oradata/orastrac/redo02.log'  to  '+DATA'

Completed: ALTER DATABASE RENAME FILE '/u01/app/oracle/oradata/orastrac/redo02.log'  to  '+DATA'

ALTER DATABASE RENAME FILE '/u01/app/oracle/oradata/orastrac/redo01.log'  to  '+DATA'

Completed: ALTER DATABASE RENAME FILE '/u01/app/oracle/oradata/orastrac/redo01.log'  to  '+DATA'

SUCCESS: diskgroup ARCH was mounted

Mon Jun 01 16:04:40 2015

Full restore complete of datafile 5 to datafile copy +DATA/orastrac/datafile/example.332.881251463.  Elapsed time: 0:00:14

  checkpoint is 1027268

  last deallocation scn is 965277

Full restore complete of datafile 3 to datafile copy +DATA/orastrac/datafile/undotbs1.329.881251463.  Elapsed time: 0:00:18

  checkpoint is 1027268

  last deallocation scn is 983226

Mon Jun 01 16:05:05 2015

Full restore complete of datafile 2 to datafile copy +DATA/orastrac/datafile/sysaux.331.881251461.  Elapsed time: 0:00:43

  checkpoint is 1027268

  last deallocation scn is 1026156

Full restore complete of datafile 4 to datafile copy +DATA/orastrac/datafile/users.327.881251511.  Elapsed time: 0:00:03

  checkpoint is 1027267

Mon Jun 01 16:05:49 2015

Full restore complete of datafile 1 to datafile copy +DATA/orastrac/datafile/system.330.881251509.  Elapsed time: 0:00:39

  checkpoint is 1027267

  last deallocation scn is 1025383

Mon Jun 01 16:05:59 2015

Errors in file /u01/app/oracle/diag/rdbms/orastrac/orastrac/trace/orastrac_ora_19721.trc:

ORA-19625: error identifying file /u01/app/oracle/oradata/orastrac/system01.dbf

ORA-27037: unable to obtain file status

Linux-x86_64 Error: 2: No such file or directory

Additional information: 3