单实例恢复至RAC

环境介绍
单实例                                      RAC数据库
OEL+Oracle 11.2.0.3               OEL+Oracle 11.2.0.3
1、备份单实例数据库
run {
backup as compressed backupset filesperset 2 database format '/home/oracle/db_full_%d_%T_%s.bak';
sql 'alter system archive log current';
backup as compressed backupset archivelog all format '/home/oracle/arch_%d_%T_%s.bak';
backup current controlfile format '/home/oracle/ctl_%d_%T_%s.bak';
}
2、准备初始化参数文件
jzh1.__db_cache_size=520093696
jzh2.__db_cache_size=520093696
jzh1.__java_pool_size=16777216
jzh2.__java_pool_size=16777216
jzh1.__large_pool_size=16777216
jzh2.__large_pool_size=16777216
jzh1.__pga_aggregate_target=587202560
jzh2.__pga_aggregate_target=587202560
jzh1.__sga_target=855638016
jzh2.__sga_target=855638016
jzh1.__shared_io_pool_size=0
jzh2.__shared_io_pool_size=0
jzh1.__shared_pool_size=285212672
jzh2.__shared_pool_size=285212672
jzh1.__streams_pool_size=0
jzh2.__streams_pool_size=0
*.audit_file_dest='/u01/app/oracle/admin/jzh/adump'
*.audit_trail='db'
*.cluster_database=true
*.compatible='11.2.0.0.0'
*.control_files='+DATA/jzh/controlfile/current.272.879168089','+ARCH/jzh/controlfile/current.258.879168089'
*.db_block_size=8192
*.db_create_file_dest='+DATA'
*.db_domain=''
*.db_name='jzh'
*.db_recovery_file_dest='+ARCH'
*.db_recovery_file_dest_size=6005194752
*.diagnostic_dest='/u01/app/oracle'
*.dispatchers='(PROTOCOL=TCP) (SERVICE=jzhXDB)'
jzh1.instance_number=1
jzh2.instance_number=2
*.log_archive_dest_1='LOCATION=+ARCH'
*.log_archive_format='%t_%s_%r.arc'
*.memory_target=1438646272
*.open_cursors=300
*.processes=150
*.remote_listener='192.168.1.206:1521'
*.remote_login_passwordfile='exclusive'
jzh2.thread=2
jzh1.thread=1
jzh2.undo_tablespace='UNDOTBS2'
jzh1.undo_tablespace='UNDOTBS1'
3、启动数据库到nomount状态
[oracle@jzh1 dbs]$ sqlplus / as sysdba
SQL*Plus: Release 11.2.0.3.0 Production on Thu May 7 16:10:23 2015
Copyright (c) 1982, 2011, Oracle.  All rights reserved.
Connected to an idle instance.
[oracle@jzh1 tmp]$ sqlplus / as sysdba
SQL*Plus: Release 11.2.0.3.0 Production on Fri May 8 14:43:54 2015
Copyright (c) 1982, 2011, Oracle.  All rights reserved.
Connected to an idle instance.
SQL> startup nomount pfile='/tmp/initjzh.ora';
ORACLE instance started.
Total System Global Area 1436389376 bytes
Fixed Size                  2228384 bytes
Variable Size             905973600 bytes
Database Buffers          520093696 bytes
Redo Buffers                8093696 bytes
4、恢复控制文件
[oracle@jzh1 ~]$ rman target /
Recovery Manager: Release 11.2.0.3.0 - Production on Thu May 7 16:12:40 2015
Copyright (c) 1982, 2011, Oracle and/or its affiliates.  All rights reserved.
connected to target database: JZH (not mounted)
RMAN> restore controlfile from '/home/oracle/ctl_JZH_20150507_26.bak';
Starting restore at 07-MAY-15
using target database control file instead of recovery catalog
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=144 instance=jzh1 device type=DISK
channel ORA_DISK_1: restoring control file
channel ORA_DISK_1: restore complete, elapsed time: 00:00:03
output file name=+DATA/jzh/controlfile/control01.ctl
output file name=+ARCH/jzh/controlfile/control02.ctl
Finished restore at 07-MAY-15
5、启动数据库至mount状态开始恢复
[oracle@jzh1 ~]$ sqlplus / as sysdba
SQL*Plus: Release 11.2.0.3.0 Production on Thu May 7 16:18:27 2015
Copyright (c) 1982, 2011, Oracle.  All rights reserved.
Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production
With the Partitioning, Real Application Clusters, OLAP, Data Mining
and Real Application Testing options
SQL> alter database mount;
Database altered.
[oracle@jzh1 ~]$ rman target /
Recovery Manager: Release 11.2.0.3.0 - Production on Thu May 7 16:19:16 2015
Copyright (c) 1982, 2011, Oracle and/or its affiliates.  All rights reserved.
connected to target database: JZH (DBID=233255254, not open)
RMAN> run {
2> set newname for database to '+DATA';
3> restore database;
4> switch datafile all;
5> catalog backuppiece '/home/oracle/arch_JZH_20150507_25.bak';
6> }
executing command: SET NEWNAME
Starting restore at 07-MAY-15
Starting implicit crosscheck backup at 07-MAY-15
allocated channel: ORA_DISK_1
Crosschecked 23 objects
Finished implicit crosscheck backup at 07-MAY-15
Starting implicit crosscheck copy at 07-MAY-15
using channel ORA_DISK_1
Finished implicit crosscheck copy at 07-MAY-15
searching for all files in the recovery area
cataloging files...
no files cataloged
using channel ORA_DISK_1
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 +DATA
channel ORA_DISK_1: restoring datafile 00002 to +DATA
channel ORA_DISK_1: reading from backup piece /home/oracle/db_full_JZH_20150507_22.bak
channel ORA_DISK_1: piece handle=/home/oracle/db_full_JZH_20150507_22.bak tag=TAG20150507T151036
channel ORA_DISK_1: restored backup piece 1
channel ORA_DISK_1: restore complete, elapsed time: 00:00:55
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 00003 to +DATA
channel ORA_DISK_1: restoring datafile 00004 to +DATA
channel ORA_DISK_1: reading from backup piece /home/oracle/db_full_JZH_20150507_23.bak
channel ORA_DISK_1: piece handle=/home/oracle/db_full_JZH_20150507_23.bak tag=TAG20150507T151036
channel ORA_DISK_1: restored backup piece 1
channel ORA_DISK_1: restore complete, elapsed time: 00:00:45
Finished restore at 07-MAY-15
datafile 1 switched to datafile copy
input datafile copy RECID=5 STAMP=879094330 file name=+DATA/jzh/datafile/system.267.879094229
datafile 2 switched to datafile copy
input datafile copy RECID=6 STAMP=879094331 file name=+DATA/jzh/datafile/sysaux.262.879094229
datafile 3 switched to datafile copy
input datafile copy RECID=7 STAMP=879094331 file name=+DATA/jzh/datafile/undotbs1.260.879094285
datafile 4 switched to datafile copy
input datafile copy RECID=8 STAMP=879094331 file name=+DATA/jzh/datafile/users.256.879094285
cataloged backup piece
backup piece handle=/home/oracle/arch_JZH_20150507_25.bak RECID=24 STAMP=879094331
SQL> recover database using backup controlfile until cancel;
ORA-00279: change 967172 generated at 05/07/2015 15:10:36 needed for thread 1
ORA-00289: suggestion :
/u01/app/oracle/fast_recovery_area/JZH/archivelog/2015_05_07/o1_mf_1_128_bnp44s6
7_.arc
ORA-00280: change 967172 for thread 1 is in sequence #128

