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

实验环境介绍

网站建设哪家好,找创新互联建站!专注于网页设计、网站建设、微信开发、微信小程序开发、集团企业网站建设等服务项目。为回馈新老客户创新互联还提供了甘孜州免费建站欢迎大家使用!

源库:1 1.2.0.1   rac库 2个节点

目标库:11.2.0. 1  RHEL6.5  

1.2.4    本文简介

 

    本文也可以理解成rac 环境下的如何数据库迁移到单实例的数据库环境下,默认目标库已经安装好了同源库一样的数据库版本。  

另外注意,BLOG 中代码部分需要特别关注的地方我都用黄色背景和红色字体来表示,比如下边的例子中,thread 1的最大归档日志号为33,thread 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

 

 

1.3    实验部分  

1.3.1    实验目标  

将11.2.0.1 下的rac库备份并恢复到11.2.0.1 下的单实例环境下。

 

1.3.2    源 rac 库执行

rac 库需要执行备份并传递到目标库。

 

1.3.2.1    查看 rac 环境及创建测试表

[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

 

eth2      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 ~]#

[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 ~]#

[oracle@node2 ~]$ ORACLE_SID= jmrac2

[oracle@node2 ~]$ sqlplus / as sysdba

 

SQL*Plus: Release 11.2.0.1.0 Production on Fri May 29 10:58:42 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> show parameter cluster

 

NAME                                 TYPE        VALUE

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

cluster_database                     boolean     TRUE

cluster_database_instances           integer     2

cluster_interconnects                string

SQL> show parameter name

 

NAME                                 TYPE        VALUE

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

db_file_name_convert                 string

db_name                              string      jmrac

db_unique_name                       string      jmrac

global_names                         boolean     FALSE

instance_name                        string      jmrac2

lock_name_space                      string

log_file_name_convert                string

service_names                        string      HAHA

SQL> archive log list;

Database log mode              Archive Mode

Automatic archival             Enabled

Archive destination            USE_DB_RECOVERY_FILE_DEST

Oldest online log sequence     41

Next log sequence to archive   42

Current log sequence           42

SQL>

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

 

Table created.

 

SQL>  select count(1) from lhr.rac_to_single_test ;

 

  COUNT(1)

----------

     72510

 

SQL>

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 +DATA/jmrac/datafile/system.268.877470209                    SYSTEM  READ WRITE

datafile             2 +DATA/jmrac/datafile/sysaux.269.877470211                    ONLINE  READ WRITE

datafile             3 +DATA/jmrac/datafile/undotbs1.270.877470213                  ONLINE  READ WRITE

datafile             4 +DATA/jmrac/datafile/users.271.877470213                     ONLINE  READ WRITE

datafile             5 +DATA/jmrac/datafile/example.279.877470401                   ONLINE  READ WRITE

datafile             6 +DATA/jmrac/datafile/undotbs2.280.877470779                  ONLINE  READ WRITE

tempfile             1 +DATA/jmrac/tempfile/temp.278.877470381                      ONLINE  READ WRITE

logfile              2 +DATA/jmrac/onlinelog/group_2.276.877470349

logfile              2 +DATA/jmrac/onlinelog/group_2.277.877470349

logfile              1 +DATA/jmrac/onlinelog/group_1.274.877470345

logfile              1 +DATA/jmrac/onlinelog/group_1.275.877470345

logfile              3 +DATA/jmrac/onlinelog/group_3.281.877470929

logfile              3 +DATA/jmrac/onlinelog/group_3.282.877470931

logfile              4 +DATA/jmrac/onlinelog/group_4.283.877470937

logfile              4 +DATA/jmrac/onlinelog/group_4.284.877470943

controlfile            +DATA/jmrac/controlfile/current.273.877470341

controlfile            +DATA/jmrac/controlfile/current.272.877470343

 

17 rows selected.

 

SQL>

 

我后续将在192.168.1.32 即rac的第二个节点上执行操作,db_name为jmrac,数据库为归档模式,创建测试表lhr.rac_to_single_test,数据量为72510 行,其中有个crsstat命令,可以参考:【RAC】如何让Oracle RAC crs_stat 命令显示完整   http://blog.itpub.net/26736162/viewspace-1610957/   

  1.3.2.2    生成 pfile 文件

SQL> show parameter instance_n

 

NAME                                 TYPE        VALUE

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

instance_name                        string      jmrac2

instance_number                      integer     2

SQL> show parameter spfile

 

NAME                                 TYPE        VALUE

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

spfile                               string       +DATA/jmrac/spfilejmrac.ora

