ORACLE 10gR2 RAC升級至10.2.0.4

xfhuangfu發表於2015-07-04
之前安裝的是兩個節點的RAC 平臺, Redhat 4.7 + ASM + RAW+ Oracle 10g RAC  
資料庫版本是10.2.0.1. 這個實驗的目的就是將這個資料庫版本從10.2.0.1 升級到 10.2.0.4 ,
10.2.0.4的patch number 是:p6810189

RAC 環境下的升級分三步。 這個在patch 包裡的readme 文件裡有詳細的說明。
       1. 升級clusterware  -- > 升級包中安裝程式裡選擇CRS_HOME後安裝
       2. 升級資料庫軟體  -- >升級包中安裝程式裡選擇ORACLE_HOME後安裝
       3. 升級例項    -- > 可以使用指令碼 或者直接執行DBUA 實現, 如果用指令碼,參考單節點的升級
 
RAC 的升級分滾動升級升級和非滾動升級。
       滾動升級就是每次升級一個節點。
       非滾動就是一次升級所有節點

這個patch包的readme文件也有說明。這次升級用的是非滾動升級。 即一次性搞定所有節點。

注意:
       如果是生產庫,在升級之前做好備份。 備份資料庫(如:RMAN),備份ORA_CRS_HOME 目錄,備份ORACLE_HOME目錄。

這次升級放在rac2節點上執行

1:檢視資料庫的資訊
[oracle@rac2 Disk1]$ sqlplus / as sysdba
SQL*Plus: Release 10.2.0.1.0 - Production on Tue May 21 04:44:52 2013
Copyright (c) 1982, 2005, Oracle.  All rights reserved.

Connected to:
Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production
With the Partitioning, Real Application Clusters, OLAP and Data Mining options
SQL>
SQL>
SQL>
SQL> select instance_name from V$instance;

INSTANCE_NAME
----------------
racdb2
SQL> SQL> select * from v$version;

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

二. 升級Clusterware 軟體

2.1   停止相關程式
可以用srvctl 命令來一個一個進行,也可以用crs_stop -all 進行。
在任意節點上執行即可,此處我選擇rac2節點執行
[oracle@rac2 Disk1]$ crs_stop -all
再次確認叢集狀態
[oracle@rac2 ~]$ crs_stat -t
Name           Type           Target    State     Host       
------------------------------------------------------------
ora....SM1.asm application    OFFLINE   OFFLINE              
ora....C1.lsnr application    OFFLINE   OFFLINE              
ora.rac1.gsd   application    OFFLINE   OFFLINE              
ora.rac1.ons   application    OFFLINE   OFFLINE              
ora.rac1.vip   application    OFFLINE   OFFLINE              
ora....SM2.asm application    OFFLINE   OFFLINE              
ora....C2.lsnr application    OFFLINE   OFFLINE              
ora.rac2.gsd   application    OFFLINE   OFFLINE              
ora.rac2.ons   application    OFFLINE   OFFLINE              
ora.rac2.vip   application    OFFLINE   OFFLINE              
ora.racdb.db   application    OFFLINE   OFFLINE              
ora....b1.inst application    OFFLINE   OFFLINE              
ora....b2.inst application    OFFLINE   OFFLINE     

