Oracle RAC数据库PSU版本升级

一、备份参数文件并确认当前数据库版本

su - oracle
sqlplus / as sysdba
create pfile='/tmp/jianxiu/dba_info_oraclesid_date.txt' from spfile;
create table t1 as select comp_id,comp_name,version,status,schema,procedure from dba_registry;
create table t2 as select owner,status,count(*) count from dba_objects group by owner,status order by owner,status;
create table t3 as select owner,status,count(*) count from dba_objects where status='INVALID' group by  owner,status order by owner,status;
create table t4 as select  owner,status,object_name,object_type,count(*) count from dba_objects status='INVALID' group by owner,status,object_name,object_type order by owner,status,object_name,object_type;

col action_time for a50
col comments for a50
col version for a15
select action,version,comments,action_time from dba_registry_history;

二、操作步骤

1、停止集群服务(双节点)
#/u01/app/11.2.0/grid/bin/crsctl stop crs

2、备份目录
df -Th

tar -cvf /u01/app/oracle.tar /u01/app/oracle
#/u01/app/19.0.0/grid/bin/crsctl start crs

mkdir -p /tmp/soft
cd /tmp
chmod -R 777 soft
上传PSU和opatch安装包到/tmp/soft目录
cd /tmp/soft
chmod 777 *

3、升级数据库opatch版本(双节点)
su - oracle
cd $ORACLE_HOME
mv OPatch OPatch_date
最新的OPatch的版本是:11.2.0.3.17
unzip /tmp/soft/p6880880_112000_Linux-x86-64.zip -d ./
$ORACLE_HOME/OPatch/opatch version

4、补丁冲突检修(双节点)
su - oracle
cd /tmp/soft
最新的PSU版本是(Oracle Database Patch Set Update 11.2.0.4.200414)
unzip p30670774_112040_Linux-x86-64.zip
cd 30670774
$ORACLE_HOME/OPatch/opatch prereq CheckConflictAgainstOHWithDetail -ph ./

unzip p30805461_112040_Linux-x86-64.zip
cd 30805461
$ORACLE_HOME/OPatch/opatch prereq CheckConflictAgainstOHWithDetail -ph ./

如果检查结果不通过执行补丁回退:
$ORACLE_HOME/OPatch/opatch rollback -id  xxxx
(OPatch会在 $ORACLE_HOME/cfgtoollogs/opatch 目录下生成应用日志,里面会记录所应用补丁的详细信息,包括补丁ID)


5、补丁安装(一节点升级完,等15分钟一节点集群和数据库正常再操作二节点)
su - oracle
cd /tmp/soft/30670774
$ORACLE_HOME/OPatch/opatch apply
遇到询问输入Y
$ORACLE_HOME/OPatch/opatch lsinv

cd /tmp/soft/30805461
$ORACLE_HOME/OPatch/opatch apply
$ORACLE_HOME/OPatch/opatch lsinv

6、启动两节点实例
sqlplus / as sysdba
startup

---------下面部分在同一节点操作-------------
7、升级数据字典
cd $ORACLE_HOME/rdbms/admin
sqlplus / as sysdba
@catbundle.sql psu apply
@utlrp.sql

col action_time for a50
col comments for a50
col version for a15
select action,version,comments,action_time from dba_registry_history;


8、检查失效对象
create table t1_n as select comp_id,comp_name,version,status,schema,procedure from dba_registry;
create table t2_n as select owner,status,count(*) count from dba_objects group by owner,status order by owner,status;
create table t3_n as select owner,status,count(*) count from dba_objects where status='INVALID' group by  owner,status order by owner,status;
create table t4_n as select  owner,status,object_name,object_type,count(*) count from dba_objects status='INVALID' group by owner,status,object_name,object_type order by owner,status,object_name,object_type;

9、重启集群
#/u01/app/11.2.0/grid/bin/crsctl stat res -t
#/u01/app/11.2.0/grid/bin/crsctl stop crs

#/u01/app/11.2.0/grid/bin/crsctl start crs
#/u01/app/11.2.0/grid/bin/crsctl stat res -t

三、回退步骤

(一)数据字典升级失败,补丁回退
1、停止数据库服务
srvctl stop database -d xxxx

2、回退补丁升级
opatch rollback -id 30670774
opatch rollback -id 30805461

3、启动数据库服务
srvctl start database -d xxxx

(二)软件升级失败,备份恢复
1、停止集群服务
/u01/app/11.2.0/grid/bin/crsctl stop crs

2、恢复数据库软件
cd /u01/app/
mv oracle oracle-date.bak
tar -xvf /u01/app/oracle.tar

3、启动集群服务
/u01/app/11.2.0/grid/bin/crsctl start crs

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值