- 补丁升级流程
- 补丁升级
- 停止集群备份家目录
- 补丁升级
两节点分别操作 cd /u01/app/19.3.0/grid/bin/ crsctl stop crs tar -zcvf /u01/app.tar.gz /u01/app /u01/app/19.0.0/grid/bin/crsctl start crs |
-
-
- 两节点OPatch替换
-
--- 表示 root 用户,$ 表示 Oracle 用户提示符,(ASM1)$ 表示 grid 用户 # cd /u01/app/19.3.0/grid # mv OPatch OPatch.bak20 # chown -R grid:oinstall /soft # unzip p6880880_19c_19.20_Linux-x86-64.zip # cp -r OPatch /u01/app/19.3.0/grid/ # chown grid:oinstall -R /u01/app/19.3.0/grid/OPatch su - grid cd /u01/app/19.3.0/grid/OPatch ./opatch version $ opatch version [grid@p19c01:/u01/app/19.3.0/grid/OPatch]$ ./opatch version OPatch Version: 12.2.0.1.39 OPatch succeeded. $ cd $ORACLE_HOME $ mv OPatch/ OPatch_bak20 su root chown -R oracle:oinstall /soft cp -r /soft/OPatch ./ cd OPatch ./opatch version [oracle@p19c01:/u01/app/oracle/product/19.3.0/db/OPatch]$ ./opatch version OPatch Version: 12.2.0.1.39 OPatch succeeded. [oracle@p19c01:/u01/app/oracle/product/19.3.0/db/OPatch]$ |
升级后:
r19c01(oracle)
r19c01(grid)
r19c02(oracle)
r19c02(grdi)
-
-
- 收集补丁信息(两节点)
-
grid用户
su - root chown grid:oinstall -R /soft su - grid $ORACLE_HOME/OPatch/opatch lsinventory > /soft/grid_patch.txt $ORACLE_HOME/OPatch/opatch lsinv -detail -oh $ORACLE_HOME >> /soft/grid_patch.txt $ORACLE_HOME/OPatch/opatch lspatches >> /soft/grid_patch.txt |
oracle用户
su - root chown oracle:oinstall -R /soft chown oracle:oinstall -R /OPatch su - oracle $ORACLE_HOME/OPatch/opatch lsinventory > /soft/oracle_patch.txt $ORACLE_HOME/OPatch/opatch lsinv -detail -oh $ORACLE_HOME >> /soft/oracle_patch.txt $ORACLE_HOME/OPatch/opatch lspatches >> /soft/oracle_patch.txt |
-
-
- 补丁冲突验证
-
cd /soft unzip 19c_19.20_Linux-x86-64.zip chmod -R 777 35319490 我们可以下载readme文件查看 Grid: $ORACLE_HOME/OPatch/opatch prereq CheckConflictAgainstOHWithDetail -phBaseDir /soft/35319490/35320081 $ORACLE_HOME/OPatch/opatch prereq CheckConflictAgainstOHWithDetail -phBaseDir /soft/35319490/35320149 $ORACLE_HOME/OPatch/opatch prereq CheckConflictAgainstOHWithDetail -phBaseDir /soft/35319490/35332537 $ORACLE_HOME/OPatch/opatch prereq CheckConflictAgainstOHWithDetail -phBaseDir /soft/35319490/35553096 $ORACLE_HOME/OPatch/opatch prereq CheckConflictAgainstOHWithDetail -phBaseDir /soft/35319490/33575402 Oracle: $ORACLE_HOME/OPatch/opatch prereq CheckConflictAgainstOHWithDetail -phBaseDir /soft/35319490/35320081 $ORACLE_HOME/OPatch/opatch prereq CheckConflictAgainstOHWithDetail -phBaseDir /soft/35319490/35320149 |
-
-
- 补丁空间验证
-
Grid用户查看 vi /soft/patch_list_gihome.txt cat /soft/patch_list_gihome.txt 下面的内容是写到/soft/patch_list_gihome.txt /soft/35319490/35320081 /soft/35319490/35320149 /soft/35319490/35332537 /soft/35319490/35553096 /soft/35319490/33575402 chown grid:oinstall -R /soft/patch_list_gihome.txt su - grid $ORACLE_HOME/OPatch/opatch prereq CheckSystemSpace -phBaseFile /soft/patch_list_gihome.txt Oracle用户查看 su - root vi /soft/patch_list_dbhome.txt cat /soft/patch_list_dbhome.txt /soft/35319490/35320081 /soft/35319490/35320149 chown oracle:oinstall -R /soft/patch_list_dbhome.txt su - oracle $ORACLE_HOME/OPatch/opatch prereq CheckSystemSpace -phBaseFile /soft/patch_list_dbhome.txt |
-
- 补丁预演
root: /u01/app/oracle/product/19.3.0/db/OPatch/opatchauto apply /soft/35319490 -oh /u01/app/oracle/product/19.3.0/db -analyze /u01/app/19.3.0/grid/OPatch/opatchauto apply /soft/35319490 -oh /u01/app/19.3.0/grid -analyze |
-
-
- 组件检查,无效对象检查
-
su - oracle sqlplus / as sysdba spool /soft/database_invalid.sql set lines 200 pages 2000; show parameter name; col comp_id for a20; col version for a20; col status for a30; select comp_id,version,status from dba_registry; select owner,object_type,object_name from dba_objects where status<>'VALID'; spool off; |
-
- 补丁更新
可以grid和oracle同时打也可以分开打 |
首先检测集群的状态,保证集群是正常工作的 su - oracle srvctl status database -d p19c0 如果没启动,记得启动一下实例 srvctl start instance -d p19c0 -i p19c01 srvctl start instance -d p19c0 -i p19c02 可以在grid中查看 su - grid cd /u01/app/19.3.0/grid/bin crsctl status res -t |
接着我们按照readme的要求将OPatch的路径加入到.bash_profile中 su - root vi .bash_profile export PATH=$PATH:$HOME/bin:/u01/app/19.3.0/grid/bin export PATH=$PATH:/u01/app/19.3.0/grid/OPatch source .bash_profile |
补丁冲突检查 ps -ef | grep sqlplus //如果有sqlplus连进去都需要杀掉,两个节点都检查 su - root export PERL5LIB=/u01/app/19.3.0/grid/perl/lib cd / opatchauto apply /soft/35319490 -analyze 给grid用户打补丁 ps -ef | grep sqlplus export PERL5LIB=/u01/app/19.3.0/grid/perl/lib opatchauto apply /soft/35319490 ps -ef | grep sqlplus export PERL5LIB=/u01/app/19.3.0/grid/perl/lib /u01/app/19.3.0/grid/OPatch/opatchauto apply /soft/35319490 -oh /u01/app/19.3.0/grid -analyze ps -ef | grep sqlplus export PERL5LIB=/u01/app/19.3.0/grid/perl/lib /u01/app/19.3.0/grid/OPatch/opatchauto apply /soft/35319490 -oh /u01/app/19.3.0/grid 给oracle用户打补丁 ps -ef | grep sqlplus export PERL5LIB=/u01/app/19.3.0/grid/perl/lib /u01/app/oracle/product/19.3.0/db/OPatch/opatchauto apply /soft/35319490 -oh /u01/app/oracle/product/19.3.0/db -analyze ps -ef | grep sqlplus export PERL5LIB=/u01/app/19.3.0/grid/perl/lib /u01/app/oracle/product/19.3.0/db/OPatch/opatchauto apply /soft/35319490 -oh /u01/app/oracle/product/19.3.0/db |
-
-
- 补丁检查
-
opatch lsinventory |
-
-
- 回退补丁
-
opatchauto rollback /soft/35319490 |
-
- 打补丁
- 节点二打补丁
- 打补丁
chown oracle:oinstall -R /soft/35319490 首先检测集群的状态,保证集群是正常工作的 su - oracle srvctl status database -d p19c0 如果没启动,记得启动一下实例 srvctl start instance -d p19c0 -i p19c01 srvctl start instance -d p19c0 -i p19c02 可以在grid仲查看 cd /u01/app/19.3.0/grid/bin crsctl status res -t 接着我们按照readme的要求将OPatch的路径加入到.bash_profile中 su - root vi .bash_profile PATH=$PATH:$HOME/bin:/u01/app/19.3.0/grid/bin export PATH=$PATH:/u01/app/19.3.0/grid/OPatch source .bash_profile 我们要将sqlplus进程都退出 补丁冲突检查 ps -ef | grep sqlplus //如果有sqlplus连进去都需要杀掉,两个节点都检查 su - root chmod 660 /u01/app/oraInventory/ContentsXML/oui-patch.xml chown grid:oinstall -R /u01/app/oraInventory/ContentsXML/oui-patch.xml su - root cd / export PERL5LIB=/u01/app/19.3.0/grid/perl/lib opatchauto apply /soft/35319490 -analyze 打补丁 ps -ef | grep sqlplus export PERL5LIB=/u01/app/19.3.0/grid/perl/lib su - oracle cd $ORACLE_HOME/OPatch ./opatch lspatches |
opatchauto rollback /soft/33182768 opatchauto rollback /soft/33182768 -oh /u01/app/19.3.0/grid |
-
-
- 当节点一打开后再进行补丁注册,编译无效对象
-
将修改后的SQL文件加载到数据库中 下表是针对独立数据库运行Datapatch实用程序的步骤,在一个节点执行即可。 sqlplus / as sysdba startup upgrade quit cd $ORACLE_HOME/OPatch ./datapatch -verbose |
查看patch set linesize 200; col STATUS format a20; col DESCRIPTION format a80; select PATCH_ID,PATCH_TYPE,STATUS,DESCRIPTION from dba_registry_sqlpatch; 查看是否有存在失效对象: col owner for a16 col object_name for a50 trunc col object_type for a20 trunc select owner,object_name,object_type from dba_objects where status != 'VALID'; --若有,执行命令清空: @?/rdbms/admin/utlrp.sql |
-
-
- 打完补丁后检查
-
crsctl query crs releasepatch crsctl query crs softwarepatch kfod op=patches |
-
-
- 检查
-
启动数据库 startup 将修改后的SQL文件加载到数据库中 下表是针对独立数据库运行Datapatch实用程序的步骤,在一个节点执行即可。 sqlplus / as sysdba startup upgrade quit cd $ORACLE_HOME/OPatch ./datapatch -verbose 查看patch set linesize 200; col STATUS format a20; col DESCRIPTION format a80; select PATCH_ID,PATCH_TYPE,STATUS,DESCRIPTION from dba_registry_sqlpatch; 查看是否有存在失效对象: col owner for a16 col object_name for a50 trunc col object_type for a20 trunc select owner,object_name,object_type from dba_objects where status != 'VALID'; --若有,执行命令清空: @?/rdbms/admin/utlrp.sql |
- 补丁回退
- 节点一
su - root chown oracle:oinstall -R /soft chown oracle:oinstall -R /soft/35642822 /u01/app/19.3.0/grid/OPatch/opatchauto rollback /soft/35642822-oh /u01/app/19.3.0/grid chown oracle:oinstall -R /soft chown oracle:oinstall -R /soft/35642822 /u01/app/oracle/product/19.3.0/db/OPatch/opatchauto rollback /soft/35642822-oh /u01/app/oracle/product/19.3.0/db |
-
- 节点二
su - root chown oracle:oinstall -R /soft chown oracle:oinstall -R /soft/35642822 /u01/app/19.3.0/grid/OPatch/opatchauto rollback /soft/35642822-oh /u01/app/19.3.0/grid chown oracle:oinstall -R /soft chown oracle:oinstall -R /soft/35642822 /u01/app/oracle/product/19.3.0/db/OPatch/opatchauto rollback /soft/35642822-oh /u01/app/oracle/product/19.3.0/db |
-
- 回退之后检查
select owner,object_type,object_name from dba_objects where status<>'VALID'; cd $ORACLE_HOME/rdbms/admin sqlplus / as sysdba @utlrp.sql select * from product_component_version; |