2.2 用Xmanger 工具執行runInstaller
[oracle@rac2 ~]$ ls -lt
total 1030280
drwxr-xr-x  2 oracle dba       4096 May 21 04:40 Desktop
drwxrwxrwx  2 oracle dba       4096 May 21 03:52 rac2_arch
-rw-r--r--  1 oracle dba       1497 May 20 22:37 initbak.0521
-rwxrwxrwx  1 oracle dba 1053748381 May 20 20:44 p6810189_10204_Linux-x86.zip
-rw-r--r--  1 oracle dba       1410 May  6 17:12 init20130506_1.ora
-rw-r--r--  1 oracle dba       1340 May  6 17:02 init20130506.ora
drwxr-xr-x  4 oracle dba       4096 Oct 19  2012 admin
drwxrwx---  5 oracle dba       4096 Oct 19  2012 oraInventory
drwxr-xr-x  4 oracle dba       4096 Oct 17  2012 10.2.0
-rw-r--r--  1 oracle dba     178473 Feb 26  2008 README.html
drwxr-xr-x  5 oracle dba       4096 Feb 22  2008 Disk1
[oracle@rac2 ~]$
[oracle@rac2 ~]$ cd Disk1/
[oracle@rac2 Disk1]$ ls
10204_buglist.htm  install  patch_note.htm  response  runInstaller  stage
[oracle@rac2 Disk1]$ ./runInstaller
然後在圖形化介面中一步一步操作
歡迎頁面-------next
選擇軟體的目錄,這裡我們要首先選擇OraCrs10g的主目錄,點選Name中的下拉框 ,然後 next
OUI 自動選中的cluster的安裝方式,並選中了所有可用的節點 , 然後next
安裝環境的檢查,如無異常,直接點選 next
顯示摘要資訊,如無異常點選install:
提示安裝結束:
圖形介面操作完成,不過認真看了視窗中提示資訊,會發現接下來還需要執行兩個命令,具體操作如下:
 
首先在節點rac2上執行下列命令,注意是root使用者執行
[root@rac2 ~]# cd /home/oracle/10.2.0/crs_1/bin
[root@rac2 bin]# crsctl stop crs
Stopping resources.
Successfully stopped CRS resources
Stopping CSSD.
Shutting down CSS daemon.
Shutdown request successfully issued.
[root@rac2 bin]# cd /home/oracle/10.2.0/crs_1/install
[root@rac2 install]# ./root102.sh
Creating pre-patch directory for saving pre-patch clusterware files
Completed patching clusterware files to /home/oracle/10.2.0/crs_1
Relinking some shared libraries.
Relinking of patched files is complete.
WARNING: directory '/home/oracle/10.2.0' is not owned by root
WARNING: directory '/home/oracle' is not owned by root
Preparing to recopy patched init and RC scripts.
Recopying init and RC scripts.
Startup will be queued to init within 30 seconds.
/home/oracle/.bash_profile: line 27: ulimit: open files: cannot modify limit: Operation not permitted
Starting up the CRS daemons.
Waiting for the patched CRS daemons to start.
  This may take a while on some systems.
.
10204 patch successfully applied.
clscfg: EXISTING configuration version 3 detected.
clscfg: version 3 is 10G Release 2.
Successfully accumulated necessary OCR keys.
Using ports: CSS=49895 CRS=49896 EVMC=49898 and EVMR=49897.
node :
node 2: rac2 rac2-priv rac2
Creating OCR keys for user 'root', privgrp 'root'..
Operation successful.
clscfg -upgrade completed successfully
[root@rac2 install]#
 
然後在rac1節點執行
[root@rac1 ~]# cd /home/oracle/10.2.0/crs_1/bin
[root@rac1 bin]# crsctl stop crs
Stopping resources.
Successfully stopped CRS resources
Stopping CSSD.
Shutting down CSS daemon.
Shutdown request successfully issued.

crs_1]# cd /home/oracle/10.2.0/crs_1/install
[root@rac1 install]# ./root102.sh
Creating pre-patch directory for saving pre-patch clusterware files
Completed patching clusterware files to /home/oracle/10.2.0/crs_1
Relinking some shared libraries.
Relinking of patched files is complete.
WARNING: directory '/home/oracle/10.2.0' is not owned by root
WARNING: directory '/home/oracle' is not owned by root
Preparing to recopy patched init and RC scripts.
Recopying init and RC scripts.
Startup will be queued to init within 30 seconds.
/home/oracle/.bash_profile: line 27: ulimit: open files: cannot modify limit: Operation not permitted
Starting up the CRS daemons.
Waiting for the patched CRS daemons to start.
  This may take a while on some systems.
