rac环境:redhat 5+oracle 11.2.0.3.0
单机:redhat5 + oracle 11.2.0.1.0
1、首先在rac环境用rman备份数据库。
[oracle@rac1 admin]$ rman target /
Recovery Manager: Release 11.2.0.3.0 - Production on Wed Jun 5 20:31:19 2013
Copyright (c) 1982, 2011, Oracle and/or its affiliates. All rights reserved.
connected to target database: binbin (DBID=880202321)
RMAN> run
2> {
3> allocate channel c1 device type disk connect 'sys/oracle@binbin1';
4> allocate channel c2 device type disk connect 'sys/oracle@binbin2';
5> backup incremental level= 0 skip inaccessible filesperset 5 Database format
='/backup/full_%U_%T' tag='fullbackup';
6>
7> sql 'alter system archive log current';
8>
9> backup archivelog all tag='arc_bak' format='/backup/arch_%U_%T' skip inaccess
ible filesperset 5 not backed up 1 times delete input;
10>
11> backup current controlfile tag='bak_ctlfile' format='/backup/ctl_file_%U_%T'
;
backup spfile tag='spfile' format='/backup/spfile_%U_%T';
12> 13>
14> release channel c2;
15> release channel c1;
16> }
2、将rac环境的rman备份拷贝到单机。并就rac环境pfile copy到单机,根据单机主机资源,修改集群参数,实例名,文件路径以及sga和pga等参数。修改如下:
[oracle@localhost trace]$ more /backup/test1.ora
binbin1.__db_cache_size=276824064
binbin1.__java_pool_size=194304
binbin1.__large_pool_size=194304
binbin1.__pga_aggregate_target=35544320
binbin1.__sga_target=53316480
binbin1.__shared_io_pool_size=0
binbin1.__streams_pool_size=0
*.audit_file_dest='/u01/oracle/admin/binbin/adump'
*.audit_trail='db'
*.compatible='11.2.0.0.0'
*.control_files='/u01/oracle/oradata/binbin/current.260.817320081','/u01/oracle/or
adata/binbin/current.256.817320085'
*.db_block_size=8192
*.db_create_file_dest='/u01/oracle/oradata/fra'
*.db_domain=''
*.db_name='binbin'
*.db_recovery_file_dest='/u01/oracle/oradata/fra'
*.db_recovery_file_dest_size=4558159872
*.diagnostic_dest='/u01/oracle'
*.dispatchers='(PROTOCOL=TCP) (SERVICE=binbinXDB)'
binbin1.instance_number=1
*.log_archive_format='%t_%s_%r.dbf'
*.memory_target=438860800
*.open_cursors=30
*.processes=150
*.remote_login_passwordfile='exclusive'
binbin1.thread=1
binbin1.undo_tablespace='UNDOTBS1'
3、用pfile将数据库启动到nomount
SQL> shutdown immediate
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL> startup nomount pfile='/backup/test1.ora';
ORACLE instance started.
Total System Global Area 438423552 bytes
Fixed Size 2214136 bytes
Variable Size 276825864 bytes
Database Buffers 155189248 bytes
Redo Buffers 4194304 bytes
4、restore 控制文件。
restore controlfile from '/backup/ctl_file_0cobf0sv_1_1_20130605';
5、restore 数据文件、归档。
alter database mount;
run{
allocate channel c1 device type disk;
allocate channel c2 device type disk;
set newname for datafile 4 to '/u01/oracle/oradata/binbin/users.259.817319625';
set newname for datafile 3 to '/u01/oracle/oradata/binbin/undotbs1.258.817319623';
set newname for datafile 2 to '/u01/oracle/oradata/binbin/sysaux.257.817319623';
set newname for datafile 1 to '/u01/oracle/oradata/binbin/system.256.817319619';
set newname for datafile 5 to '/u01/oracle/oradata/binbin/undotbs2.264.817321699';
restore database;
switch datafile all;
release channel c1;
release channel c2;
}
RMAN> list backup of archivelog all;
List of Backup Sets
===================
BS Key Size Device Type Elapsed Time Completion Time
------- ---------- ----------- ------------ ---------------
5 12.75M DISK 00:00:34 05-JUN-13
BP Key: 5 Status: AVAILABLE Compressed: NO Tag: ARC_BAK
Piece Name: /backup/arch_07obf06f_1_1_20130605
List of Archived Logs in backup set 5
Thrd Seq Low SCN Low Time Next SCN Next Time
---- ------- ---------- --------- ---------- ---------
1 5 1036867 05-JUN-13 1042128 05-JUN-13
BS Key Size Device Type Elapsed Time Completion Time
------- ---------- ----------- ------------ ---------------
6 385.50K DISK 00:02:03 05-JUN-13
BP Key: 6 Status: AVAILABLE Compressed: NO Tag: ARC_BAK
Piece Name: /backup/arch_08obf078_1_1_20130605
List of Archived Logs in backup set 6
Thrd Seq Low SCN Low Time Next SCN Next Time
---- ------- ---------- --------- ---------- ---------
1 6 1042128 05-JUN-13 1042130 05-JUN-13
1 7 1042130 05-JUN-13 1064142 05-JUN-13
1 8 1064142 05-JUN-13 1085455 05-JUN-13
2 1 1041923 05-JUN-13 1041938 05-JUN-13
2 2 1042126 05-JUN-13 1064144 05-JUN-13
BS Key Size Device Type Elapsed Time Completion Time
------- ---------- ----------- ------------ ---------------
7 72.50K DISK 00:00:38 05-JUN-13
BP Key: 7 Status: AVAILABLE Compressed: NO Tag: ARC_BAK
Piece Name: /backup/arch_09obf0c5_1_1_20130605
List of Archived Logs in backup set 7
Thrd Seq Low SCN Low Time Next SCN Next Time
---- ------- ---------- --------- ---------- ---------
1 9 1085455 05-JUN-13 1085458 05-JUN-13
1 10 1105498 05-JUN-13 1105513 05-JUN-13
2 3 1064144 05-JUN-13 1105497 05-JUN-13
2 4 1105497 05-JUN-13 1105501 05-JUN-13
2 5 1105501 05-JUN-13 1105503 05-JUN-13
BS Key Size Device Type Elapsed Time Completion Time
------- ---------- ----------- ------------ ---------------
8 4.86M DISK 00:01:05 05-JUN-13
BP Key: 8 Status: AVAILABLE Compressed: NO Tag: ARC_BAK
Piece Name: /backup/arch_0aobf0g6_1_1_20130605
List of Archived Logs in backup set 8
Thrd Seq Low SCN Low Time Next SCN Next Time
---- ------- ---------- --------- ---------- ---------
1 11 1105513 05-JUN-13 1110209 05-JUN-13
2 6 1105503 05-JUN-13 1105509 05-JUN-13
2 7 1105921 05-JUN-13 1109805 05-JUN-13
2 8 1109805 05-JUN-13 1110195 05-JUN-13
2 9 1110195 05-JUN-13 1114289 05-JUN-13
BS Key Size Device Type Elapsed Time Completion Time
------- ---------- ----------- ------------ ---------------
9 1.02M DISK 00:00:21 05-JUN-13
BP Key: 9 Status: AVAILABLE Compressed: NO Tag: ARC_BAK
Piece Name: /backup/arch_0bobf0jm_1_1_20130605
List of Archived Logs in backup set 9
Thrd Seq Low SCN Low Time Next SCN Next Time
---- ------- ---------- --------- ---------- ---------
1 12 1110209 05-JUN-13 1114286 05-JUN-13
1 13 1114286 05-JUN-13 1114319 05-JUN-13
2 10 1114289 05-JUN-13 1114322 05-JUN-13
RMAN> restore archivelog sequence between 1 and 10 thread 2;
RMAN> restore archivelog sequence between 6 and 13 thread 1;
6、recover 数据库。
recover database using backup controlfile until cancel;
7、尝试以resetlogs方法打开数据库
1、在resetlog 打开数据库前,要对redolog 的路径进行重命名。
alter database rename file '+DATA/binbin/onlinelog/group_2.262.817320117' to '/u01/oracle/oradata/binbin/group_2.262.817320117';
alter database rename file '+FRA/binbin/onlinelog/group_2.258.817320121' to '/u01/oracle/oradata/binbin/group_2.258.817320121';
alter database rename file '+DATA/binbin/onlinelog/group_1.261.817320103' to '/u01/oracle/oradata/binbin/group_1.261.817320103';
alter database rename file '+FRA/binbin/onlinelog/group_1.257.817320111' to '/u01/oracle/oradata/binbin/group_1.257.817320111';
alter database rename file '+DATA/binbin/onlinelog/group_3.265.817323269' to '/u01/oracle/oradata/binbin/group_3.265.817323269';
alter database rename file '+FRA/binbin/onlinelog/group_3.259.817323275' to '/u01/oracle/oradata/binbin/group_3.259.817323275';
alter database rename file '+DATA/binbin/onlinelog/group_4.266.817323281' to '/u01/oracle/oradata/binbin/group_4.266.817323281';
alter database rename file '+FRA/binbin/onlinelog/group_4.260.817323289' to '/u01/oracle/oradata/binbin/group_4.260.817323289';
2.resetlogs 打开数据库
SQL> alter database open resetlogs;
alter database open resetlogs
*
ERROR at line 1:
ORA-01092: ORACLE instance terminated. Disconnection forced
ORA-00704: bootstrap process failure
ORA-39700: database must be opened with UPGRADE option
Process ID: 2971
Session ID: 17 Serial number: 3
3、由于是将11.2.0.3.0恢复到11.2.0.1.0,打开数据库的时候提示要升级数据字典。
SQL> startup upgrade pfile='/backup/test1.ora';
ORACLE instance started.
Total System Global Area 438423552 bytes
Fixed Size 2214136 bytes
Variable Size 276825864 bytes
Database Buffers 155189248 bytes
Redo Buffers 4194304 bytes
Database mounted.
Database opened.
8、重建临时表空间
SQL> create temporary tablespace temp1 tempfile '/u01/oracle/oradata/binbin/temp1.dbf'size 512M autoextend off;
Tablespace created.
SQL> alter database default temporary tablespace temp1;
Database altered.