Specify log: {=suggested | filename | AUTO | CANCEL}
AUTO 
ORA-00308: cannot open archived log
'/u01/app/oracle/fast_recovery_area/JZH/archivelog/2015_05_07/o1_mf_1_128_bnp44s
67_.arc'
ORA-27037: unable to obtain file status
Linux-x86_64 Error: 2: No such file or directory
Additional information: 3
ORA-00308: cannot open archived log
'/u01/app/oracle/fast_recovery_area/JZH/archivelog/2015_05_07/o1_mf_1_128_bnp44s
67_.arc'
ORA-27037: unable to obtain file status
Linux-x86_64 Error: 2: No such file or directory
Additional information: 3
ORA-01547: warning: RECOVER succeeded but OPEN RESETLOGS would get error below
ORA-01152: file 3 was not restored from a sufficiently old backup
ORA-01110: data file 3: '+DATA/jzh/datafile/undotbs1.260.879094285'
6、rename重做日志
SQL> select group#,member from v$logfile;
    GROUP# MEMBER
---------- ----------------------------------------
         1 /u01/app/oracle/oradata/jzh/redo01.log
         2 /u01/app/oracle/oradata/jzh/redo02.log
         3 /u01/app/oracle/oradata/jzh/redo03.log
SQL> alter database rename file '/u01/app/oracle/oradata/jzh/redo01.log' to '+DATA';
Database altered
SQL> alter database rename file '/u01/app/oracle/oradata/jzh/redo02.log' to '+DATA';
Database altered.
SQL> alter database rename file '/u01/app/oracle/oradata/jzh/redo03.log' to '+DATA';
Database altered.
SQL> alter database open resetlogs;
alter database open resetlogs
*
ERROR at line 1:
ORA-01152: file 3 was not restored from a sufficiently old backup
ORA-01110: data file 3: '+DATA/jzh/datafile/undotbs1.262.879173283'
SQL> alter database datafile 3 offline;
Database altered.
SQL> alter database datafile 4 offline;
Database altered.
7、以resetlogs打开数据库
SQL> alter database open resetlogs;
Database altered.
SQL> alter database drop logfile group 3;
Database altered.
SQL> alter database add logfile thread 1 group 3 ('+DATA','+ARCH') size 50M;
Database altered.
SQL> alter database drop logfile group 2;
Database altered.
SQL> alter database add logfile thread 2 group 2 ('+DATA','+ARCH') size 50M;
Database altered.
SQL> alter database add logfile thread 2 group 4 ('+DATA','+ARCH') size 50M;
Database altered.
SQL> select group#,member from v$logfile order by group#;
    GROUP# MEMBER
