ORACLE 1Og RAC 升级实录

来源:互联网 发布:签名设计下载软件 编辑:程序博客网 时间:2024/04/27 15:26
RAC 升级实录
2011-12-07 09:10:11
标签:oracle rac 休闲 upgrade cluster_database
版权声明:原创作品,谢绝转载!否则将追究法律责任。

本节中将演示升级rac的步骤,将rac的版本从10.2.0.1升级到10.2.0.5,对于生产环境而言,升级前需要先对数据库和ocr,表决盘等进行备份!

一:上传升级包到节点1并解压,可以在support.oracle.com上下载到该软件包
[oracle@rac1 patch]$ unzip p8202632_10205_Linux-x86-64.zip 
[oracle@rac1 patch]$ ls
Disk1  p8202632_10205_Linux-x86-64.zip  README.htm

二:关闭所有的rac节点,不推荐使用crs_stop -all命令关闭,容易出现unknown现象

[oracle@rac1 ~]$ 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    ONLINE    rac1        
ora....b1.inst application    ONLINE    ONLINE    rac1        
ora....b2.inst application    ONLINE    ONLINE    rac2

[oracle@rac1 ~]$ 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

三:升级CRS
[oracle@rac1 patch]$ cd Disk1/
[oracle@rac1 Disk1]$ ./runInstaller

按照提示,运行下面两个脚本
[root@rac1 ~]# /u01/app/oracle/product/10.2.0/crs_1/bin/crsctl stop crs
Stopping resources.
Successfully stopped CRS resources 
Stopping CSSD.
Shutting down CSS daemon.
Shutdown request successfully issued.

[root@rac1 ~]# /u01/app/oracle/product/10.2.0/crs_1/install/root102.sh 
Creating pre-patch directory for saving pre-patch clusterware files
Completed patching clusterware files to /u01/app/oracle/product/10.2.0/crs_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 not owned by root
WARNING: directory '/u01/app/oracle' is not owned by 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 may take 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 and EVMR=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/crs_1/install/paramfile.crs' with data used for CRS configuration
Setting CRS configuration values in /u01/app/oracle/product/10.2.0/crs_1/install/paramfile.crs

在rac2节点上运行这两个脚本,完成后点exit按钮完成CRS的升级

四:升级数据库软件,前面升级完crs后,rac会自动启动,因而同样需要先关闭rac服务

[oracle@rac1 ~]$ crs_stat -t -v
Name           Type           R/RA   F/FT   Target    State     Host        
----------------------------------------------------------------------
ora....SM1.asm application    0/5    0/0    OFFLINE   OFFLINE               
ora....C1.lsnr application    0/5    0/0    OFFLINE   OFFLINE               
ora.rac1.gsd   application    0/5    0/0    OFFLINE   OFFLINE               
ora.rac1.ons   application    0/3    0/0    OFFLINE   OFFLINE               
ora.rac1.vip   application    0/0    0/0    OFFLINE   OFFLINE               
ora....SM2.asm application    0/5    0/0    OFFLINE   OFFLINE               
ora....C2.lsnr application    0/5    0/0    OFFLINE   OFFLINE               
ora.rac2.gsd   application    0/5    0/0    OFFLINE   OFFLINE               
ora.rac2.ons   application    0/3    0/0    OFFLINE   OFFLINE               
ora.rac2.vip   application    0/0    0/0    OFFLINE   OFFLINE               
ora.racdb.db   application    0/1    0/1    OFFLINE   OFFLINE               
ora....b1.inst application    0/5    0/0    OFFLINE   OFFLINE               
ora....b2.inst application    0/5    0/0    OFFLINE   OFFLINE  

[oracle@rac1 Disk1]$ ./runInstaller

[root@rac1 ~]# /u01/app/oracle/product/10.2.0/db_1/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_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节点上运行这个脚本!

五:升级数据库,需要先将数据库启动到nomount的状态,修改cluster_database初始化参数,然后重新启动实例,升级数据字典(持续时间较长),从新编译无效的对象等

[oracle@rac1 ~]$ crs_stat -t -v
Name           Type           R/RA   F/FT   Target    State     Host        
----------------------------------------------------------------------
ora....SM1.asm application    0/5    0/0    OFFLINE   OFFLINE               
ora....C1.lsnr application    0/5    0/0    OFFLINE   OFFLINE               
ora.rac1.gsd   application    0/5    0/0    OFFLINE   OFFLINE               
ora.rac1.ons   application    0/3    0/0    OFFLINE   OFFLINE               
ora.rac1.vip   application    0/0    0/0    OFFLINE   OFFLINE               
ora....SM2.asm application    0/5    0/0    OFFLINE   OFFLINE               
ora....C2.lsnr application    0/5    0/0    OFFLINE   OFFLINE               
ora.rac2.gsd   application    0/5    0/0    OFFLINE   OFFLINE               
ora.rac2.ons   application    0/3    0/0    OFFLINE   OFFLINE               
ora.rac2.vip   application    0/0    0/0    OFFLINE   OFFLINE               
ora.racdb.db   application    0/1    0/1    OFFLINE   OFFLINE               
ora....b1.inst application    0/5    0/0    OFFLINE   OFFLINE               
ora....b2.inst application    0/5    0/0    OFFLINE   OFFLINE    
           