.
10204 patch successfully applied.
clscfg: EXISTING configuration version 3 detected.
clscfg: version 3 is 10G Release 2.
Successfully accumulated necessary OCR keys.
Using ports: CSS=49895 CRS=49896 EVMC=49898 and EVMR=49897.
node :
node 1: rac1 rac1-priv rac1
Creating OCR keys for user 'root', privgrp 'root'..
Operation successful.
clscfg -upgrade completed successfully

在兩個節點執行完這兩個指令碼以後,在IU中點exit退出
 

三、安裝資料庫軟體補丁集
3.1 由於前面執行root102.sh時,會自動重啟crs,因此在升級資料庫軟體前需要關閉CRS服務
關閉crs資源
[root@rac2 install]# crs_stop -all
檢視crs狀態
[root@rac2 install]# crs_stat -t
Name           Type           Target    State     Host       
------------------------------------------------------------
ora....SM1.asm application    OFFLINE   OFFLINE              
ora....C1.lsnr application    OFFLINE   OFFLINE              
ora.rac1.gsd   application    OFFLINE   OFFLINE              
ora.rac1.ons   application    OFFLINE   OFFLINE              
ora.rac1.vip   application    OFFLINE   OFFLINE              
ora....SM2.asm application    OFFLINE   OFFLINE              
ora....C2.lsnr application    OFFLINE   OFFLINE              
ora.rac2.gsd   application    OFFLINE   OFFLINE              
ora.rac2.ons   application    OFFLINE   OFFLINE              
ora.rac2.vip   application    OFFLINE   OFFLINE              
ora.racdb.db   application    OFFLINE   OFFLINE              
ora....b1.inst application    OFFLINE   OFFLINE              
ora....b2.inst application    OFFLINE   OFFLINE

3.2 用Xmanger 工具執行runInstaller
[oracle@rac2 Disk1]$ pwd
/home/oracle/Disk1
[oracle@rac2 Disk1]$ ls
10204_buglist.htm  install  patch_note.htm  response  runInstaller  stage
[oracle@rac2 Disk1]$ ./runInstaller
歡迎介面------ 點next
彈出OUI的歡迎介面後,這次選擇OracDb的主目錄 -----next
OUI 自動選中了cluster的安裝方式  -----next
檢查環境,確認無誤 -------next
提示是否要繫結metalink,可以根據實際情況進行選擇:我在這裡什麼多沒填,直接點next
概要預覽,如無問題直接點選install
開始執行安裝,視I/O速率,本步操作可能需要費時良久
在此期間,OUI會自動彈出視窗如下,提示在RAC環境中的各個節點執行指定的指令碼,注意是以root身份執行

rac1節點
[root@rac1 install]# /home/oracle/10.2.0/db_1/root.sh
Running Oracle10 root.sh script...
The following environment variables are set as:
    ORACLE_OWNER= oracle
    ORACLE_HOME=  /home/oracle/10.2.0/db_1
Enter the full pathname of the local bin directory: [/usr/local/bin]:
The file "dbhome" already exists in /usr/local/bin.  Overwrite it? (y/n)
[n]: y
   Copying dbhome to /usr/local/bin ...
The file "oraenv" already exists in /usr/local/bin.  Overwrite it? (y/n)
[n]: y
   Copying oraenv to /usr/local/bin ...
The file "coraenv" already exists in /usr/local/bin.  Overwrite it? (y/n)
[n]: y
   Copying coraenv to /usr/local/bin ...
Entries will be added to the /etc/oratab file as needed by
Database Configuration Assistant when a database is created
Finished running generic part of root.sh script.
Now product-specific root actions will be performed.
 
rac2節點
[root@rac2 install]# /home/oracle/10.2.0/db_1/root.sh
Running Oracle10 root.sh script...
The following environment variables are set as:
    ORACLE_OWNER= oracle
    ORACLE_HOME=  /home/oracle/10.2.0/db_1
Enter the full pathname of the local bin directory: [/usr/local/bin]:
The file "dbhome" already exists in /usr/local/bin.  Overwrite it? (y/n)
[n]: y
   Copying dbhome to /usr/local/bin ...
