Oracle 11g RAC 11.2.0.3数据库升级失败后的两种回退方法
升级环境:
1、RAC 11.2.0.1 to RAC 11.2.0.2
2、RAC 11.2.0.1 to RAC 11.2.0.3
3、RAC 11.2.0.2 to RAC 11.2.0.3
以上DB软件均是通过out-of-place upgrade方法升级。
如果在升级完成后,发现升级过程有问题,需要回退,我们可以选择两种回退办法:
1. 通过闪回数据库的办法还原到11.2.0.1 /11.2.0.2的数据库
2. 降级数据字典
以下我们介绍通过闪回数据库的办法还原到11.2.0.1 /11.2.0.2的数据库
关于 降级数据字典详见:
How To Downgrade From Database 11.2 To Previous Release (includes 11.2.0.3-11.2.0.1) [ID883335.1]
一、检查已升级的数据库版本(11.2.0.3)
备注:
我们在升级11.2.0.3的数据字典之前已经做了数据库的闪回点
create restore point upgrade_rollback guarantee flashback database;
SQL> SELECT NAME, SCN, TIME, DATABASE_INCARNATION#, GUARANTEE_FLASHBACK_DATABASE, STORAGE_SIZE FROM V$RESTORE_POINT WHERE GUARANTEE_FLASHBACK_DATABASE='YES';
NAME
--------------------------------------------------------------------------------
SCN
----------
TIME
---------------------------------------------------------------------------
DATABASE_INCARNATION# GUA STORAGE_SIZE
--------------------- --- ------------
UPGRADE_ROLLBACK
1227989
31-MAR-12 10.21.06.000000000 AM
1 YES 16384000
检查版本信息
SQL> select * from global_name;
GLOBAL_NAME
--------------------------------------------------------------------------------
RACDB
SQL> select * from v$version;
BANNER
--------------------------------------------------------------------------------
Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production
PL/SQL Release 11.2.0.3.0 - Production
CORE 11.2.0.3.0 Production
TNS for IBM/AIX RISC System/6000: Version 11.2.0.3.0 - Production
NLSRTL Version 11.2.0.3.0 - Production
SQL> col COMP_ID format a10
SQL> col COMP_NAME format a30
SQL> select comp_id,comp_name,version,status,modified from dba_registry
SQL> /
COMP_ID COMP_NAME VERSION STATUS MODIFIED
---------- ------------------------------ ------------------------------ ---------------------- -----------------------
APEX Oracle Application Express 3.2.1.00.12 INVALID 31-MAR-2012 12:04:14
EM Oracle Enterprise Manager 11.2.0.3.0 VALID 31-MAR-2012 11:36:51
ORDIM Oracle Multimedia 11.2.0.3.0 VALID 31-MAR-2012 12:04:14
XDB Oracle XML Database 11.2.0.3.0 VALID 31-MAR-2012 12:04:13
EXF Oracle Expression Filter 11.2.0.3.0 VALID 31-MAR-2012 12:04:12
RUL Oracle Rules Manager 11.2.0.3.0 VALID 31-MAR-2012 12:04:13
OWM Oracle Workspace Manager 11.2.0.3.0 VALID 31-MAR-2012 12:04:11
CATALOG Oracle Database Catalog Views 11.2.0.3.0 VALID 31-MAR-2012 12:04:11
CATPROC Oracle Database Packages and T 11.2.0.3.0 VALID 31-MAR-2012 12:04:11
ypes
JAVAVM JServer JAVA Virtual Machine 11.2.0.3.0 VALID 31-MAR-2012 12:04:11
XML Oracle XDK 11.2.0.3.0 VALID 31-MAR-2012 12:04:11
CATJAVA Oracle Database Java Packages 11.2.0.3.0 VALID 31-MAR-2012 12:04:11
RAC Oracle Real Application Cluste 11.2.0.3.0 VALID 31-MAR-2012 12:04:14
rs
13 rows selected.
二、回退过程(to 11.2.0.2)
1、关闭RAC所有节点的实例
2、在所有节点上关闭数据库实例,并在一个节点上启动数据库到mount模式进行闪回。
$ sqlplus / as sysdba
SQL> startup mount;
SQL> SELECT NAME, SCN, TIME, DATABASE_INCARNATION#, GUARANTEE_FLASHBACK_DATABASE, STORAGE_SIZE FROM V$RESTORE_POINT WHERE GUARANTEE_FLASHBACK_DATABASE='YES';
NAME
--------------------------------------------------------------------------------
SCN
----------
TIME
---------------------------------------------------------------------------
DATABASE_INCARNATION# GUA STORAGE_SIZE
--------------------- --- ------------
UPGRADE_ROLLBACK
1227989
31-MAR-12 10.21.06.000000000 AM
1 YES 910868480
SQL> flashback database to restore point UPGRADE_ROLLBACK;
Flashback complete.
SQL> alter database open resetlogs;
Database altered.
SQL> shutdown immediate;
3 、使用srvctl命令更新ocr中DBHOME相关信息
$ su - oracle
%srvctl upgrade database -d racdb -o $NEW_ORACLE_HOME
$ srvctl upgrade database -d racdb -o /oracle/app/oracle/product/11.2.0
$ srvctl config database -d racdb
4、更环境变量到11.2.0及pfile等。
5、启动数据库:
6、 检查版本信息
SQL> select * from global_name;
GLOBAL_NAME
--------------------------------------------------------------------------------
RACDB
SQL> select * from v$version;
SQL> col COMP_ID format a10
SQL> col COMP_NAME format a30
SQL> select comp_id,comp_name,version,status,modified from dba_registry
SQL> select * from global_name;
GLOBAL_NAME
--------------------------------------------------------------------------------
RACDB
SQL> select * from v$version;
BANNER
--------------------------------------------------------------------------------
Oracle Database 11g Enterprise Edition Release 11.2.0.2.0 - 64bit Production
PL/SQL Release 11.2.0.2.0 - Production
CORE 11.2.0.2.0 Production
TNS for IBM/AIX RISC System/6000: Version 11.2.0.2.0 - Production
NLSRTL Version 11.2.0.2.0 - Production
SQL> col COMP_ID format a10
SQL> col COMP_NAME format a30
SQL> select comp_id,comp_name,version,status,modified from dba_registry
2 ;
COMP_ID COMP_NAME VERSION
---------- ------------------------------ ------------------------------
STATUS MODIFIED
---------------------- -----------------------
APEX Oracle Application Express 3.2.1.00.12
INVALID 29-MAR-2012 19:53:42
EM Oracle Enterprise Manager 11.2.0.2.0
VALID 29-MAR-2012 19:34:52
ORDIM Oracle Multimedia 11.2.0.2.0
VALID 29-MAR-2012 19:24:12
COMP_ID COMP_NAME VERSION
---------- ------------------------------ ------------------------------
STATUS MODIFIED
---------------------- -----------------------
XDB Oracle XML Database 11.2.0.2.0
VALID 29-MAR-2012 19:12:54
EXF Oracle Expression Filter 11.2.0.2.0
VALID 29-MAR-2012 19:09:10
RUL Oracle Rules Manager 11.2.0.2.0
VALID 29-MAR-2012 19:13:49
COMP_ID COMP_NAME VERSION
---------- ------------------------------ ------------------------------
STATUS MODIFIED
---------------------- -----------------------
OWM Oracle Workspace Manager 11.2.0.2.0
VALID 29-MAR-2012 18:56:43
CATALOG Oracle Database Catalog Views 11.2.0.2.0
VALID 29-MAR-2012 18:55:11
CATPROC Oracle Database Packages and T 11.2.0.2.0
ypes
VALID 29-MAR-2012 18:55:11
COMP_ID COMP_NAME VERSION
---------- ------------------------------ ------------------------------
STATUS MODIFIED
---------------------- -----------------------
JAVAVM JServer JAVA Virtual Machine 11.2.0.2.0
VALID 29-MAR-2012 19:06:30
XML Oracle XDK 11.2.0.2.0
VALID 29-MAR-2012 19:08:00
CATJAVA Oracle Database Java Packages 11.2.0.2.0
VALID 29-MAR-2012 19:08:34
COMP_ID COMP_NAME VERSION
---------- ------------------------------ ------------------------------
STATUS MODIFIED
---------------------- -----------------------
RAC Oracle Real Application Cluste 11.2.0.2.0
rs
VALID 29-MAR-2012 19:58:08
13 rows selected.
完成回退。