SQL>  create pfile='/home/oracle/rman_back/initjmrac.ora' from spfile;

 

File created.

 

SQL>

  1.3.2.3    执行备份操作

备份脚本如下:

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@node2 ~]$ rman target /

 

Recovery Manager: Release 11.2.0.1.0 - Production on Fri May 29 11:12:51 2015

 

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

 

connected to target database: JMRAC (DBID=1916705604)

 

{

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=55 instance=jmrac2 device type=DISK

 

allocated channel: c2

channel c2: SID=57 instance=jmrac2 device type=DISK

 

Starting backup at 29-MAY-2015 11:12:59

channel c1: starting full datafile backup set

channel c1: specifying datafile(s) in backup set

input datafile file number=00001 name=+DATA/jmrac/datafile/system.268.877470209

input datafile file number=00004 name=+DATA/jmrac/datafile/users.271.877470213

input datafile file number=00006 name=+DATA/jmrac/datafile/undotbs2.280.877470779

channel c1: starting piece 1 at 29-MAY-2015 11:13:00

channel c2: starting full datafile backup set

channel c2: specifying datafile(s) in backup set

input datafile file number=00002 name=+DATA/jmrac/datafile/sysaux.269.877470211

input datafile file number=00005 name=+DATA/jmrac/datafile/example.279.877470401

input datafile file number=00003 name=+DATA/jmrac/datafile/undotbs1.270.877470213

channel c2: starting piece 1 at 29-MAY-2015 11:13:00

channel c1: finished piece 1 at 29-MAY-2015 11:15:35

piece handle=/home/oracle/rman_back/full_JMRACxxx_20150529_880974780_5_1.bak tag=TAG20150529T111259 comment=NONE

channel c1: backup set complete, elapsed time: 00:02:35

channel c1: starting full datafile backup set

channel c1: specifying datafile(s) in backup set

channel c2: finished piece 1 at 29-MAY-2015 11:15:35

piece handle=/home/oracle/rman_back/full_JMRACxxx_20150529_880974780_6_1.bak tag=TAG20150529T111259 comment=NONE

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

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 29-MAY-2015 11:15:35

including current control file in backup set

channel c1: starting piece 1 at 29-MAY-2015 11:15:38

channel c2: finished piece 1 at 29-MAY-2015 11:15:38

piece handle=/home/oracle/rman_back/full_JMRACxxx_20150529_880974935_8_1.bak tag=TAG20150529T111259 comment=NONE

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

channel c1: finished piece 1 at 29-MAY-2015 11:15:40

piece handle=/home/oracle/rman_back/full_JMRACxxx_20150529_880974935_7_1.bak tag=TAG20150529T111259 comment=NONE

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

Finished backup at 29-MAY-2015 11:15:40

 

sql statement: alter system archive log current

 

Starting backup at 29-MAY-2015 11:15:53

current log archived

channel c1: starting archived log backup set

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

input archived log thread=2 sequence=31 RECID=50 STAMP=879502099

input archived log thread=1 sequence=24 RECID=52 STAMP=879511365

input archived log thread=2 sequence=32 RECID=51 STAMP=879502100

input archived log thread=1 sequence=25 RECID=55 STAMP=879527440

input archived log thread=2 sequence=33 RECID=53 STAMP=879522769

input archived log thread=2 sequence=34 RECID=54 STAMP=879527240

input archived log thread=2 sequence=35 RECID=57 STAMP=879586992

input archived log thread=1 sequence=26 RECID=56 STAMP=879527447

input archived log thread=1 sequence=27 RECID=60 STAMP=879590456

input archived log thread=2 sequence=36 RECID=58 STAMP=879586995

input archived log thread=2 sequence=37 RECID=59 STAMP=879590456

input archived log thread=1 sequence=28 RECID=61 STAMP=879590457

channel c1: starting piece 1 at 29-MAY-2015 11:16:05

channel c2: starting archived log backup set

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

input archived log thread=2 sequence=38 RECID=63 STAMP=880971338

input archived log thread=1 sequence=29 RECID=62 STAMP=880971333

input archived log thread=2 sequence=39 RECID=64 STAMP=880971341

input archived log thread=1 sequence=30 RECID=65 STAMP=880972786

input archived log thread=2 sequence=40 RECID=66 STAMP=880972787

input archived log thread=2 sequence=41 RECID=67 STAMP=880972787

input archived log thread=1 sequence=31 RECID=68 STAMP=880974598

channel c2: starting piece 1 at 29-MAY-2015 11:16:05

channel c1: finished piece 1 at 29-MAY-2015 11:16:20

piece handle=/home/oracle/rman_back/arch_JMRAC_20150529_9_1.bak tag=TAG20150529T111603 comment=NONE

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

channel c1: deleting archived log(s)

archived log file name=+DATA/jmrac/archivelog/2015_05_12/thread_2_seq_31.359.879502097 RECID=50 STAMP=879502099

archived log file name=+DATA/jmrac/archivelog/2015_05_12/thread_1_seq_24.356.879511361 RECID=52 STAMP=879511365

archived log file name=+DATA/jmrac/archivelog/2015_05_12/thread_2_seq_32.357.879502099 RECID=51 STAMP=879502100

archived log file name=+DATA/jmrac/archivelog/2015_05_12/thread_1_seq_25.352.879527441 RECID=55 STAMP=879527440

archived log file name=+DATA/jmrac/archivelog/2015_05_12/thread_2_seq_33.353.879522767 RECID=53 STAMP=879522769

archived log file name=+DATA/jmrac/archivelog/2015_05_12/thread_2_seq_34.351.879527239 RECID=54 STAMP=879527240

archived log file name=+DATA/jmrac/archivelog/2015_05_13/thread_2_seq_35.333.879586991 RECID=57 STAMP=879586992

archived log file name=+DATA/jmrac/archivelog/2015_05_12/thread_1_seq_26.335.879527445 RECID=56 STAMP=879527447

archived log file name=+DATA/jmrac/archivelog/2015_05_13/thread_1_seq_27.331.879590457 RECID=60 STAMP=879590456

archived log file name=+DATA/jmrac/archivelog/2015_05_13/thread_2_seq_36.334.879586995 RECID=58 STAMP=879586995

archived log file name=+DATA/jmrac/archivelog/2015_05_13/thread_2_seq_37.332.879590455 RECID=59 STAMP=879590456

archived log file name=+DATA/jmrac/archivelog/2015_05_13/thread_1_seq_28.329.879590457 RECID=61 STAMP=879590457

channel c1: starting archived log backup set

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

input archived log thread=2 sequence=42 RECID=70 STAMP=880974952

input archived log thread=1 sequence=32 RECID=69 STAMP=880974952

input archived log thread=1 sequence=33 RECID=72 STAMP=880974959

input archived log thread=2 sequence=43 RECID=71 STAMP=880974953

channel c1: starting piece 1 at 29-MAY-2015 11:16:23

channel c2: finished piece 1 at 29-MAY-2015 11:16:23

piece handle=/home/oracle/rman_back/arch_JMRAC_20150529_10_1.bak tag=TAG20150529T111603 comment=NONE

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

channel c2: deleting archived log(s)

archived log file name=+DATA/jmrac/archivelog/2015_05_29/thread_2_seq_38.330.880971315 RECID=63 STAMP=880971338

archived log file name=+DATA/jmrac/archivelog/2015_05_29/thread_1_seq_29.327.880971317 RECID=62 STAMP=880971333

archived log file name=+DATA/jmrac/archivelog/2015_05_29/thread_2_seq_39.326.880971341 RECID=64 STAMP=880971341

archived log file name=+DATA/jmrac/archivelog/2015_05_29/thread_1_seq_30.328.880972785 RECID=65 STAMP=880972786

archived log file name=+DATA/jmrac/archivelog/2015_05_29/thread_2_seq_40.325.880972785 RECID=66 STAMP=880972787

archived log file name=+DATA/jmrac/archivelog/2015_05_29/thread_2_seq_41.324.880972787 RECID=67 STAMP=880972787

archived log file name=+DATA/jmrac/archivelog/2015_05_29/thread_1_seq_31.322.880974595 RECID=68 STAMP=880974598

channel c1: finished piece 1 at 29-MAY-2015 11:16:23

piece handle=/home/oracle/rman_back/arch_JMRAC_20150529_11_1.bak tag=TAG20150529T111603 comment=NONE

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

channel c1: deleting archived log(s)

archived log file name=+DATA/jmrac/archivelog/2015_05_29/thread_2_seq_42.321.880974951 RECID=70 STAMP=880974952

archived log file name=+DATA/jmrac/archivelog/2015_05_29/thread_1_seq_32.323.880974951 RECID=69 STAMP=880974952

archived log file name=+DATA/jmrac/archivelog/2015_05_29/thread_1_seq_33.318.880974959 RECID=72 STAMP=880974959

archived log file name=+DATA/jmrac/archivelog/2015_05_29/thread_2_seq_43.320.880974953 RECID=71 STAMP=880974953

Finished backup at 29-MAY-2015 11:16:23

 

Starting backup at 29-MAY-2015 11:16:24

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 29-MAY-2015 11:16:25

channel c1: finished piece 1 at 29-MAY-2015 11:16:26

piece handle=/home/oracle/rman_back/ctl_JMRAC_20150529_12_1.bak tag=TAG20150529T111624 comment=NONE

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

Finished backup at 29-MAY-2015 11:16:26

 

released channel: c1

 

released channel: c2

 

RMAN>

 

RMAN> exit

 

 

Recovery Manager complete.

 

[oracle@node2 ~]$ cd rman_back/

[oracle@node2 rman_back]$ ll

total 1313928

-rw-r----- 1 oracle asmadmin  85005824 May 29 11:16 arch_JMRAC_20150529_10_1.bak

-rw-r----- 1 oracle asmadmin  14320128 May 29 11:16 arch_JMRAC_20150529_11_1.bak

-rw-r----- 1 oracle asmadmin  34693632 May 29 11:16 arch_JMRAC_20150529_9_1.bak

-rw-r----- 1 oracle asmadmin  18579456 May 29 11:16 ctl_JMRAC_20150529_12_1.bak

-rw-r----- 1 oracle asmadmin 648372224 May 29 11:15 full_JMRACxxx_20150529_880974780_5_1.bak

-rw-r----- 1 oracle asmadmin 524435456 May 29 11:15 full_JMRACxxx_20150529_880974780_6_1.bak

-rw-r----- 1 oracle asmadmin  18579456 May 29 11:15 full_JMRACxxx_20150529_880974935_7_1.bak

-rw-r----- 1 oracle asmadmin     98304 May 29 11:15 full_JMRACxxx_20150529_880974935_8_1.bak

-rw-r--r-- 1 oracle asmadmin      1371 May 29 11:08 initjmrac.ora

[oracle@node2 rman_back]$

[oracle@node2 rman_back]$ ll -h

total 1.3G

-rw-r----- 1 oracle asmadmin  82M May 29 11:16 arch_JMRAC_20150529_10_1.bak

-rw-r----- 1 oracle asmadmin  14M May 29 11:16 arch_JMRAC_20150529_11_1.bak

-rw-r----- 1 oracle asmadmin  34M May 29 11:16 arch_JMRAC_20150529_9_1.bak

-rw-r----- 1 oracle asmadmin  18M May 29 11:16 ctl_JMRAC_20150529_12_1.bak

-rw-r----- 1 oracle asmadmin 619M May 29 11:15 full_JMRACxxx_20150529_880974780_5_1.bak

-rw-r----- 1 oracle asmadmin 501M May 29 11:15 full_JMRACxxx_20150529_880974780_6_1.bak

-rw-r----- 1 oracle asmadmin  18M May 29 11:15 full_JMRACxxx_20150529_880974935_7_1.bak

-rw-r----- 1 oracle asmadmin  96K May 29 11:15 full_JMRACxxx_20150529_880974935_8_1.bak

-rw-r--r-- 1 oracle asmadmin 1.4K May 29 11:08 initjmrac.ora

[oracle@node2 rman_back]$  

  1.3.2.4    将备份传递到 target 库

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

源库:

[oracle@node2 rman_back]$  scp -r /home/oracle/rman_back  oracle@192.168.59.129:/home/oracle

ssh: connect to host 192.168.59.129 port 22: Network is unreachable

lost connection

 

 

由于source db 的IP为192.168.1.32,而目标库的IP为192.168.59.129,不在同一个网段,所以我对目标库再添加一块网卡,所以目标库的IP 配置如下:

 

目标库再添加一块网卡后:

[oracle@orcltest ~]$ ifconfig

eth0      Link encap:Ethernet  HWaddr 00:0C:29:E7:E6:B0 

          inet addr:192.168.59.129  Bcast:192.168.59.255  Mask:255.255.255.0

          inet6 addr: fe80::20c:29ff:fee7:e6b0/64 Scope:Link

          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1

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

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

          collisions:0 txqueuelen:1000

          RX bytes:17969 (17.5 KiB)  TX bytes:17510 (17.0 KiB)

 

eth2      Link encap:Ethernet  HWaddr 00:0C:29:E7:E6:A6 

          inet addr: 192.168.1.128   Bcast:192.168.1.255  Mask:255.255.255.0

          inet6 addr: fe80::20c:29ff:fee7:e6a6/64 Scope:Link

          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1

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

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

          collisions:0 txqueuelen:1000

          RX bytes:746 (746.0 b)  TX bytes:1152 (1.1 KiB)

 

lo        Link encap:Local Loopback 

          inet addr:127.0.0.1  Mask:255.0.0.0

          inet6 addr: ::1/128 Scope:Host

          UP LOOPBACK RUNNING  MTU:16436  Metric:1

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

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

          collisions:0 txqueuelen:0

          RX bytes:354142 (345.8 KiB)  TX bytes:354142 (345.8 KiB)

 

 

源库scp 操作:

[oracle@node2 rman_back]$  scp -r /home/oracle/rman_back  oracle@192.168.1.128:/home/oracle

The authenticity of host '192.168.1.128 (192.168.1.128)' can't be established.

RSA key fingerprint is 77:e6:11:1a:7c:c7:81:7c:88:c9:21:18:51:2a:84:d1.

Are you sure you want to continue connecting (yes/no)? yes

Warning: Permanently added '192.168.1.128' (RSA) to the list of known hosts.

oracle@192.168.1.128's password:

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

arch_JMRAC_20150529_10_1.bak                                                                                                                                                    100%   81MB  27.0MB/s   00:03   

arch_JMRAC_20150529_9_1.bak                                                                                                                                                     100%   33MB  16.5MB/s   00:02   

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

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

initjmrac.ora                                                                                                                                                                   100% 1371     1.3KB/s   00:00   

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

arch_JMRAC_20150529_11_1.bak                                                                                                                                                    100%   14MB   3.4MB/s   00:04   

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

[oracle@node2 rman_back]$

 

 

目标库查看结果:

 

[oracle@orcltest rman_back]$ ll -h

total 1.3G

-rw-r----- 1 oracle oinstall  82M May 29 12:26 arch_JMRAC_20150529_10_1.bak

-rw-r----- 1 oracle oinstall  14M May 29 12:28 arch_JMRAC_20150529_11_1.bak

-rw-r----- 1 oracle oinstall  34M May 29 12:26 arch_JMRAC_20150529_9_1.bak

-rw-r----- 1 oracle oinstall  18M May 29 12:26 ctl_JMRAC_20150529_12_1.bak

-rw-r----- 1 oracle oinstall 619M May 29 12:27 full_JMRACxxx_20150529_880974780_5_1.bak

-rw-r----- 1 oracle oinstall 501M May 29 12:28 full_JMRACxxx_20150529_880974780_6_1.bak

-rw-r----- 1 oracle oinstall  18M May 29 12:26 full_JMRACxxx_20150529_880974935_7_1.bak

-rw-r----- 1 oracle oinstall  96K May 29 12:28 full_JMRACxxx_20150529_880974935_8_1.bak

-rw-r--r-- 1 oracle oinstall 1.4K May 29 12:27 initjmrac.ora

[oracle@orcltest rman_back]$

 

 

至此,源库rac 上需要操作的内容已完成。  

1.3.3    target 库上执行

1.3.3.1    修改 pfile 文件生成 spfile 文件、生成 pfile 中的文件路径

主要有两方面的修改:

?  修改含文件路径的参数,达到符合当前服务器环境的实际情况 ,如audit_file_dest,control_files,db_recovery_file_dest

?  修改多实例相关的参数 ,如  cluster_database,带有实例名的前缀  

源pfile 文件内容:

[oracle@orcltest rman_back]$  cp initjmrac.ora initjmrac.ora_bk

[oracle@orcltest rman_back]$ more initjmrac.ora _bk  

jmrac1.__db_cache_size=16777216

jmrac2.__db_cache_size=16777216

jmrac1.__java_pool_size=4194304

jmrac2.__java_pool_size=4194304

jmrac1.__large_pool_size=4194304

jmrac2.__large_pool_size=4194304

jmrac1.__pga_aggregate_target=209715200

jmrac2.__pga_aggregate_target=209715200

jmrac1.__sga_target=314572800

jmrac2.__sga_target=314572800

jmrac1.__shared_io_pool_size=0

jmrac2.__shared_io_pool_size=0

jmrac1.__shared_pool_size=281018368

jmrac2.__shared_pool_size=281018368

jmrac1.__streams_pool_size=0

jmrac2.__streams_pool_size=0

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

*.audit_trail='db'

*.cluster_database=true

*.compatible='11.2.0.0.0'

*.control_files='+DATA/jmrac/controlfile/current.273.877470341','+DATA/jmrac/controlfile/current.272.877470343'

*.db_block_size=8192


当前文章:将RAC备份集恢复为单实例数据库
URL链接:http://myzitong.com/article/pgcosp.html