Oracle 19c RAC RU+OJVM补丁升级方案(19.16, AIX)

传补丁包

cd /u01
mkdir -p soft
chmod -R 777 soft
sftp put
p6880880_190000_AIX64-5L.zip
p34160854_190000_AIX64-5L.zip

更新grid home和oracle home Opatch工具

# You must use the OPatch utility version 12.2.0.1.30 or later to apply this patch.# 更新Oracle home Opatch工具
su – oracle
cd$ORACLE_HOME
mv OPatch OPatch_bak
unzip /u01/soft/p6880880_190000_AIX64-5L.zip -d ./

# 更新Grid home Opatch工具
su – root
cd /u01/app/grid_home
mv OPatch OPatch_bak
unzip /u01/soft/p6880880_190000_AIX64-5L.zip -d ./
chown -R grid:oinstall OPatch/
chmod -R 775 OPatch/

预检查

# 校验Oracle Inventory
su - grid
$ORACLE_HOME/OPatch/opatch lsinventory -detail -oh $ORACLE_HOME
su - oracle
$ORACLE_HOME/OPatch/opatch lsinventory -detail -oh $ORACLE_HOME# 解压补丁包
su – grid
cd /u01/soft
unzip p34160854_190000_AIX64-5L.zip –d ./

# Run OPatch Conflict Check
su - grid
$ORACLE_HOME/OPatch/opatch prereq CheckConflictAgainstOHWithDetail -phBaseDir /u01/soft/34160854/34130714/34133642
$ORACLE_HOME/OPatch/opatch prereq CheckConflictAgainstOHWithDetail -phBaseDir /u01/soft/34160854/34130714/34160635
$ORACLE_HOME/OPatch/opatch prereq CheckConflictAgainstOHWithDetail -phBaseDir /u01/soft/34160854/34130714/34139601
$ORACLE_HOME/OPatch/opatch prereq CheckConflictAgainstOHWithDetail -phBaseDir /u01/soft/34160854/34130714/34318175
$ORACLE_HOME/OPatch/opatch prereq CheckConflictAgainstOHWithDetail -phBaseDir /u01/soft/34160854/34130714/33575402

su - oracle
$ORACLE_HOME/OPatch/opatch prereq CheckConflictAgainstOHWithDetail -phBaseDir /u01/soft/34160854/34130714/34133642
$ORACLE_HOME/OPatch/opatch prereq CheckConflictAgainstOHWithDetail -phBaseDir /u01/soft/34160854/34130714/34160635

# Run OPatch SystemSpace Check
1.Create file /tmp/patch_list_gihome.txt
su - grid
cat /tmp/patch_list_gihome.txt
/u01/soft/34160854/34130714/34133642
/u01/soft/34160854/34130714/34160635
/u01/soft/34160854/34130714/34139601
/u01/soft/34160854/34130714/34318175
/u01/soft/34160854/34130714/33575402

$ORACLE_HOME/OPatch/opatch prereq CheckSystemSpace -phBaseFile /tmp/patch_list_gihome.txt

2.Create file /tmp/patch_list_dbhome.txt 
su - oracle
cat /tmp/patch_list_dbhome.txt
/u01/soft/34160854/34130714/34133642
/u01/soft/34160854/34130714/34160635

$ORACLE_HOME/OPatch/opatch prereq CheckSystemSpace -phBaseFile /tmp/patch_list_dbhome.txt

# One-off Patch Conflict Detection and Resolution# /u01/app/grid_home/OPatch/opatchauto apply /u01/soft/34160854/34130714 -analyze

节点1补丁升级

依次在两个节点运行如下脚本(不能同时运行)

grid补丁升级

# export PATH=$PATH:/u01/app/grid_home/OPatch
# /u01/app/grid_home/OPatch/opatchauto apply /u01/soft/34160854/34130714 -oh /u01/app/grid_home# 

db补丁升级

# /u01/app/oracle/product/19.0.0/db_1/OPatch/opatchauto apply /u01/soft/34160854/34130714 -oh /u01/app/oracle/product/19.0.0/db_1

节点2补丁升级

grid补丁升级

export PATH=$PATH:/u01/app/grid_home/OPatch
/u01/app/grid_home/OPatch/opatchauto apply /u01/soft/34160854/34130714 -oh /u01/app/grid_home

db补丁升级#

/u01/app/oracle/product/19.0.0/db_1/OPatch/opatchauto apply /u01/soft/34160854/34130714 -oh /u01/app/oracle/product/19.0.0/db_1

升级后运行脚本

# 执行datapatch,确保所有PDB处于open状态 (仅在一个节点执行)
su - oracle
sqlplus / as sysdba
startup
alter pluggable database all open;
exit
cd $ORACLE_HOME/OPatch
./datapatch –verbose

# 每个PDB运行重编译脚本
sqlplus / as sysdba
@?/rdbms/admin/utlrp.sql

OJVM补丁升级

预检查

# Run OPatch Conflict Check
$ cd /u01/soft/34160854/34086870
$ opatch prereq CheckConflictAgainstOHWithDetail -ph ./

关闭集群

# Ensure that you shut down all the services running from the Oracle home
# /u01/app/grid_home/bin/crsctl stop crs

补丁升级

# Installation
su - oracle
$ cd /u01/soft/34160854/34086870
$ opatch apply
$ opatch lsinventory

开启集群

# restart crs
# /u01/app/grid_home/bin/crsctl start crs

升级后运行脚本

su - oracle
sqlplus / as sysdba
alter system set cluster_database=false scope=spfile;
srvctl stop database -d ittestdb
### Loading Modified SQL Files Into the Database
su - oracle
sqlplus / as sysdba
startup upgrade
alter pluggable database all open upgrade;
exitcd$ORACLE_HOME/OPatch
./datapatch -verbose

sqlplus / as sysdba
alter system set cluster_database=true scope=spfile;
shutdown immediate
srvctl start database -d ittestdb

# 每个PDB运行重编译脚本
sqlplus / as sysdba
@?/rdbms/admin/utlrp.sql

补丁检查

$ opatch lspatches
SQL>select PATCH_ID,PATCH_TYPE,ACTION,STATUS,TARGET_VERSION from dba_registry_sqlpatch;

补丁回退

RU补丁回退

# /OPatch/opatchauto rollback /34130714
su - oracle
sqlplus / as sysdba
startup
alter pluggable database all open;
exitcd$ORACLE_HOME/OPatch
./datapatch -verbose

# 每个PDB运行重编译脚本
sqlplus / as sysdba
@?/rdbms/admin/utlrp.sql

OJVM补丁回退

# /u01/app/grid_home/bin/crsctl stop crs

$ opatch rollback -id 34086870

# /u01/app/grid_home/bin/crsctl start crs
su - oracle
sqlplus / as sysdba
alter system set cluster_database=false scope=spfile;
srvctl stop database -d ittestdb

### Loading Modified SQL Files Into the Database
su - oracle
sqlplus / as sysdba
startup upgrade
alter pluggable database all open upgrade;
exitcd$ORACLE_HOME/OPatch
./datapatch -verbose

sqlplus / as sysdba
alter system set cluster_database=true scope=spfile;
shutdown immediate
srvctl start database -d ittestdb

# 每个PDB运行重编译脚本
sqlplus / as sysdba
@?/rdbms/admin/utlrp.sql

你可能感兴趣的:(Oracle,oracle,数据库,sql)