RAC 10.2.0.1 升級到 10.2.0.5
一、 准備:
Patch 包:p8202632_10205_LINUX.zip
節點數:3個節點
RAC1 RAC2 RAC3
當前節點狀態
節點1:
[root@rac1 bin]# ./crs_stat -t
Name Type Target State Host
------------------------------------------------------------
ora....B1.inst application ONLINE ONLINE rac1
ora....B2.inst application ONLINE ONLINE rac2
ora....B3.inst application ONLINE ONLINE rac3
ora.RACDB.db application ONLINE ONLINE rac1
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....SM3.asm application ONLINE ONLINE rac3
ora....C3.lsnr application ONLINE ONLINE rac3
ora.rac3.gsd application ONLINE ONLINE rac3
ora.rac3.ons application ONLINE ONLINE rac3
ora.rac3.vip application ONLINE ONLINE rac3
查看當前數據庫版本
SYS@RACDB1>select * from v$version;
BANNER
----------------------------------------------------------------
Oracle Database 10g Enterprise Edition Release10.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
二、 集群軟件升級
2.1 上傳升級需要的 patch
[root@rac1 soft]# chown oracle:oinstall -R Disk1/
[root@rac1 soft]# ll
drwxr-xr-x 5 oracle oinstall 4096 Jul 23 2010 Disk1
2.2 切換到oracle用戶下進行
[root@rac1 Disk1]# su - oracle
[oracle@rac1 ~]$ cd /soft/Disk1/
[oracle@rac1 Disk1]$ ls
install patch_note.htm response runInstaller stage
[oracle@rac1 Disk1]$ ll
total 184
drwxr-xr-x 4oracle oinstall 4096 Apr 20 2010 install
-rwxrwxr-x 1oracle oinstall 165290 Jul 23 2010patch_note.htm
drwxr-xr-x 2oracle oinstall 4096 Apr 20 2010 response
-rwxr-xr-x 1oracle oinstall 3927 Apr 20 2010 runInstaller
drwxr-xr-x 11 oracle oinstall 4096 Jul 19 2010 stage
2.3 用srvctl 工具關閉進程和資源
注:依次在每個節點上執行!!!
[oracle@rac1 Disk1]$ srvctl stop nodeapps -n rac1
[oracle@rac2 ]$ srvctl stop nodeapps -n rac2
[oracle@rac3 ]$ srvctl stop nodeapps -n rac3
[oracle@rac1 Disk1]$ crs_stat -t
Name Type Target State Host
------------------------------------------------------------
ora....B1.inst application OFFLINE OFFLINE
ora....B2.inst application OFFLINE OFFLINE
ora....B3.inst application OFFLINE OFFLINE
ora.RACDB.db application OFFLINE OFFLINE
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....SM3.asm application OFFLINE OFFLINE
ora....C3.lsnr application OFFLINE OFFLINE
ora.rac3.gsd application OFFLINE OFFLINE
ora.rac3.ons application OFFLINE OFFLINE
ora.rac3.vip application OFFLINE OFFLINE
2.4 開始安裝 patch
[root@rac1 Disk1]# xhost +
access control disabled, clients can connect fromany host
[root@rac1 Disk1]# su - oracle
[oracle@rac1 ~]$ cd /soft/Disk1/
[oracle@rac1 Disk1]$ ./runInstaller
選擇安裝CRS補丁位置,必須和以前位置一樣!!!
有warning 說 swap空間不足 選中 下一步
總體配置預覽 開始安裝
此處特別注意!!!看一下是否需要執行腳本
剛好沒截上圖 一定按照順序執行!!!
節點1 :
[root@rac1 crsd]#/u01/app/oracle/product/10.2.0/db_1/bin/crsctl stop crs
Stopping resources.
Successfully stopped CRS resources
Stopping CSSD.
Shutting down CSS daemon.
Shutdown request successfully issued.
[root@rac1 crsd]#/u01/app/oracle/product/10.2.0/db_1/install/root102.sh
Creating pre-patch directory for saving pre-patchclusterware files
Completed patching clusterware files to/u01/app/oracle/product/10.2.0/db_1
Relinking some shared libraries.
Relinking of patched files is complete.
WARNING: directory '/u01/app/oracle/product/10.2.0'is not owned by root
WARNING: directory '/u01/app/oracle/product' is notowned by root
WARNING: directory '/u01/app/oracle' is not ownedby root
WARNING: directory '/u01/app' is not owned by root
WARNING: directory '/u01' 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.
Starting up the CRS daemons.
Waiting for the patched CRS daemons to start.
This maytake a while on some systems.
.
10205 patch successfully applied.
clscfg: EXISTING configuration version 3 detected.
clscfg: version 3 is 10G Release 2.
Successfully deleted 1 values from OCR.
Successfully deleted 1 keys from OCR.
Successfully accumulated necessary OCR keys.
Using ports: CSS=49895 CRS=49896 EVMC=49898 andEVMR=49897.
node <nodenumber>: <nodename><private interconnect name> <hostname>
node 1: rac1 rac1-priv rac1
Creating OCR keys for user 'root', privgrp 'root'..
Operation successful.
clscfg -upgrade completed successfully
Creating'/u01/app/oracle/product/10.2.0/db_1/install/paramfile.crs' with data used forCRS configuration
Setting CRS configuration values in/u01/app/oracle/product/10.2.0/db_1/install/paramfile.crs
節點2 :
[root@rac1 crsd]#/u01/app/oracle/product/10.2.0/db_1/bin/crsctl stop crs
[root@rac1 crsd]#/u01/app/oracle/product/10.2.0/db_1/install/root102.sh
節點3:
[root@rac1 crsd]#/u01/app/oracle/product/10.2.0/db_1/bin/crsctl stop crs
[root@rac1 crsd]#/u01/app/oracle/product/10.2.0/db_1/install/root102.sh
2.5 查看狀態
[oracle@rac1 Disk1]$ crs_stat -t
Name Type Target State Host
------------------------------------------------------------
ora....B1.inst application ONLINE ONLINE rac1
ora....B2.inst application ONLINE ONLINE rac2
ora....B3.inst application ONLINE ONLINE rac3
ora.RACDB.db application ONLINE ONLINE rac1
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....SM3.asm application ONLINE ONLINE rac3
ora....C3.lsnr application ONLINE ONLINE rac3
ora.rac3.gsd application ONLINE ONLINE rac3
ora.rac3.ons application ONLINE ONLINE rac3
ora.rac3.vip application ONLINE ONLINE rac3
三、 數據庫軟件升級
最好在建庫之前進行數據庫的升級,我這裡是建庫之後進行的
3.1 停止 em 和 isqlplus
[oracle@rac1 Disk1]$ export ORACLE_SID=RACDB1
[oracle@rac1 Disk1]$ emctl stop dbconsole
TZ set to PRC
Oracle Enterprise Manager 10g Database ControlRelease 10.2.0.1.0
Copyright (c) 1996, 2005 Oracle Corporation. All rights reserved.
http://rac1:1158/em/console/aboutApplication
Stopping Oracle Enterprise Manager 10g DatabaseControl ...
... Stopped.
[oracle@rac1 Disk1]$ isqlplusctl stop
iSQL*Plus 10.2.0.1.0
Copyright (c) 2003, 2005, Oracle. All rights reserved.
iSQL*Plus instance on port 5560 is not running ...
3.2 關閉服務和實例
各個節點都執行!!!
[oracle@rac1 ~]$ srvctl stop nodeapps -n rac1
[oracle@rac2 ~]$ srvctl stop nodeapps -n rac2
[oracle@rac3~ ]$ srvctl stop nodeapps -n rac3
[oracle@rac1 Disk1]$ crs_stat -t
Name Type Target State Host
------------------------------------------------------------
ora....B1.inst application OFFLINE OFFLINE
ora....B2.inst application OFFLINE OFFLINE
ora....B3.inst application OFFLINE OFFLINE
ora.RACDB.db application OFFLINE OFFLINE
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....SM3.asm application OFFLINE OFFLINE
ora....C3.lsnr application OFFLINE OFFLINE
ora.rac3.gsd application OFFLINE OFFLINE
ora.rac3.ons application OFFLINE OFFLINE
ora.rac3.vip application OFFLINE OFFLINE
注:如果虛擬機老重啟的話 直接兩個節點 crs 都關了
./crsctl stop crs
選擇數據庫安裝的目錄:
Not execute 和 warning的都勾選了 下一步
開始安裝
按順序執行腳本
執行完下面的腳本再點擊OK
最好別用ssh 怕某些權限情況!
節點1 :
[root@rac1 bin]# /u01/app/oracle/product/10.2.0/db_2/root.sh
Running Oracle 10g root.sh script...
The following environment variables are set as:
ORACLE_OWNER= oracle
ORACLE_HOME= /u01/app/oracle/product/10.2.0/db_2
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]:
The file "oraenv" already exists in/usr/local/bin. Overwrite it? (y/n)
[n]:
The file "coraenv" already exists in/usr/local/bin. Overwrite it? (y/n)
[n]:
Entries will be added to the /etc/oratab file asneeded by
Database Configuration Assistant when a database iscreated
Finished running generic part of root.sh script.
Now product-specific root actions will beperformed.
節點2:
[root@rac2 cssd]#/u01/app/oracle/product/10.2.0/db_2/root.sh
Running Oracle 10g root.sh script...
The following environment variables are set as:
ORACLE_OWNER= oracle
ORACLE_HOME= /u01/app/oracle/product/10.2.0/db_2
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]:
The file "oraenv" already exists in/usr/local/bin. Overwrite it? (y/n)
[n]:
The file "coraenv" already exists in/usr/local/bin. Overwrite it? (y/n)
[n]:
Entries will be added to the /etc/oratab file asneeded by
Database Configuration Assistant when a database iscreated
Finished running generic part of root.sh script.
Now product-specific root actions will beperformed.
節點3
[root@rac3 cssd]#/u01/app/oracle/product/10.2.0/db_2/root.sh
Running Oracle 10g root.sh script...
The following environment variables are set as:
ORACLE_OWNER= oracle
ORACLE_HOME= /u01/app/oracle/product/10.2.0/db_2
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]:
The file "oraenv" already exists in/usr/local/bin. Overwrite it? (y/n)
[n]:
The file "coraenv" already exists in/usr/local/bin. Overwrite it? (y/n)
[n]:
Entries will be added to the /etc/oratab file asneeded by
Database Configuration Assistant when a database iscreated
Finished running generic part of root.sh script.
Now product-specific root actions will beperformed.
四、 數據庫升級
4.1 當前crs的狀態 --看著就感覺很和諧!!
[root@rac1 bin]# ./crs_stat -t
Name Type Target State Host
------------------------------------------------------------
ora....B1.inst application ONLINE OFFLINE
ora....B2.inst application ONLINE OFFLINE
ora....B3.inst application ONLINE OFFLINE
ora.RACDB.db application ONLINE OFFLINE
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....SM3.asm application ONLINE ONLINE rac3
ora....C3.lsnr application ONLINE ONLINE rac3
ora.rac3.gsd application ONLINE ONLINE rac3
ora.rac3.ons application ONLINE ONLINE rac3
ora.rac3.vip application ONLINE ONLINE rac3
升級數據庫比較簡單,dbua的方式更簡單,這裡介紹手動升級方式
4.2 在其中任意一個節點執行:
本次在rac1上執行
[oracle@rac1 ~]$ export ORACLE_SID=RACDB1
[oracle@rac1 ~]$ sqlplus / as sysdba
SQL*Plus: Release 10.2.0.5.0 - Production on ThuAug 28 13:37:32 2014
Copyright (c) 1982, 2010, Oracle. All Rights Reserved.
Connected to an idle instance.
SQL> startup nomount;
ORACLE instance started.
Total System Global Area 285212672 bytes
Fixed Size 1273276 bytes
Variable Size 109052484 bytes
Database Buffers 171966464 bytes
Redo Buffers 2920448 bytes
SQL> alter system set sga_max_size=400Mscope=spfile;
System altered.
SQL> alter system set sga_target=400Mscope=spfile;
System altered.
SQL> show parameter shared
NAME TYPE VALUE
------------------------------------ -----------------------------------------
hi_shared_memory_address integer 0
max_shared_servers integer
shared_memory_address integer 0
shared_pool_reserved_size big integer 5033164
shared_pool_size big integer 0
shared_server_sessions integer
shared_servers integer 1
SQL> alter system set shared_pool_size='150M'scope=spfile;
System altered.
SQL> alter system set java_pool_size='150M'scope=spfile;
System altered.
SQL> show parameter cluster
NAME TYPE VALUE
------------------------------------ -----------------------------------------
cluster_database boolean TRUE
cluster_database_instances integer 2
cluster_interconnects string
SQL> alter system set cluster_database=falsescope=spfile;
System altered.
注:保證shared_pool_size 和 java_pool_size 不小於150m。因為數據文件是共享的,所以升級的時候只需要在一個節點升級就行,所以要把CLUSTER_DATABASE設置成FALSE
4.3 執行更新腳本
SQL> shutdown immediate
SQL> startup upgrade
SQL> spool /tmp/patch.log
SQL> @?/rdbms/admin/catupgrd.sql
SQL> spool off
檢查日志中有沒有錯誤,如果沒有則啟動數據庫: --文件數量很多
SQL> shutdown immediate
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL> startup
ORACLE instance started.
Total System Global Area 419430400 bytes
Fixed Size 1274068 bytes
Variable Size 331353900 bytes
Database Buffers 83886080 bytes
Redo Buffers 2916352 bytes
Database mounted.
Database opened.
4.4 編譯無效對象
SQL> @?/rdbms/admin/utlrp.sql
4.5 改參數
SQL> show parameter cluster
NAME TYPE VALUE
------------------------------------ -----------------------------------------
cluster_database boolean FALSE
cluster_database_instances integer 1
cluster_interconnects string
SQL> alter system set cluster_database=truescope=spfile;
System altered.
4.6 重啟數據庫,升級完成
SQL> shutdown immediate
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL> startup
ORACLE instance started.
Total System Global Area 419430400 bytes
Fixed Size 1274068 bytes
Variable Size 331353900 bytes
Database Buffers 83886080 bytes
Redo Buffers 2916352 bytes
Database mounted.
Database opened.
SQL> select * from v$version;
BANNER
----------------------------------------------------------------
Oracle Database 10g Enterprise Edition Release10.2.0.5.0 - Prod
PL/SQL Release 10.2.0.5.0 - Production
CORE 10.2.0.5.0 Production
TNS for Linux: Version 10.2.0.5.0 - Production
NLSRTL Version 10.2.0.5.0 - Production