Oracle11g 11.2.0.3升級失敗後的兩種回退方法

shilei1發表於2012-04-06

升級環境:

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.3的資料庫
2. 執行catdwgrd.sql 降級資料字典

以下我們介紹透過閃回資料庫的辦法還原到11.2.0.1 /11.2.0.3的資料庫


關於執行catdwgrd.sql 降級資料字典詳見: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.

完成回退。

 

來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/196700/viewspace-720603/,如需轉載,請註明出處,否則將追究法律責任。

相關文章