oracle11.2.0.4rac恢复到单实例(一)

2015-01-22 21:28:36 · 作者: · 浏览: 9

一、备份原库

run{
backup database format '/home/oracle/backup/db_%U_%T.bak';
backup current controlfile format '/home/oracle/backup/ctl_%U_%T.bak';
backup spfile format '/home/oracle/backup/spfile_%U_%T.bak';
backup archivelog from time 'sysdate -1' format  '/home/oracle/backup/arch_%U_%T.bak';
}	

二、修改单实例的参数文件

将备份的文件拷贝到单实例的相同目录

db_name=suq
log_archive_dest_1='location=/arch'
pga_aggregate_target=400000000
sga_target=800000000
control_files='/oradata/control.ctl'

启动单实例到nomount

[oracle@11g1 dbs]$ sqlplus / as sysdba

SQL*Plus: Release 11.2.0.4.0 Production on Fri Dec 12 20:39:56 2014

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

Connected to an idle instance.

SQL> 
SQL> startup nomount
ORACLE instance started.

Total System Global Area  797523968 bytes
Fixed Size		    2257472 bytes
Variable Size		  222301632 bytes
Database Buffers	  566231040 bytes
Redo Buffers		    6733824 bytes


三、恢复控制文件

[oracle@11g1 ~]$ rman target /

Recovery Manager: Release 11.2.0.4.0 - Production on Fri Dec 12 20:40:14 2014

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

connected to target database: SUQ (not mounted)

RMAN> restore controlfile from '/home/oracle/backup/clt_0dpq0ka5_1_1_20141212.bak';

Starting restore at 12-DEC-14
using target database control file instead of recovery catalog
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=171 device type=DISK

channel ORA_DISK_1: restoring control file
channel ORA_DISK_1: restore complete, elapsed time: 00:00:01
output file name=/oradata/control.ctl
Finished restore at 12-DEC-14

RMAN> 



SQL> startup mount
ORACLE instance started.

Total System Global Area  797523968 bytes
Fixed Size		    2257472 bytes
Variable Size		  222301632 bytes
Database Buffers	  566231040 bytes
Redo Buffers		    6733824 bytes
ORA-00201: control file version 11.2.0.4.0 incompatible with ORACLE version
11.2.0.0.0
ORA-00202: control file: '/oradata/control.ctl'

这里一个报错,需要在pfile中添加版本的参数

compatible='11.2.0.4.0'

SQL> startup mount
ORACLE instance started.

Total System Global Area  797523968 bytes
Fixed Size		    2257472 bytes
Variable Size		  222301632 bytes
Database Buffers	  566231040 bytes
Redo Buffers		    6733824 bytes
Database mounted.
SQL> exit

四、修改日志文件的路径

alter database rename file '+BACKUP/suq/onlinelog/group_1.258.850940549' to '/oradata/group_1.258.850940549';
alter database rename file '+BACKUP/suq/onlinelog/group_1.259.850940549' to '/oradata/group_1.259.850940549';
alter database rename file '+BACKUP/suq/onlinelog/group_2.260.850940551' to '/oradata/group_2.260.850940551';
alter database rename file '+BACKUP/suq/onlinelog/group_2.261.850940551' to '/oradata/group_2.261.850940551';
alter database rename file '+BACKUP/suq/onlinelog/group_3.268.850941051' to '/oradata/group_3.268.850941051';
alter database rename file '+BACKUP/suq/onlinelog/group_3.269.850941053' to '/oradata/group_3.269.850941053';
alter database rename file '+BACKUP/suq/onlinelog/group_4.270.850941053' to '/oradata/group_4.270.850941053';

Database altered.

SQL> 
Database altered.

SQL> 
Database altered.

SQL> 
Database altered.

SQL> 
Database altered.

SQL> 
Database altered.

SQL> 
Database altered.

SQL> alter database rename file '+BACKUP/suq/onlinelog/group_4.271.850941053' to '