[oracle@rac1 ~]$ srvctl start nodeapps -n rac1
[oracle@rac1 ~]$ srvctl start nodeapps -n rac2
[oracle@rac1 ~]$ srvctl start asm -n rac1
[oracle@rac1 ~]$ srvctl start asm -n rac2
[oracle@rac1 ~]$ srvctl start database -d racdb -o nomount

[oracle@rac1 ~]$ crs_stat -t -v
Name           Type           R/RA   F/FT   Target    State     Host        
----------------------------------------------------------------------
ora....SM1.asm application    0/5    0/0    ONLINE    ONLINE    rac1        
ora....C1.lsnr application    0/5    0/0    ONLINE    ONLINE    rac1        
ora.rac1.gsd   application    0/5    0/0    ONLINE    ONLINE    rac1        
ora.rac1.ons   application    0/3    0/0    ONLINE    ONLINE    rac1        
ora.rac1.vip   application    0/0    0/0    ONLINE    ONLINE    rac1        
ora....SM2.asm application    0/5    0/0    ONLINE    ONLINE    rac2        
ora....C2.lsnr application    0/5    0/0    ONLINE    ONLINE    rac2        
ora.rac2.gsd   application    0/5    0/0    ONLINE    ONLINE    rac2        
ora.rac2.ons   application    0/3    0/0    ONLINE    ONLINE    rac2        
ora.rac2.vip   application    0/0    0/0    ONLINE    ONLINE    rac2        
ora.racdb.db   application    0/1    0/1    ONLINE    ONLINE    rac2        
ora....b1.inst application    0/5    0/0    ONLINE    ONLINE    rac1        
ora....b2.inst application    0/5    0/0    ONLINE    ONLINE    rac2

[oracle@rac1 ~]$ sqlplus /nolog
SQL*Plus: Release 10.2.0.5.0 - Production on Tue Dec 6 22:31:24 2011
Copyright (c) 1982, 2010, Oracle.  All Rights Reserved.

SQL> conn /as sysdba
Connected.

SQL> alter system set cluster_database=false scope=spfile;
System altered.

[oracle@rac1 ~]$ srvctl stop database -d racdb
[oracle@rac1 ~]$ srvctl status database -d racdb
Instance racdb1 is not running on node rac1
Instance racdb2 is not running on node rac2

[oracle@rac1 ~]$ sqlplus /nolog

SQL*Plus: Release 10.2.0.5.0 - Production on Tue Dec 6 22:34:09 2011

Copyright (c) 1982, 2010, Oracle.  All Rights Reserved.

SQL> conn /as sysdba
Connected to an idle instance.
SQL> startup upgrade
ORACLE instance started.

Total System Global Area  213909504 bytes
Fixed Size                  2095152 bytes
Variable Size              88082384 bytes
Database Buffers          117440512 bytes
Redo Buffers                6291456 bytes
Database mounted.
Database opened.
SQL> spool /home/oracle/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  213909504 bytes
Fixed Size                  2095152 bytes
Variable Size             159385552 bytes
Database Buffers           46137344 bytes
Redo Buffers                6291456 bytes
Database mounted.
Database opened.

SQL> @?/rdbms/admin/utlrp.sql;

SQL> alter system set cluster_database=true scope=spfile;
System altered.

SQL> shutdown immediate
Database closed.
Database dismounted.
ORACLE instance shut down.

[oracle@rac1 ~]$ srvctl  start database -d racdb 

 六:验证

[oracle@rac1 ~]$ srvctl status database -d racdb
Instance racdb1 is running on node rac1
Instance racdb2 is running on node rac2

[oracle@rac1 ~]$ sqlplus /nolog

SQL*Plus: Release 10.2.0.5.0 - Production on Tue Dec 6 23:25:54 2011

Copyright (c) 1982, 2010, Oracle.  All Rights Reserved.

SQL> conn /as sysdba
Connected.
SQL> select * from v$version;

BANNER
--------------------------------------------------------------------------------
Oracle Database 10g Enterprise Edition Release 10.2.0.5.0 - 64bi
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

 
原创粉丝点击