【实验】Oracle 10g RAC生产数据库RMAN方式恢复到异地单机数据库全程记录

【前言】这是一个RMAN备份有效性验证的过程。

源端环境介绍:
生产数据库是包含两个节点的Oracle 10g 10.2.0.3 RAC数据库:
ASM管理+裸设备
数据库名:racdb
第一节点的sid:racdb1
第一节点的sid:racdb2

异地单机数据库(恢复Server)介绍:
单机
单实例
低配


下面将详细记录整个从RAC到单机的详细恢复过程。

【实验BEGIN】
1.将源端的RMAN备份的所有文件拷贝到恢复Server上
脚本如下,注意这里使用了一个保证scp不会中断的小技巧(sleep)
racdb1@testdb183 /orabak$ cat scp.sh
nohup scp -r oracle@172.193.192.26:/orabak/* /orabak &
sleep 10

2.修改源端生成的pfile文件,去掉与RAC有关的内容。
将ASM格式的文件路径统统的修改成为文件系统路径的格式。
修改之前的pfile:
racdb1@testdb183 /oracle$ cat initracdb1.ora_backup_origin
racdb2.__db_cache_size=6543114240
racdb1.__db_cache_size=6056574976
racdb1.__java_pool_size=16777216
racdb2.__java_pool_size=16777216
racdb1.__large_pool_size=16777216
racdb2.__large_pool_size=16777216
racdb2.__shared_pool_size=1795162112
racdb1.__shared_pool_size=2281701376
racdb1.__streams_pool_size=0
racdb2.__streams_pool_size=0
*.audit_file_dest='/oracle/app/oracle/admin/racdb/adump'
*.background_dump_dest='/oracle/app/oracle/admin/racdb/bdump'
*.cluster_database_instances=2
*.cluster_database=true
*.compatible='10.2.0.3.0'
*.control_files='+ORADATA/racdb/controlfile/current.256.668538019'
*.core_dump_dest='/oracle/app/oracle/admin/racdb/cdump'
*.db_block_size=8192
*.db_create_file_dest='+ORADATA'
*.db_domain=''
*.db_file_multiblock_read_count=16
*.db_name='racdb'
racdb2.instance_number=2
racdb1.instance_number=1
*.wbj_queue_processes=10
*.local_listener='local_listener_rac'
*.log_archive_dest_1='LOCATION=+ORADATA/racdb/'
*.log_archive_format='%t_%s_%r.arch'
*.open_cursors=300
*.pga_aggregate_target=2088763392
*.processes=800
*.remote_listener='LISTENERS_racdb'
*.remote_login_passwordfile='exclusive'
*.sessions=885
*.sga_max_size=5242880000
racdb1.sga_max_size=8388608000
racdb2.sga_max_size=8388608000
*.sga_target=1610612736
racdb1.sga_target=8388608000
racdb2.sga_target=8388608000
racdb2.thread=2
racdb1.thread=1
*.undo_management='AUTO'
racdb2.undo_tablespace='UNDOTBS2'
racdb1.undo_tablespace='UNDOTBS1'
*.user_dump_dest='/oracle/app/oracle/admin/racdb/udump'

修改之后的pfile:
racdb1@testdb183 /oracle$ cat initracdb1.ora
*.audit_file_dest='/oracle/app/oracle/admin/racdb/adump'
*.background_dump_dest='/oracle/app/oracle/admin/racdb/bdump'
*.compatible='10.2.0.3.0'
*.control_files='/oracle/oradata/racdb/control01.ctl'
*.core_dump_dest='/oracle/app/oracle/admin/racdb/cdump'
*.db_block_size=8192
*.db_domain=''
*.db_file_multiblock_read_count=16
*.db_name='racdb'
*.wbj_queue_processes=10
*.log_archive_format='%t_%s_%r.arch'
*.open_cursors=300
*.pga_aggregate_target=2088763392
*.processes=800
*.remote_login_passwordfile='exclusive'
*.sessions=885
*.sga_max_size=524288000
*.sga_target=161061273
*.undo_management='AUTO'
*.undo_tablespace='UNDOTBS1'
*.user_dump_dest='/oracle/app/oracle/admin/racdb/udump'

3.根据上面参数文件内容,在恢复Server上创建确实的目录
$ mkdir -p /oracle/app/oracle/admin/racdb/cdump
$ mkdir -p /oracle/app/oracle/admin/racdb/udump
$ mkdir -p /oracle/app/oracle/admin/racdb/adump
$ mkdir -p /oracle/app/oracle/admin/racdb/bdump


4.登陆恢复端Server的RMAN命令行,设置成设置成生产RAC第一节点的dbid(这个需要提前确认好)
racdb1@testdb183 /oracle$ rman target /

Recovery Manager: Release 10.2.0.3.0 - Production on Mon Aug 24 20:32:13 2009

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

connected to target database (not started)

RMAN> set dbid 3914926878

executing command: SET DBID

5.使用新pfile启动实例到nomount状态
RMAN> startup nomount pfile='/oracle/app/oracle/product/10.2.0/db_1/dbs/initracdb1.ora'

Oracle instance started

Total System Global Area     524288000 bytes

Fixed Size                     2074048 bytes
Variable Size                478153280 bytes
Database Buffers              37748736 bytes
Redo Buffers                   6311936 bytes


6.找到RMAN中控制文件的的备份,恢复控制文件      
RMAN> restore controlfile from '/orabak/week1/Saturday/c-3914926878-20090822-00';

Starting restore at 2009-08-24 20:33:59
using channel ORA_DISK_1

channel ORA_DISK_1: restoring control file
channel ORA_DISK_1: restore complete, elapsed time: 00:00:02
output filename=/oracle/oradata/racdb/control01.ctl
Finished restore at 2009-08-24 20:34:01

7.恢复完控制文件之后,启动数据库到mount状态
RMAN> alter database mount;

database mounted
released channel: ORA_DISK_1

8.根据生产数据库对应的文件目录,将其修改到恢复Server的文件路径
需要到生产库确定各个数据文件的信息
SQL> select name from v$datafile;

run  {
set newname for datafile'+ORADATA/racdb/datafile/smms.321.668623735' to '/oracle/oradata/racdb/smms.321.668623735';
set newname for datafile'+ORADATA/racdb/datafile/smmsdb.364.676804261' to '/oracle/oradata/racdb/smmsdb.364.676804261';
set newname for datafile'+ORADATA/racdb/datafile/gosd.329.668687127' to '/oracle/oradata/racdb/gosd.329.668687127';
set newname for datafile'+ORADATA/racdb/datafile/gosd.536.670002437' to '/oracle/oradata/racdb/gosd.536.670002437';
set newname for datafile'+ORADATA/racdb/datafile/gosdidx.333.668687233' to '/oracle/oradata/racdb/gosdidx.333.668687233';
set newname for datafile'+ORADATA/racdb/datafile/psdb_auib.283.676742737' to '/oracle/oradata/racdb/psdb_auib.283.676742737';
set newname for datafile'+ORADATA/racdb/datafile/psdb_smob_d.718.670098771' to '/oracle/oradata/racdb/psdb_smob_d.718.670098771';
set newname for datafile'+ORADATA/racdb/datafile/psdb_smob_d.284.670413675' to '/oracle/oradata/racdb/psdb_smob_d.284.670413675';
set newname for datafile'+ORADATA/racdb/datafile/psdb_smob_i.375.670413705' to '/oracle/oradata/racdb/psdb_smob_i.375.670413705';
set newname for datafile'+ORADATA/racdb/datafile/psdb_smob_i.666.670098753' to '/oracle/oradata/racdb/psdb_smob_i.666.670098753';
set newname for datafile'+ORADATA/racdb/datafile/psdb_odes.538.676804437' to '/oracle/oradata/racdb/psdb_odes.538.676804437';
set newname for datafile'+ORADATA/racdb/datafile/psdb_isn_d.409.676742365' to '/oracle/oradata/racdb/psdb_isn_d.409.676742365';
set newname for datafile'+ORADATA/racdb/datafile/psdb_isn_i.410.676742405' to '/oracle/oradata/racdb/psdb_isn_i.410.676742405';
set newname for datafile'+ORADATA/racdb/datafile/psdb_iise_d.301.668682663' to '/oracle/oradata/racdb/psdb_iise_d.301.668682663';
set newname for datafile'+ORADATA/racdb/datafile/psdb_iise_i.303.668682685' to '/oracle/oradata/racdb/psdb_iise_i.303.668682685';
set newname for datafile'+ORADATA/racdb/datafile/psdb_wbj_d.729.670098811' to '/oracle/oradata/racdb/psdb_wbj_d.729.670098811';
set newname for datafile'+ORADATA/racdb/datafile/psdb_wbj_i.652.670098831' to '/oracle/oradata/racdb/psdb_wbj_i.652.670098831';
set newname for datafile'+ORADATA/racdb/datafile/wbj.337.668615843' to '/oracle/oradata/racdb/wbj.337.668615843';
set newname for datafile'+ORADATA/racdb/datafile/perfstat.340.668616315' to '/oracle/oradata/racdb/perfstat.340.668616315';
set newname for datafile'+ORADATA/racdb/datafile/perfstat.626.670860931' to '/oracle/oradata/racdb/perfstat.626.670860931';
set newname for datafile'+ORADATA/racdb/datafile/sec.365.670416195' to '/oracle/oradata/racdb/sec.365.670416195';
set newname for datafile'+ORADATA/racdb/datafile/sec.280.668540851' to '/oracle/oradata/racdb/sec.280.668540851';
set newname for datafile'+ORADATA/racdb/datafile/sec_idx.282.668540885' to '/oracle/oradata/racdb/sec_idx.282.668540885';
set newname for datafile'+ORADATA/racdb/datafile/sysaux.263.668538117' to '/oracle/oradata/racdb/sysaux.263.668538117';
set newname for datafile'+ORADATA/racdb/datafile/system.261.668538061' to '/oracle/oradata/racdb/system.261.668538061';
set newname for datafile'+ORADATA/racdb/datafile/undotbs1.551.670001545' to '/oracle/oradata/racdb/undotbs1.551.670001545';
set newname for datafile'+ORADATA/racdb/datafile/undotbs1.594.670001207' to '/oracle/oradata/racdb/undotbs1.594.670001207';
set newname for datafile'+ORADATA/racdb/datafile/undotbs1.262.668538095' to '/oracle/oradata/racdb/undotbs1.262.668538095';
set newname for datafile'+ORADATA/racdb/datafile/undotbs2.544.670001557' to '/oracle/oradata/racdb/undotbs2.544.670001557';
set newname for datafile'+ORADATA/racdb/datafile/undotbs2.265.668538137' to '/oracle/oradata/racdb/undotbs2.265.668538137';
set newname for datafile'+ORADATA/racdb/datafile/undotbs2.562.670001221' to '/oracle/oradata/racdb/undotbs2.562.670001221';
set newname for datafile'+ORADATA/racdb/datafile/users.266.668538159' to '/oracle/oradata/racdb/users.266.668538159';
restore database ;
switch datafile all;
}

executing command: SET NEWNAME

executing command: SET NEWNAME

executing command: SET NEWNAME

executing command: SET NEWNAME

executing command: SET NEWNAME

executing command: SET NEWNAME

executing command: SET NEWNAME

executing command: SET NEWNAME

executing command: SET NEWNAME

executing command: SET NEWNAME

executing command: SET NEWNAME

executing command: SET NEWNAME

executing command: SET NEWNAME

executing command: SET NEWNAME

executing command: SET NEWNAME

executing command: SET NEWNAME

executing command: SET NEWNAME

executing command: SET NEWNAME

executing command: SET NEWNAME

executing command: SET NEWNAME

executing command: SET NEWNAME

executing command: SET NEWNAME

executing command: SET NEWNAME

executing command: SET NEWNAME

executing command: SET NEWNAME

executing command: SET NEWNAME

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 2009-08-24 20:40:25
allocated channel: ORA_DISK_1
channel ORA_DISK_1: sid=872 devtype=DISK

channel ORA_DISK_1: starting datafile backupset restore
channel ORA_DISK_1: specifying datafile(s) to restore from backup set
restoring datafile 00004 to /oracle/oradata/racdb/undotbs2.265.668538137
restoring datafile 00008 to /oracle/oradata/racdb/sec_idx.282.668540885
restoring datafile 00021 to /oracle/oradata/racdb/smmsdb.364.676804261
restoring datafile 00024 to /oracle/oradata/racdb/undotbs1.594.670001207
channel ORA_DISK_1: reading from backup piece /orabak/week1/Sunday/e1kms2ce_1_1_4545.bak
channel ORA_DISK_1: restored backup piece 1
piece handle=/orabak/week1/Sunday/e1kms2ce_1_1_4545.bak tag=DB0
channel ORA_DISK_1: restore complete, elapsed time: 00:01:06
channel ORA_DISK_1: starting datafile backupset restore
channel ORA_DISK_1: specifying datafile(s) to restore from backup set
restoring datafile 00001 to /oracle/oradata/racdb/system.261.668538061
restoring datafile 00006 to /oracle/oradata/racdb/sec.280.668540851
restoring datafile 00025 to /oracle/oradata/racdb/undotbs2.562.670001221
restoring datafile 00032 to /oracle/oradata/racdb/psdb_wbj_d.729.670098811
channel ORA_DISK_1: reading from backup piece /orabak/week1/Sunday/e2kms2ct_1_1_4546.bak
channel ORA_DISK_1: restored backup piece 1
piece handle=/orabak/week1/Sunday/e2kms2ct_1_1_4546.bak tag=DB0
channel ORA_DISK_1: restore complete, elapsed time: 00:01:15
channel ORA_DISK_1: starting datafile backupset restore
channel ORA_DISK_1: specifying datafile(s) to restore from backup set
restoring datafile 00002 to /oracle/oradata/racdb/undotbs1.262.668538095
restoring datafile 00014 to /oracle/oradata/racdb/smms.321.668623735
restoring datafile 00018 to /oracle/oradata/racdb/gosdidx.333.668687233
restoring datafile 00020 to /oracle/oradata/racdb/sec.365.670416195
channel ORA_DISK_1: reading from backup piece /orabak/week1/Sunday/dvkms2ce_1_1_4543.bak
channel ORA_DISK_1: restored backup piece 1
piece handle=/orabak/week1/Sunday/dvkms2ce_1_1_4543.bak tag=DB0
channel ORA_DISK_1: reading from backup piece /orabak/week1/Sunday/dvkms2ce_2_1_4543.bak
channel ORA_DISK_1: restored backup piece 2
piece handle=/orabak/week1/Sunday/dvkms2ce_2_1_4543.bak tag=DB0
channel ORA_DISK_1: restore complete, elapsed time: 00:01:40
channel ORA_DISK_1: starting datafile backupset restore
channel ORA_DISK_1: specifying datafile(s) to restore from backup set
restoring datafile 00007 to /oracle/oradata/racdb/psdb_isn_d.409.676742365
restoring datafile 00011 to /oracle/oradata/racdb/psdb_smob_i.375.670413705
restoring datafile 00019 to /oracle/oradata/racdb/psdb_auib.283.676742737
restoring datafile 00030 to /oracle/oradata/racdb/psdb_smob_i.666.670098753
channel ORA_DISK_1: reading from backup piece /orabak/week1/Sunday/e0kms2ce_1_1_4544.bak
channel ORA_DISK_1: restored backup piece 1
piece handle=/orabak/week1/Sunday/e0kms2ce_1_1_4544.bak tag=DB0
channel ORA_DISK_1: reading from backup piece /orabak/week1/Sunday/e0kms2ce_2_1_4544.bak
channel ORA_DISK_1: restored backup piece 2
piece handle=/orabak/week1/Sunday/e0kms2ce_2_1_4544.bak tag=DB0
channel ORA_DISK_1: restore complete, elapsed time: 00:01:50
channel ORA_DISK_1: starting datafile backupset restore
channel ORA_DISK_1: specifying datafile(s) to restore from backup set
restoring datafile 00005 to /oracle/oradata/racdb/users.266.668538159
restoring datafile 00013 to /oracle/oradata/racdb/perfstat.340.668616315
restoring datafile 00026 to /oracle/oradata/racdb/undotbs1.551.670001545
restoring datafile 00034 to /oracle/oradata/racdb/perfstat.626.670860931
channel ORA_DISK_1: reading from backup piece /orabak/week1/Sunday/e5kms2ep_1_1_4549.bak
channel ORA_DISK_1: restored backup piece 1
piece handle=/orabak/week1/Sunday/e5kms2ep_1_1_4549.bak tag=DB0
channel ORA_DISK_1: restore complete, elapsed time: 00:00:46
channel ORA_DISK_1: starting datafile backupset restore
channel ORA_DISK_1: specifying datafile(s) to restore from backup set
restoring datafile 00009 to /oracle/oradata/racdb/psdb_isn_i.410.676742405
restoring datafile 00010 to /oracle/oradata/racdb/psdb_smob_d.284.670413675
restoring datafile 00028 to /oracle/oradata/racdb/gosd.536.670002437
restoring datafile 00033 to /oracle/oradata/racdb/psdb_wbj_i.652.670098831
channel ORA_DISK_1: reading from backup piece /orabak/week1/Sunday/e3kms2e8_1_1_4547.bak
channel ORA_DISK_1: restored backup piece 1
piece handle=/orabak/week1/Sunday/e3kms2e8_1_1_4547.bak tag=DB0
channel ORA_DISK_1: reading from backup piece /orabak/week1/Sunday/e3kms2e8_2_1_4547.bak
channel ORA_DISK_1: restored backup piece 2
piece handle=/orabak/week1/Sunday/e3kms2e8_2_1_4547.bak tag=DB0
channel ORA_DISK_1: restore complete, elapsed time: 00:01:23
channel ORA_DISK_1: starting datafile backupset restore
channel ORA_DISK_1: specifying datafile(s) to restore from backup set
restoring datafile 00003 to /oracle/oradata/racdb/sysaux.263.668538117
restoring datafile 00016 to /oracle/oradata/racdb/psdb_iise_i.303.668682685
restoring datafile 00017 to /oracle/oradata/racdb/gosd.329.668687127
restoring datafile 00027 to /oracle/oradata/racdb/undotbs2.544.670001557
channel ORA_DISK_1: reading from backup piece /orabak/week1/Sunday/e4kms2e9_1_1_4548.bak
channel ORA_DISK_1: restored backup piece 1
piece handle=/orabak/week1/Sunday/e4kms2e9_1_1_4548.bak tag=DB0
channel ORA_DISK_1: reading from backup piece /orabak/week1/Sunday/e4kms2e9_2_1_4548.bak
channel ORA_DISK_1: restored backup piece 2
piece handle=/orabak/week1/Sunday/e4kms2e9_2_1_4548.bak tag=DB0
channel ORA_DISK_1: restore complete, elapsed time: 00:01:42
channel ORA_DISK_1: starting datafile backupset restore
channel ORA_DISK_1: specifying datafile(s) to restore from backup set
restoring datafile 00012 to /oracle/oradata/racdb/wbj.337.668615843
restoring datafile 00015 to /oracle/oradata/racdb/psdb_iise_d.301.668682663
restoring datafile 00022 to /oracle/oradata/racdb/psdb_odes.538.676804437
restoring datafile 00031 to /oracle/oradata/racdb/psdb_smob_d.718.670098771
channel ORA_DISK_1: reading from backup piece /orabak/week1/Sunday/e6kms2f9_1_1_4550.bak
channel ORA_DISK_1: restored backup piece 1
piece handle=/orabak/week1/Sunday/e6kms2f9_1_1_4550.bak tag=DB0
channel ORA_DISK_1: reading from backup piece /orabak/week1/Sunday/e6kms2f9_2_1_4550.bak
channel ORA_DISK_1: restored backup piece 2
piece handle=/orabak/week1/Sunday/e6kms2f9_2_1_4550.bak tag=DB0
channel ORA_DISK_1: restore complete, elapsed time: 00:01:41
Finished restore at 2009-08-24 20:51:50

datafile 14 switched to datafile copy
input datafile copy recid=57 stamp=695767910 filename=/oracle/oradata/racdb/smms.321.668623735
datafile 21 switched to datafile copy
input datafile copy recid=58 stamp=695767910 filename=/oracle/oradata/racdb/smmsdb.364.676804261
datafile 17 switched to datafile copy
input datafile copy recid=59 stamp=695767910 filename=/oracle/oradata/racdb/gosd.329.668687127
datafile 28 switched to datafile copy
input datafile copy recid=60 stamp=695767910 filename=/oracle/oradata/racdb/gosd.536.670002437
datafile 18 switched to datafile copy
input datafile copy recid=61 stamp=695767910 filename=/oracle/oradata/racdb/gosdidx.333.668687233
datafile 19 switched to datafile copy
input datafile copy recid=62 stamp=695767910 filename=/oracle/oradata/racdb/psdb_auib.283.676742737
datafile 31 switched to datafile copy
input datafile copy recid=63 stamp=695767910 filename=/oracle/oradata/racdb/psdb_smob_d.718.670098771
datafile 10 switched to datafile copy
input datafile copy recid=64 stamp=695767911 filename=/oracle/oradata/racdb/psdb_smob_d.284.670413675
datafile 11 switched to datafile copy
input datafile copy recid=65 stamp=695767911 filename=/oracle/oradata/racdb/psdb_smob_i.375.670413705
datafile 30 switched to datafile copy
input datafile copy recid=66 stamp=695767911 filename=/oracle/oradata/racdb/psdb_smob_i.666.670098753
datafile 22 switched to datafile copy
input datafile copy recid=67 stamp=695767911 filename=/oracle/oradata/racdb/psdb_odes.538.676804437
datafile 7 switched to datafile copy
input datafile copy recid=68 stamp=695767911 filename=/oracle/oradata/racdb/psdb_isn_d.409.676742365
datafile 9 switched to datafile copy
input datafile copy recid=69 stamp=695767911 filename=/oracle/oradata/racdb/psdb_isn_i.410.676742405
datafile 15 switched to datafile copy
input datafile copy recid=70 stamp=695767911 filename=/oracle/oradata/racdb/psdb_iise_d.301.668682663
datafile 16 switched to datafile copy
input datafile copy recid=71 stamp=695767911 filename=/oracle/oradata/racdb/psdb_iise_i.303.668682685
datafile 32 switched to datafile copy
input datafile copy recid=72 stamp=695767911 filename=/oracle/oradata/racdb/psdb_wbj_d.729.670098811
datafile 33 switched to datafile copy
input datafile copy recid=73 stamp=695767911 filename=/oracle/oradata/racdb/psdb_wbj_i.652.670098831
datafile 12 switched to datafile copy
input datafile copy recid=74 stamp=695767911 filename=/oracle/oradata/racdb/wbj.337.668615843
datafile 13 switched to datafile copy
input datafile copy recid=75 stamp=695767911 filename=/oracle/oradata/racdb/perfstat.340.668616315
datafile 34 switched to datafile copy
input datafile copy recid=76 stamp=695767911 filename=/oracle/oradata/racdb/perfstat.626.670860931
datafile 20 switched to datafile copy
input datafile copy recid=77 stamp=695767911 filename=/oracle/oradata/racdb/sec.365.670416195
datafile 6 switched to datafile copy
input datafile copy recid=78 stamp=695767911 filename=/oracle/oradata/racdb/sec.280.668540851
datafile 8 switched to datafile copy
input datafile copy recid=79 stamp=695767911 filename=/oracle/oradata/racdb/sec_idx.282.668540885
datafile 3 switched to datafile copy
input datafile copy recid=80 stamp=695767911 filename=/oracle/oradata/racdb/sysaux.263.668538117
datafile 1 switched to datafile copy
input datafile copy recid=81 stamp=695767911 filename=/oracle/oradata/racdb/system.261.668538061
datafile 26 switched to datafile copy
input datafile copy recid=82 stamp=695767911 filename=/oracle/oradata/racdb/undotbs1.551.670001545
datafile 24 switched to datafile copy
input datafile copy recid=83 stamp=695767911 filename=/oracle/oradata/racdb/undotbs1.594.670001207
datafile 2 switched to datafile copy
input datafile copy recid=84 stamp=695767911 filename=/oracle/oradata/racdb/undotbs1.262.668538095
datafile 27 switched to datafile copy
input datafile copy recid=85 stamp=695767911 filename=/oracle/oradata/racdb/undotbs2.544.670001557
datafile 4 switched to datafile copy
input datafile copy recid=86 stamp=695767911 filename=/oracle/oradata/racdb/undotbs2.265.668538137
datafile 25 switched to datafile copy
input datafile copy recid=87 stamp=695767911 filename=/oracle/oradata/racdb/undotbs2.562.670001221
datafile 5 switched to datafile copy
input datafile copy recid=88 stamp=695767911 filename=/oracle/oradata/racdb/users.266.668538159

RMAN>

9.sqlplus下,修改联机日志的路径和名称。目的是防止在open resetlogs时报错
racdb1@testdb183 /oracle$ sqlplus / as sysdba

SQL*Plus: Release 10.2.0.3.0 - Production on Mon Aug 24 21:01:40 2009

Copyright (c) 1982, 2006, Oracle.  All Rights Reserved.


Connected to:
Oracle Database 10g Enterprise Edition Release 10.2.0.3.0 - 64bit Production
With the Partitioning, Oracle Label Security, OLAP and Data Mining Scoring Engine options

SQL> alter database rename file '+ORADATA/racdb/onlinelog/group_1.257.668538023' to '/oracle/oradata/racdb/group_1.257.668538023';
SQL> alter database rename file '+ORADATA/racdb/onlinelog/group_2.258.668538033' to '/oracle/oradata/racdb/group_2.258.668538033';
SQL> alter database rename file '+ORADATA/racdb/onlinelog/group_3.259.668538043' to '/oracle/oradata/racdb/group_3.259.668538043';
SQL> alter database rename file '+ORADATA/racdb/onlinelog/group_4.260.668538053' to '/oracle/oradata/racdb/group_4.260.668538053';
SQL> alter database rename file '+ORADATA/racdb/onlinelog/group_5.267.668539011' to '/oracle/oradata/racdb/group_5.267.668539011';
SQL> alter database rename file '+ORADATA/racdb/onlinelog/group_6.268.668539021' to '/oracle/oradata/racdb/group_6.268.668539021';
SQL> alter database rename file '+ORADATA/racdb/onlinelog/group_7.269.668539031' to '/oracle/oradata/racdb/group_7.269.668539031';
SQL> alter database rename file '+ORADATA/racdb/onlinelog/group_8.270.668539041' to '/oracle/oradata/racdb/group_8.270.668539041';

10.回到RMAN命令行,进行recover数据库
racdb1@testdb183 /oracle$ rman target /

Recovery Manager: Release 10.2.0.3.0 - Production on Mon Aug 24 21:02:26 2009

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

connected to target database: racdb (DBID=3914926878, not open)

RMAN>

RMAN> recover database;

Starting recover at 2009-08-24 21:02:58
using target database control file instead of recovery catalog
allocated channel: ORA_DISK_1
channel ORA_DISK_1: sid=870 devtype=DISK
channel ORA_DISK_1: starting incremental datafile backupset restore
channel ORA_DISK_1: specifying datafile(s) to restore from backup set
destination for restore of datafile 00002: /oracle/oradata/racdb/undotbs1.262.668538095
destination for restore of datafile 00014: /oracle/oradata/racdb/smms.321.668623735
destination for restore of datafile 00018: /oracle/oradata/racdb/gosdidx.333.668687233
destination for restore of datafile 00020: /oracle/oradata/racdb/sec.365.670416195
channel ORA_DISK_1: reading from backup piece /orabak/week1/Saturday/gpknbsk7_1_1_4633.bak
channel ORA_DISK_1: restored backup piece 1
piece handle=/orabak/week1/Saturday/gpknbsk7_1_1_4633.bak tag=DB1
channel ORA_DISK_1: restore complete, elapsed time: 00:00:15
channel ORA_DISK_1: starting incremental datafile backupset restore
channel ORA_DISK_1: specifying datafile(s) to restore from backup set
destination for restore of datafile 00007: /oracle/oradata/racdb/psdb_isn_d.409.676742365
destination for restore of datafile 00011: /oracle/oradata/racdb/psdb_smob_i.375.670413705
destination for restore of datafile 00019: /oracle/oradata/racdb/psdb_auib.283.676742737
destination for restore of datafile 00030: /oracle/oradata/racdb/psdb_smob_i.666.670098753
channel ORA_DISK_1: reading from backup piece /orabak/week1/Saturday/gqknbsk7_1_1_4634.bak
channel ORA_DISK_1: restored backup piece 1
piece handle=/orabak/week1/Saturday/gqknbsk7_1_1_4634.bak tag=DB1
channel ORA_DISK_1: restore complete, elapsed time: 00:01:05
channel ORA_DISK_1: starting incremental datafile backupset restore
channel ORA_DISK_1: specifying datafile(s) to restore from backup set
destination for restore of datafile 00004: /oracle/oradata/racdb/undotbs2.265.668538137
destination for restore of datafile 00008: /oracle/oradata/racdb/sec_idx.282.668540885
destination for restore of datafile 00021: /oracle/oradata/racdb/smmsdb.364.676804261
destination for restore of datafile 00024: /oracle/oradata/racdb/undotbs1.594.670001207
channel ORA_DISK_1: reading from backup piece /orabak/week1/Saturday/grknbsk7_1_1_4635.bak
channel ORA_DISK_1: restored backup piece 1
piece handle=/orabak/week1/Saturday/grknbsk7_1_1_4635.bak tag=DB1
channel ORA_DISK_1: restore complete, elapsed time: 00:00:45
channel ORA_DISK_1: starting incremental datafile backupset restore
channel ORA_DISK_1: specifying datafile(s) to restore from backup set
destination for restore of datafile 00003: /oracle/oradata/racdb/sysaux.263.668538117
destination for restore of datafile 00016: /oracle/oradata/racdb/psdb_iise_i.303.668682685
destination for restore of datafile 00017: /oracle/oradata/racdb/gosd.329.668687127
destination for restore of datafile 00027: /oracle/oradata/racdb/undotbs2.544.670001557
channel ORA_DISK_1: reading from backup piece /orabak/week1/Saturday/guknbsm8_1_1_4638.bak
channel ORA_DISK_1: restored backup piece 1
piece handle=/orabak/week1/Saturday/guknbsm8_1_1_4638.bak tag=DB1
channel ORA_DISK_1: restore complete, elapsed time: 00:00:46
channel ORA_DISK_1: starting incremental datafile backupset restore
channel ORA_DISK_1: specifying datafile(s) to restore from backup set
destination for restore of datafile 00001: /oracle/oradata/racdb/system.261.668538061
destination for restore of datafile 00006: /oracle/oradata/racdb/sec.280.668540851
destination for restore of datafile 00025: /oracle/oradata/racdb/undotbs2.562.670001221
destination for restore of datafile 00032: /oracle/oradata/racdb/psdb_wbj_d.729.670098811
channel ORA_DISK_1: reading from backup piece /orabak/week1/Saturday/gsknbsm8_1_1_4636.bak
channel ORA_DISK_1: restored backup piece 1
piece handle=/orabak/week1/Saturday/gsknbsm8_1_1_4636.bak tag=DB1
channel ORA_DISK_1: restore complete, elapsed time: 00:00:25
channel ORA_DISK_1: starting incremental datafile backupset restore
channel ORA_DISK_1: specifying datafile(s) to restore from backup set
destination for restore of datafile 00009: /oracle/oradata/racdb/psdb_isn_i.410.676742405
destination for restore of datafile 00010: /oracle/oradata/racdb/psdb_smob_d.284.670413675
destination for restore of datafile 00028: /oracle/oradata/racdb/gosd.536.670002437
destination for restore of datafile 00033: /oracle/oradata/racdb/psdb_wbj_i.652.670098831
channel ORA_DISK_1: reading from backup piece /orabak/week1/Saturday/gtknbsm8_1_1_4637.bak
channel ORA_DISK_1: restored backup piece 1
piece handle=/orabak/week1/Saturday/gtknbsm8_1_1_4637.bak tag=DB1
channel ORA_DISK_1: restore complete, elapsed time: 00:00:36
channel ORA_DISK_1: starting incremental datafile backupset restore
channel ORA_DISK_1: specifying datafile(s) to restore from backup set
destination for restore of datafile 00005: /oracle/oradata/racdb/users.266.668538159
destination for restore of datafile 00013: /oracle/oradata/racdb/perfstat.340.668616315
destination for restore of datafile 00026: /oracle/oradata/racdb/undotbs1.551.670001545
destination for restore of datafile 00034: /oracle/oradata/racdb/perfstat.626.670860931
channel ORA_DISK_1: reading from backup piece /orabak/week1/Saturday/gvknbsnm_1_1_4639.bak
channel ORA_DISK_1: restored backup piece 1
piece handle=/orabak/week1/Saturday/gvknbsnm_1_1_4639.bak tag=DB1
channel ORA_DISK_1: restore complete, elapsed time: 00:00:08
channel ORA_DISK_1: starting incremental datafile backupset restore
channel ORA_DISK_1: specifying datafile(s) to restore from backup set
destination for restore of datafile 00012: /oracle/oradata/racdb/wbj.337.668615843
destination for restore of datafile 00015: /oracle/oradata/racdb/psdb_iise_d.301.668682663
destination for restore of datafile 00022: /oracle/oradata/racdb/psdb_odes.538.676804437
destination for restore of datafile 00031: /oracle/oradata/racdb/psdb_smob_d.718.670098771
channel ORA_DISK_1: reading from backup piece /orabak/week1/Saturday/h0knbsnm_1_1_4640.bak
channel ORA_DISK_1: restored backup piece 1
piece handle=/orabak/week1/Saturday/h0knbsnm_1_1_4640.bak tag=DB1
channel ORA_DISK_1: restore complete, elapsed time: 00:00:36

starting media recovery

channel ORA_DISK_1: starting archive log restore to default destination
channel ORA_DISK_1: restoring archive log
archive log thread=2 sequence=4105
channel ORA_DISK_1: reading from backup piece /orabak/week1/Saturday/h1knbson_1_1_4641.bak
channel ORA_DISK_1: restored backup piece 1
piece handle=/orabak/week1/Saturday/h1knbson_1_1_4641.bak tag=DB1
channel ORA_DISK_1: restore complete, elapsed time: 00:00:02
channel ORA_DISK_1: starting archive log restore to default destination
channel ORA_DISK_1: restoring archive log
archive log thread=1 sequence=5126
channel ORA_DISK_1: reading from backup piece /orabak/week1/Saturday/h2knbson_1_1_4642.bak
channel ORA_DISK_1: restored backup piece 1
piece handle=/orabak/week1/Saturday/h2knbson_1_1_4642.bak tag=DB1
channel ORA_DISK_1: restore complete, elapsed time: 00:00:02
archive log filename=/oracle/app/oracle/product/10.2.0/db_1/dbs/arch1_5126_668538014.arch thread=1 sequence=5126
archive log filename=/oracle/app/oracle/product/10.2.0/db_1/dbs/arch2_4105_668538014.arch thread=2 sequence=4105
unable to find archive log
archive log thread=2 sequence=4106
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of recover command at 08/24/2009 21:07:45
RMAN-06054: media recovery requesting unknown log: thread 2 seq 4106 lowscn 569488757

11.以open resetlogs的方式打开数据库,完成整个RMAN的恢复
RMAN> alter database open resetlogs;

database opened

RMAN>

12.验证
登陆数据库,检查版本信息。
sys@racdb> select * from v$version;

BANNER
----------------------------------------------------------------------
Oracle Database 10g Enterprise Edition Release 10.2.0.3.0 - 64bi
PL/SQL Release 10.2.0.3.0 - Production
CORE    10.2.0.3.0      Production
TNS for Linux: Version 10.2.0.3.0 - Production
NLSRTL Version 10.2.0.3.0 - Production

13.后续工作还有很多,如一些参数的调整,这里着重说明一下:需要全新的创建以下临时文件。更多信息请参考alert警告文件
通过RMAN恢复过来的临时文件是不可用的,需要处理一下。
报错信息如下:
sys@racdb> select tablespace_name,file_name,bytes/1024/1024 M from dba_temp_files;
select tablespace_name,file_name,bytes/1024/1024 M from dba_temp_files
                                                        *
ERROR at line 1:
ORA-01157: cannot identify/lock data file 201 - see DBWR trace file
ORA-01110: data file 201: '+ORADATA/racdb/tempfile/temp.264.668538129'

处理临时文件:
先创建一个临时表空间temp1
sys@racdb> create temporary tablespace temp1 tempfile '/oracle/oradata/racdb/temp01.dbf' size 512m reuse autoextend on next 1m maxsize unlimited;

Tablespace created.

将默认的临时表空间指定到这个新建的表空间上
sys@racdb> alter database default temporary tablespace temp1;

Database altered.

删除通过RMAN回复过来的临时文件。完成临时文件的整个处理过程。
sys@racdb> drop tablespace temp including contents and datafiles;

Tablespace dropped.

sys@racdb> col FILE_NAME for a40
sys@racdb> select tablespace_name,file_name,bytes/1024/1024 M from dba_temp_files;

TABLESPACE_NAME   FILE_NAME                             M
----------------- --------------------------------- -----
TEMP1             /oracle/oradata/racdb/temp01.dbf    512

14.到此整个RAC到异地单机的RMAN恢复任务已经完成。
注:这里只是简单的介绍一下恢复的过程,每一个细节都可以细细的斟酌,加以考量。

DBA的永恒的使命:“恢复数据库”!

Goodluck everyone.

-- The End --

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

转载于:http://blog.itpub.net/519536/viewspace-613110/

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值