大家好,又见面了,我是全栈君。
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
发布者:全栈程序员栈长,转载请注明出处:https://javaforall.cn/115302.html原文链接:https://javaforall.cn