千家信息网

ORACLE 12C ADG 安装最新RU补丁

发表于:2024-11-30 作者:千家信息网编辑
千家信息网最后更新 2024年11月30日,参考文档:How do you apply a Patchset,PSU or CPU in a Data Guard Physical Standby configuration (文档 ID 27
千家信息网最后更新 2024年11月30日ORACLE 12C ADG 安装最新RU补丁

参考文档:How do you apply a Patchset,PSU or CPU in a Data Guard Physical Standby configuration (文档 ID 278641.1)


------------------------------------------------------------------------------------------------------

1. Disable REDO transport on Primary.

------------------------------------------------------------------------------------------------------

sys@ora12c.primary> alter system set log_archive_dest_state_2=defer;


------------------------------------------------------------------------------------------------------

2. Shutdown the standby site and apply interim patchsets to the RDBMS binaries as per the README.

------------------------------------------------------------------------------------------------------


2.1 停数据库监听和实例

[oracle@oradb2 ~]$ lsnrctl stop

sys@ora12cdg.primary_instance> shudown immediate;


2.2 更新OPatch到最新版本 [You must use the OPatch utility version 12.2.0.1.14 or later to apply this patch.]

[oracle@oradb2 ~]$ mv $ORACLE_HOME/OPatch $ORACLE_HOME/OPatch.20190426

[oracle@oradb2 ~]$ mv /oradata/OPatch $ORACLE_HOME

[oracle@oradb2 ~]$ $ORACLE_HOME/OPatch/opatch version


2.3 执行补丁冲突检查

[oracle@oradb2 ~]$ cd /oradata/patch/29314339/

[oracle@oradb2 29314339]$ $ORACLE_HOME/OPatch/opatch prereq CheckConflictAgainstOHWithDetail -ph ./


2.4 应用12.2最新 Release Update 29314339

[oracle@oradb2 ~]$ cd /oradata/patch/29314339/

[oracle@oradb2 29314339]$ $ORACLE_HOME/OPatch/opatch apply

Oracle Interim Patch Installer version 12.2.0.1.17

Copyright (c) 2019, Oracle Corporation. All rights reserved.


2.5 检查补丁信息

[oracle@oradb2 29314339]$ $ORACLE_HOME/OPatch/opatch lspatches

29314339;Database Apr 2019 Release Update : 12.2.0.1.190416 (29314339)

28163190;OCW JUL 2018 RELEASE UPDATE 12.2.0.1.180717 (28163190)


------------------------------------------------------------------------------------------------------

3. Start the standby site to mount only, do not restart managed recovery.

------------------------------------------------------------------------------------------------------


[oracle@oradb2 29314339]$ lsnrctl start

[oracle@oradb2 29314339]$ export ORACLE_SID=ora12cdg

idle> startup mount;


------------------------------------------------------------------------------------------------------

4. Shutdown the primary site, apply the Patchset/PSU/CPU patch to the RDBMS binaries and patch the RDBMS itself using the instructions in the README

------------------------------------------------------------------------------------------------------


4.1 停监听和主库

[oracle@oradb1 ~]$ lsnrctl stop

sys@ora12c.primary> shutdown immediate;


4.2 更新OPatch到最新版本

[oracle@oradb1 ~]$ mv $ORACLE_HOME/OPatch $ORACLE_HOME/OPatch.20190426

[oracle@oradb1 ~]$ mv /oradata/OPatch $ORACLE_HOME

[oracle@oradb1 ~]$ $ORACLE_HOME/OPatch/opatch version


4.3 执行补丁冲突检查

[oracle@oradb1 ~]$ cd /oradata/patch/29314339/

[oracle@oradb1 29314339]$ $ORACLE_HOME/OPatch/opatch prereq CheckConflictAgainstOHWithDetail -ph ./


4.4 应用12.2最新 Release Update 29314339

[oracle@oradb1 29314339]$ $ORACLE_HOME/OPatch/opatch apply

Oracle Interim Patch Installer version 12.2.0.1.17

Copyright (c) 2019, Oracle Corporation. All rights reserved.


4.5 检查补丁信息

[oracle@oradb1 29314339]$ $ORACLE_HOME/OPatch/opatch lspatches

29314339;Database Apr 2019 Release Update : 12.2.0.1.190416 (29314339)

28163190;OCW JUL 2018 RELEASE UPDATE 12.2.0.1.180717 (28163190)


4.6 应用数据库补丁

[oracle@oradb1 29314339]$ sqlplus /nolog

idle> conn / as sysdba

idle> startup;

idle> show pdbs;


--如果pdb状态不是READ WRITE,打开pdb

idle> alter pluggable database all open;

idle> exit;


[oracle@oradb1 29314339]$ cd $ORACLE_HOME/OPatch

[oracle@oradb1 OPatch]$ ./datapatch -verbose


Note: Datapatch will only apply or rollback SQL fixes for PDBs

that are in an open state, no patches will be applied to closed PDBs.

Please refer to Note: Datapatch: Database 12c Post Patch SQL Automation

(Doc ID 1585822.1)


SQL Patching tool complete on Fri Apr 26 13:55:24 2019


4.7 检查补丁应用日志

[oracle@oradb1 OPatch]$ cd $ORACLE_BASE/cfgtoollogs/sqlpatch/29314339/


Check the following log files in $ORACLE_BASE/cfgtoollogs/sqlpatch/29314339/ for errors:

29314339_apply___.log


4.8 编译无效对象

[oracle@oradb1 29314339]$ cd $ORACLE_HOME/rdbms/admin


[oracle@oradb1 admin]$ sqlplus /nolog

idle> conn / as sysdba

sys@ora12c.primary> set linesize 160;

sys@ora12c.primary> col owner for a15;

sys@ora12c.primary> select owner, count(1) from dba_objects where status = 'INVALID' group by owner;


sys@ora12c.primary> @utlrp.sql


sys@ora12c.primary> select owner, count(1) from dba_objects where status = 'INVALID' group by owner;


------------------------------------------------------------------------------------------------------

5. Start the primary site, re-enable log shipping to the standby.

------------------------------------------------------------------------------------------------------


sys@ora12c.primary> alter system set log_archive_dest_state_2=enable;


------------------------------------------------------------------------------------------------------

6. At the standby site start the MRP(managed recovery).

------------------------------------------------------------------------------------------------------


sys@ora12cdg.physical_standby> alter database open;

sys@ora12cdg.physical_standby> alter database recover managed standby database disconnect from session;


------------------------------------------------------------------------------------------------------

7. 主备切换

------------------------------------------------------------------------------------------------------

sys@ora12c.primary> alter database switchover to ora12cdg verify;


sys@ora12c.primary> alter database switchover to ora12cdg;


0