The file "oraenv" already exists in /usr/local/bin.  Overwrite it? (y/n)
[n]: y
   Copying oraenv to /usr/local/bin ...
The file "coraenv" already exists in /usr/local/bin.  Overwrite it? (y/n)
[n]: y
   Copying coraenv to /usr/local/bin ...
Entries will be added to the /etc/oratab file as needed by
Database Configuration Assistant when a database is created
Finished running generic part of root.sh script.
Now product-specific root actions will be performed.
 

指令碼執行完成後,返回視窗介面,點選ok按鈕即可,補丁集就更新完了,點選exit退出當前操作介面

四. 升級例項
 
升級例項有兩種方法:
    1. DBUA
    2. 手動執行指令碼
對於RAC資料庫環境下的升級,首先需要啟動各節點的監聽服務
4.1 啟動相關的程式
[root@rac1 install]# crs_start -all

[root@rac2 install]# crs_stat -t
Name           Type           Target    State     Host       
------------------------------------------------------------
ora....SM1.asm application    ONLINE    ONLINE    rac1       
ora....C1.lsnr application    ONLINE    ONLINE    rac1       
ora.rac1.gsd   application    ONLINE    ONLINE    rac1       
ora.rac1.ons   application    ONLINE    ONLINE    rac1       
ora.rac1.vip   application    ONLINE    ONLINE    rac1       
ora....SM2.asm application    ONLINE    ONLINE    rac2       
ora....C2.lsnr application    ONLINE    ONLINE    rac2       
ora.rac2.gsd   application    ONLINE    ONLINE    rac2       
ora.rac2.ons   application    ONLINE    ONLINE    rac2       
ora.rac2.vip   application    ONLINE    ONLINE    rac2       
ora.racdb.db   application    ONLINE    OFFLINE              
ora....b1.inst application    ONLINE    OFFLINE              
ora....b2.inst application    ONLINE    OFFLINE  

4.2  透過xmanager執行dbua
[oracle@rac2 Disk1]$ dbua
然後在UI圖形介面中一步步操作
歡迎頁面 ---  next
執行選擇頁面----選擇預設 upgrade a database ,然後點 next
選擇要升級的(並且當前可用的資料庫),這裡只有一個並已被預設選中,輸入sys使用者密碼  -----next
選擇是否在升級後自動編譯無效的物件,預設是選中的  -------next
 開始執行升級  ---- 需等待一段時間(大概一個小時)
上述操作完成後,點選ok即可,OUI彈出整個操作的返回結果,點選close按鈕關閉視窗。
 
 
 此時可以登陸任意節點,以sqlplus命令列連線進去執行查詢:
~]$ sqlplus / as sysdba
SQL*Plus: Release 10.2.0.4.0 - Production on Wed May 22 07:45:20 2013
Copyright (c) 1982, 2007, Oracle.  All Rights Reserved.

Connected to:
Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 - Production
With the Partitioning, Real Application Clusters, OLAP, Data Mining
and Real Application Testing options
SQL> set linesize 200;
SQL> select * from gv$instance;
   INST_ID INSTANCE_NUMBER INSTANCE_NAME    HOST_NAME                                                        VERSION           STARTUP_T STATUS       PAR    THREAD# ARCHIVE LOG_SWITCH_WAIT LOGINS
---------- --------------- ---------------- ---------------------------------------------------------------- ----------------- --------- ------------ --- ---------- ------- --------------- ----------
SHU DATABASE_STATUS   INSTANCE_ROLE      ACTIVE_ST BLO
--- ----------------- ------------------ --------- ---
         1               1 racdb1           rac1                                                             10.2.0.4.0        21-MAY-13 OPEN            YES          1 STOPPED                 ALLOWED
NO  ACTIVE            PRIMARY_INSTANCE   NORMAL    NO
         2               2 racdb2           rac2                                                             10.2.0.4.0        21-MAY-13 OPEN            YES          2 STOPPED                 ALLOWED
NO  ACTIVE            PRIMARY_INSTANCE   NORMAL    NO

SQL>
 
 
 

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

相關文章