19c打补丁简易步骤

只愿长相守 提交于 2020-02-28 20:27:51

1. 环境检查

操作过程做好记录,所有节点均检查

1.1 当前补丁情况检查

opatch version

opatch lspatches

1.2 集群状态检查

crsctl stat res -t

 

 

2.OPatch

替换oraclehome和gridhome的OPatch(OPatch版本高于12.2.0.1.17 or later.)

mv $ORACLE_HOME/OPatch $ORACLE_HOME/OPatch.bak

unzip p6880880_xxxxxx_Linux-x86-64.zip -d $ORACLE_HOME

 

确认OPatch版本,所有节点的oracle和grid用户都需要确认

$ORACLE_HOME/OPatch/opatch version

 

3.备份软件

root用户tar /oracle/app即可 (grid和oracle软件不在同一目录下都需要备份)

cd /oracle/

tar -zcf app.tar.gz app

 

4.软件解压和权限

解压psu包并更改权限,包放在单独的目录下

4.1 gi补丁

grid解压补丁

cd <UNZIPPED_PATCH_LOCATION>

unzip p30116789_xxxxx_Linux-x86-64.zip

chmod 777 30116789

chmod -R 777 <UNZIPPED_PATCH_LOCATION>

 

4.2 jvm

oracle解压ojvm补丁

cd <UNZIPPED_PATCH_LOCATION>

unzip p30116789_xxxxx_Linux-x86-64.zip

 

5.补丁冲突检测

5.1 grid空间检查

grid执行:

% $ORACLE_HOME/OPatch/opatch prereq CheckConflictAgainstOHWithDetail -phBaseDir <UNZIPPED_PATCH_LOCATION>/30116789/30125133

% $ORACLE_HOME/OPatch/opatch prereq CheckConflictAgainstOHWithDetail -phBaseDir <UNZIPPED_PATCH_LOCATION>/30116789/30122149

% $ORACLE_HOME/OPatch/opatch prereq CheckConflictAgainstOHWithDetail -phBaseDir <UNZIPPED_PATCH_LOCATION>/30116789/30122167

% $ORACLE_HOME/OPatch/opatch prereq CheckConflictAgainstOHWithDetail -phBaseDir <UNZIPPED_PATCH_LOCATION>/30116789/

% $ORACLE_HOME/OPatch/opatch prereq CheckConflictAgainstOHWithDetail -phBaseDir <UNZIPPED_PATCH_LOCATION>/30116789/29401763

5.2 oracle空间检查

oracle用户执行:

% $ORACLE_HOME/OPatch/opatch prereq CheckConflictAgainstOHWithDetail -phBaseDir <UNZIPPED_PATCH_LOCATION>/30116789/30125133

% $ORACLE_HOME/OPatch/opatch prereq CheckConflictAgainstOHWithDetail -phBaseDir <UNZIPPED_PATCH_LOCATION>/30116789/30122149

 

5.3 如果有冲突,执行回滚

 

$ORACLE_HOME/OPatch/opatch rollback -id <补丁号>

 

 

6.检测空间是否充足

6.1 grid用户执行,创建txt文件并写入patch路径

 

 cat /tmp/patch_list_gihome.txt

 

<UNZIPPED_PATCH_LOCATION>/30116789/30125133

<UNZIPPED_PATCH_LOCATION>/30116789/30122149

<UNZIPPED_PATCH_LOCATION>/30116789/30122167

<UNZIPPED_PATCH_LOCATION>/30116789/

<UNZIPPED_PATCH_LOCATION>/30116789/29401763

 

6.2 grid用户执行,空间检查命令

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

 

6.3 oracle用户执行,创建txt文件并写入patch路径

 

cat /tmp/patch_list_dbhome.txt

<UNZIPPED_PATCH_LOCATION>/30116789/30125133

<UNZIPPED_PATCH_LOCATION>/30116789/30122149

6.4 oracle用户执行,空间检查命令

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

 

 

7.关闭数据库和监听

srvctl stop database -d xxx

srvctl stop listener

srvctl stop scan_listener

 

8.打gi补丁

1个节点打完才能打另一个节点

root用户执行:

<GRIDHOME_DIR>/opatchauto apply <UNZIPPED_PATCH_LOCATION>/30116789

 

 

9.打jvm补丁

1个节点打完才能打另一个

oracle用户执行:

cd <SOFT_DIR>/xxx

opatch prereq CheckConflictAgainstOHWithDetail -ph ./

$ORACLE_HOME/OPatch/opatch apply

 

 

10.运行jvm脚本

跑jvm脚本,数据库打开到update状态

sqlplus / as sysdba

SQL> startup upgrade

SQL> alter pluggable database all open upgrade;

SQL> quit

cd $ORACLE_HOME/OPatch

./datapatch -verbose

sqlplus / as sysdba

SQL> shutdown immediate

 

 

 

11.运行gi脚本

srvctl start database -d xxx

sqlplus / as sysdba

SQL> alter pluggable database all open;

SQL> exit

cd $ORACLE_HOME/OPatch

./datapatch -verbose

 

编译无效存储对象

sqlplus / as sysdba

@?/rdbms/admin/utlrp.sql

 

12.检查

集群状态检查

crsctl stat res -t

 

检查大页

检查监听、服务

 

 

软件补丁版本

opatch lsinv

opatch lspatches

 

数据库里补丁注册版本

set lin 200

col action_time for a30

col namespace for a10

col BUNDLE_SERIES for a10

col action for a10

col version for a25

col comments for a40

select * from dba_registry_history;

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!