---------- ------------------------------------------------------------
         1 +DATA/jzh/onlinelog/group_1.264.879173771
         1 +ARCH/jzh/onlinelog/group_1.261.879173773
         2 +ARCH/jzh/onlinelog/group_2.271.879174165
         2 +DATA/jzh/onlinelog/group_2.273.879174165
         3 +DATA/jzh/onlinelog/group_3.256.879174125
         3 +ARCH/jzh/onlinelog/group_3.260.879174125
         4 +ARCH/jzh/onlinelog/group_4.259.879174203
         4 +DATA/jzh/onlinelog/group_4.276.879174201
8 rows selected.
8、启用thread 2
SQL> alter database enable public thread 2;
Database altered.
SQL> create undo tablespace undotbs2 datafile '+DATA' size 2048M;
Tablespace created.
9、执行脚本
@?/rdbms/admin/catclust.sql
SQL> create spfile='+DATA' from pfile='/tmp/initjzh.ora';
File created.
SQL> show parameter pfile
NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
spfile                               string      +DATA/jzh/parameterfile/spfile
                                                 .270.879175181
SQL> select * from v$active_instances;
INST_NUMBER INST_NAME
----------- ------------------------------
          1 jzh1.oracle.com:jzh1
          2 jzh2.oracle.com:jzh2
10、添加db,instance至crs
[oracle@jzh1 ~]$ srvctl add database -d jzh -o /u01/app/oracle/product/11.2.0/db_1/
[grid@jzh1 ~]$ srvctl add instance -d jzh -n jzh1 -i jzh1
[grid@jzh1 ~]$ srvctl add instance -d jzh -n jzh2 -i jzh2
[grid@jzh1 ~]$ crs_stat -t -v
Name           Type           R/RA   F/FT   Target    State     Host        
----------------------------------------------------------------------
ora.ARCH.dg    ora....up.type 0/5    0/     ONLINE    ONLINE    jzh1        
ora.DATA.dg    ora....up.type 0/5    0/     ONLINE    ONLINE    jzh1        
ora....ER.lsnr ora....er.type 0/5    0/     ONLINE    ONLINE    jzh1        
ora....N1.lsnr ora....er.type 0/5    0/0    ONLINE    ONLINE    jzh2        
ora.VOTE.dg    ora....up.type 0/5    0/     ONLINE    ONLINE    jzh1        
ora.asm        ora.asm.type   0/5    0/     ONLINE    ONLINE    jzh1        
ora.cvu        ora.cvu.type   0/5    0/0    OFFLINE   OFFLINE               
ora.gsd        ora.gsd.type   0/5    0/     OFFLINE   OFFLINE               
ora.jzh.db     ora....se.type 0/2    0/1    ONLINE    ONLINE    jzh1        
ora....SM1.asm application    0/5    0/0    ONLINE    ONLINE    jzh1        
ora....H1.lsnr application    0/5    0/0    ONLINE    ONLINE    jzh1        
ora.jzh1.gsd   application    0/5    0/0    OFFLINE   OFFLINE               
ora.jzh1.ons   application    0/3    0/0    ONLINE    ONLINE    jzh1        
ora.jzh1.vip   ora....t1.type 0/0    0/0    ONLINE    ONLINE    jzh1        
ora....SM2.asm application    0/5    0/0    ONLINE    ONLINE    jzh2        
ora....H2.lsnr application    0/5    0/0    ONLINE    ONLINE    jzh2        
ora.jzh2.gsd   application    0/5    0/0    OFFLINE   OFFLINE               
ora.jzh2.ons   application    0/3    0/0    ONLINE    ONLINE    jzh2        
ora.jzh2.vip   ora....t1.type 0/0    0/0    ONLINE    ONLINE    jzh2        
ora....network ora....rk.type 0/5    0/     ONLINE    ONLINE    jzh1        
ora.oc4j       ora.oc4j.type  0/1    0/2    ONLINE    ONLINE    jzh2        
ora.ons        ora.ons.type   0/3    0/     ONLINE    ONLINE    jzh1        
ora.scan1.vip  ora....ip.type 0/0    0/0    ONLINE    ONLINE    jzh2   
















来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/10271187/viewspace-1630726/,如需转载,请注明出处,否则将追究法律责任。

转载于:http://blog.itpub.net/10271187/viewspace-1630726/

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值