Oracle18c单机安装RU补丁和one-off补丁

Oracle18c单机打RU补丁和one-off补丁

一、单机安装RU补丁

1.环境

Oracle DB Version Oracle Home Current RU Version Preparing to Upgrade RU Version
Oracle18.3.0.0 /u01/app/oracle/product/18.3.0/db_1 18.3 18.5

2.补丁介质准备

由于GI补丁28828717已经包含了GI补丁和Database补丁,所以单机下载28828717或28822489都可以

image-20230324110346396

p6880880_180000_Linux-x86-64.zip
p28828717_180000_Linux-x86-64.zip
p28092783_180000_Linux-x86-64.zip

3.检查当前补丁

[oracle@server01 ~]$ $ORACLE_HOME/OPatch/opatch lspatches
27908644;UPDATE 18.3 DATABASE CLIENT JDK IN ORACLE HOME TO JDK8U171
27923415;OJVM RELEASE UPDATE: 18.3.0.0.180717 (27923415)
28090553;OCW RELEASE UPDATE 18.3.0.0.0 (28090553)
28090523;Database Release Update : 18.3.0.0.180717 (28090523)

OPatch succeeded.

[oracle@server01 OPatch]$ ./opatch lsinventory -all -oh $ORACLE_HOME

[oracle@server01 OPatch]$ export PATH=$ORACLE_HOME/OPatch:$PATH
[oracle@server01 OPatch]$ opatch lsinv |grep -i applied
Patch  27908644     : applied on Thu Jul 19 02:12:38 CST 2018
Patch  27923415     : applied on Thu Jul 19 02:11:07 CST 2018
Patch  28256701     : applied on Thu Jul 19 02:09:56 CST 2018
Patch  28090564     : applied on Thu Jul 19 02:09:46 CST 2018
Patch  28090557     : applied on Thu Jul 19 02:09:34 CST 2018
Patch  28090553     : applied on Thu Jul 19 02:08:33 CST 2018
Patch  28090523     : applied on Thu Jul 19 02:06:33 CST 2018

col comp_name for a40
select comp_id,comp_name,version,status from dba_registry;

set linesize 200 pagesize 500
col action_time for a30
col action for a15
col version for a20
col namespace for a10
col comments for a47
select action_time,action,version,namespace,id,comments from dba_registry_history;

4.检查/处理失效对象

set linesize 200 pagesize 500
col owner for a15
col object_name for a35
select owner,object_name,object_type,status from dba_objects where status='INVALID';

cd $ORACLE_HOME/rdbms/admin
sqlplus /nolog
SQL> CONNECT / AS SYSDBA
SQL> @utlrp.sql

5.校验 Oracle Inventory

Before beginning patch application, check the consistency of inventory information for GI home and each database home to be patched. Run the following command as respective Oracle home owner to check the consistency.

$ <ORACLE_HOME>/OPatch/opatch lsinventory -detail -oh <ORACLE_HOME>

If this command succeeds, it lists the Oracle components that are installed in the home. Save the output so you have the status prior to the patch apply.

6.补丁冲突检查

The fastest and easiest way to determine whether you have one-off patches in the Oracle home that conflict with the patch, and to get the necessary conflict resolution patches, is to use the Patch Recommendations and Patch Plans features on the Patches & Updates tab in My Oracle Support. These features work in conjunction with the My Oracle Support Configuration Manager. Recorded training sessions on these features can be found in Document 603505.1.

However, if you are not using My Oracle Support Patch Plans, the My Oracle Support Conflict Checker tool enables you to upload an OPatch inventory and check the patches that you want to apply to your environment for conflicts.

If no conflicts are found, you can download the patches. If conflicts are found, the tool finds an existing resolution to download. If no resolution is found, it will automatically request a resolution, which you can monitor in the Plans and Patch Requests region of the Patches & Updates tab.

Determine whether any currently installed one-off patches conflict with this patch 28828717 as follows:

  • For Grid Infrastructure Home, as home user:

    % $ORACLE_HOME/OPatch/opatch prereq CheckConflictAgainstOHWithDetail -phBaseDir /28828717/28822489
    % $ORACLE_HOME/OPatch/opatch prereq CheckConflictAgainstOHWithDetail -phBaseDir /28828717/28864593
    % $ORACLE_HOME/OPatch/opatch prereq CheckConflictAgainstOHWithDetail -phBaseDir /28828717/28864607
  • For Database home, as home user:

    % $ORACLE_HOME/OPatch/opatch prereq CheckConflictAgainstOHWithDetail -phBaseDir /28828717/28822489
    % $ORACLE_HOME/OPatch/opatch prereq CheckConflictAgainstOHWithDetail -phBaseDir /28828717/28864593

manually determine whether any currently installed one-off patches conflict with the PSU patch as follows:

  • In the unzipped directory as described in Download and Unzip the Patch.

  • The following commands check for conflicts in both the 12.1 GI home and the 12.1 DB homes.

    • In case you are applying the patch, run this command:
    #GRID_HOME/OPatch/opatchauto apply /28828717 -analyze
    • In case you are rolling back the patch, run this command:
    #GRID_HOME/OPatch/opatchauto rollback /28828717 -analyze

7.检查文件系统可用空间

Check if enough free space is available on the ORACLE_HOME filesystem for the patches to be applied as given below:

  • For Grid Infrastructure Home, as home user:

    1. Create file /tmp/patch_list_gihome.txt with the following content:

      % cat /tmp/patch_list_gihome.txt
      
      /28828717/28822489
      /28828717/28864593
      /28828717/28864607
    2. Run the opatch command to check if enough free space is available in the Grid Infrastructure Home:

      % $ORACLE_HOME/OPatch/opatch prereq CheckSystemSpace -phBaseFile /tmp/patch_list_gihome.txt
  • For Database home, as home user:

    1. Create file /tmp/patch_list_dbhome.txt with the following content:

      % cat /tmp/patch_list_dbhome.txt
      /28828717/28822489
      /28828717/28864593
    2. Run opatch command to check if enough free space is available in the Database Home:

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

The command output reports pass and fail messages as per the system space availability:

  • If OPatch reports Prereq "checkSystemSpace" failed., then cleanup the system space as the required amount of space is not available.
  • If OPatch reports Prereq "checkSystemSpace" passed., then no action is needed. Proceed with patch installation.

Note:

When OPatch starts, it validates the patch and ensures that there are no conflicts with the software already installed in the ORACLE_HOME. OPatch categorizes conflicts into the following types:

  • Conflicts with a patch already applied to the ORACLE_HOME.

    In this case, stop the patch installation and contact Oracle Support Services.

  • Conflicts with subset patch already applied to the ORACLE_HOME.

    In this case, continue with the patch installation because as the new patch contains all the fixes from the existing patch in the ORACLE_HOME. And, in any case, the subset patch will automatically be rolled back prior to the installation of the new patch.

8.查看是否为在线补丁或滚动补丁

1.在线补丁检查
$ORACLE_HOME/OPatch/opatch query -is_online_patch /opt/soft/28828717

Oracle Interim Patch Installer version 12.2.0.1.17
Copyright (c) 2023, Oracle Corporation.  All rights reserved.

It is not a valid online patch:
/opt/soft/28828717

OPatch failed with error code 220
2.滚动补丁检查
$ORACLE_HOME/OPatch/opatch query -is_rolling_patch /opt/soft/28828717/28435192

Oracle Interim Patch Installer version 12.2.0.1.17
Copyright (c) 2023, Oracle Corporation.  All rights reserved.

Oracle Home       : /u01/app/oracle/product/18.3.0/db_1
Central Inventory : /u01/app/oraInventory
   from           : /u01/app/oracle/product/18.3.0/db_1/oraInst.loc
OPatch version    : 12.2.0.1.17
OUI version       : 12.2.0.4.0
Log file location : /u01/app/oracle/product/18.3.0/db_1/cfgtoollogs/opatch/opatch2023-03-18_12-56-37PM_1.log

--------------------------------------------------------------------------------
 Patch is a rolling patch: true
 Patch is a FMW rolling patch: false

OPatch succeeded.

9.关闭数据库相关服务

---关闭DB

---关闭监听

---关闭OEM

10.备份

如果是虚拟机,直接打快照

---备份ORACLE_HOME

---备份/home/oracle

---备份oraInventory

---备份数据

11.安装OPatch

[oracle@server01 ~]$ cd $ORACLE_HOME
[oracle@server01 db_1]$ mv OPatch OPatch.20230324.bak

[root@server01 soft]# unzip p6880880_180000_Linux-x86-64.zip -d /u01/app/oracle/product/18.5.0/db_1/
[root@server01 soft]# chown -R oracle.oinstall /u01/app/oracle/product/18.5.0/db_1/OPatch

[root@server01 soft]# su - oracle
[oracle@server01 ~]$ export PATH=$PATH:/u01/app/oracle/product/18.5.0/db_1/OPatch

[oracle@server01 ~]$ opatch version
OPatch Version: 12.2.0.1.17

OPatch succeeded.

12.安装RU

[root@server01 soft]# unzip p28828717_180000_Linux-x86-64.zip
[root@server01 soft]# chown -R oracle.oinstall 28828717

[root@server01 soft]# su - oracle
Last login: Sat Mar 25 11:21:11 CST 2023 on pts/0

[oracle@server01 ~]$ cd /opt/soft/28828717
[oracle@server01 28828717]$ tree -d -L 1
.
├── 28435192
├── 28547619
├── 28822489
├── 28864593
├── 28864607
└── automation

补丁说明:
28822489  数据库软件补丁
28864593  GI/数据库软件补丁OCW
单机安装上面两个补丁即可

[oracle@server01 28828717]$ export PATH=$PATH:/u01/app/oracle/product/18.5.0/db_1/OPatch
[oracle@server01 28828717]$ cd 28822489
[oracle@server01 28822489]$ opatch apply

[oracle@server01 28822489]$ cd ../28864593
[oracle@server01 28864593]$ opatch apply

[oracle@server01 OPatch]$ opatch lsinv |grep applied
Patch  28864593     : applied on Sat Mar 25 10:29:55 CST 2023
Patch  28822489     : applied on Sat Mar 25 10:27:55 CST 2023
Patch  27908644     : applied on Thu Jul 19 01:44:11 CST 2018
Patch  27923415     : applied on Thu Jul 19 01:41:38 CST 2018

13.加载SQL文件到数据库

If you are not using opatchauto, then load modified SQL files into the database.

Steps Standalone DB Steps Single/Multitenant (CDB/PDB) DB
1 % sqlplus /nolog 1 % sqlplus /nolog
2 SQL> Connect / as sysdba 2 SQL> Connect / as sysdba
3 SQL> startup 3 SQL> startup
4 SQL> quit 4 SQL> alter pluggable database all open;Foot 1
5 % cd $ORACLE_HOME/OPatch 5 SQL> quit
6 % ./datapatch -verbose 6 % cd $ORACLE_HOME/OPatch
7 % ./datapatch -verbose
SQL> startup
ORACLE instance started.

Total System Global Area 2466249080 bytes
Fixed Size                  8898936 bytes
Variable Size             671088640 bytes
Database Buffers         1778384896 bytes
Redo Buffers                7876608 bytes
Database mounted.
Database opened.

SQL> alter pluggable database all open;

Pluggable database altered.

SQL> show pdbs

    CON_ID CON_NAME                       OPEN MODE  RESTRICTED
---------- ------------------------------ ---------- ----------
         2 PDB$SEED                       READ ONLY  NO
         3 CGCRMGLKPDB                    READ WRITE NO

[oracle@server01 ~]$ cd $ORACLE_HOME/OPatch
[oracle@server01 OPatch]$ ./datapatch -verbose

SQL> set linesize 200 pagesize 500
col action_time for a30
col action for a15
col version for a20
col namespace for a10
col comments for a47
select action_time,action,version,namespace,id,comments from dba_registry_history;

image-20230324130037518

14.检查/处理失效对象

set linesize 200 pagesize 500
col owner for a15
col object_name for a35
select owner,object_name,object_type,status from dba_objects where status='INVALID';

[oracle@server01 OPatch]$ cd $ORACLE_HOME/rdbms/admin
[oracle@server01 admin]$ sqlplus / as sysdba

SQL*Plus: Release 18.0.0.0.0 - Production on Sat Mar 25 10:35:28 2023
Version 18.5.0.0.0

Copyright (c) 1982, 2018, Oracle.  All rights reserved.

Connected to:
Oracle Database 18c Enterprise Edition Release 18.0.0.0.0 - Production
Version 18.5.0.0.0

SQL> @utlrp.sql

SQL> alter session set container=CGCRMGLKPDB;

Session altered.

SQL> @utlrp.sql

15.回滚补丁

---关闭数据库相关服务
---回退补丁
[oracle@server01 ~]$ opatch lsinv |grep applied
Patch  28864593     : applied on Sat Mar 25 10:41:34 CST 2023
Patch  28822489     : applied on Sat Mar 25 10:37:20 CST 2023
Patch  27908644     : applied on Thu Jul 19 01:44:11 CST 2018
Patch  27923415     : applied on Thu Jul 19 01:41:38 CST 2018

[oracle@server01 ~]$ opatch rollback -id 28822489
[oracle@server01 ~]$ opatch rollback -id 28864593

[oracle@server01 ~]$ opatch lsinv |grep applied
Patch  27908644     : applied on Thu Jul 19 01:44:11 CST 2018
Patch  27923415     : applied on Thu Jul 19 01:41:38 CST 2018
Patch  28090553     : applied on Thu Jul 19 01:40:01 CST 2018
Patch  28090523     : applied on Thu Jul 19 01:39:24 CST 2018

二、单机安装One-off补丁

One-off: 一次性补丁

1.安装说明

(II) Installation
-----------------
To install the patch, follow these steps:

1.      Set your current directory to the directory where the patch is located and then run the OPatch utility by entering the following comm
ands:

        $ cd <PATCH_TOP_DIR>/28092783

        $ opatch apply

2.      Verify whether the patch has been successfully installed by running the following command:

        $ opatch lsinventory

3.      Start the services from the Oracle home.

(III) Deinstallation
----------------------
Ensure to follow the Prerequsites (Section I). To deinstall the patch, follow these steps:

1.      Deinstall the patch by running the following command:

        $ opatch rollback -id 28092783

2.      Start the services from the Oracle home.

3.      Ensure that you verify the Oracle Inventory and compare the output with the one run before the patch installation and re-apply any pa
tches that were rolled back as part of this patch apply. To verify the inventory, run the following command:

        $ opatch lsinventory

2.准备介质

image-20230324131011689

p28092783_180000_Linux-x86-64.zip

3.检查当前补丁

$ opatch lsinventory
        Note:
        -       If this command succeeds, it will list the Top-Level Oracle Products and one-off patches if any that are installed in the Ora
lce Home.
                        - Save the output so you have the status prior to the patch apply.
        -       If the command displays some errors, then contact Oracle Support and resolve the issue first before proceeding further.

4.检查补丁冲突

(Only for Installation) Determine whether any currently installed interim patches conflict with this patch 28092783 as shown below:
        $ cd <PATCH_TOP_DIR>/28092783
        $ opatch prereq CheckConflictAgainstOHWithDetail -ph ./

        The report will indicate the patches that conflict with this patch and the patches for which the current 28092783 is a superset.

        Note:
        When OPatch starts, it validates the patch and ensures that there are no conflicts with the software already installed in the ORACLE_
HOME. OPatch categorizes conflicts into the following types:
        -       Conflicts with a patch already applied to the ORACLE_HOME that is a subset of the patch you are trying to apply  - In this ca
se, continue with the patch installation because the new patch contains all the fixes from the existing patch in the ORACLE_HOME. The subset
patch will automatically be rolled back prior to the installation of the new patch.
        -       Conflicts with a patch already applied to the ORACLE_HOME - In this case, stop the patch installation and contact Oracle Supp
ort Services.

5.关闭数据库相关服务

Ensure that you shut down all the services running from the Oracle home.
        Note:
                -       For a Non-RAC environment, shut down all the services running from the Oracle home.
                -       For a RAC environment, shut down all the services (database, ASM, listeners, nodeapps, and CRS daemons) running from
the Oracle home of the node you want to patch. After you patch this node, start the services on this node.Repeat this process for each of the
 other nodes of the Oracle RAC system. OPatch is used on only one node at a time.
                -       Please use -local option to apply the patch to the particular node. e.g., opatch apply -local

6.解压并安装

[root@server01 soft]# unzip p28092783_180000_Linux-x86-64.zip
[root@server01 soft]# chown -R oracle.oinstall 28092783

[root@server01 soft]# su - oracle
[oracle@server01 ~]$ export PATH=$PATH:/u01/app/oracle/product/18.5.0/db_1/OPatch
[oracle@server01 ~]$ cd /opt/soft/28092783
[oracle@server01 28092783]$ opatch apply

7.查看补丁

[oracle@server01 28092783]$ opatch lspatches
28092783;TXTPART TEXT QUERIES FAIL WITH ORA 600 [20084]
28864593;OCW RELEASE UPDATE 18.5.0.0.0 (28864593)
28822489;Database Release Update : 18.5.0.0.190115 (28822489)
27908644;UPDATE 18.3 DATABASE CLIENT JDK IN ORACLE HOME TO JDK8U171
27923415;OJVM RELEASE UPDATE: 18.3.0.0.180717 (27923415)

OPatch succeeded.

[oracle@server01 28092783]$ opatch lsinv |grep applied
Patch  28092783     : applied on Sat Mar 25 10:43:23 CST 2023
Patch  28864593     : applied on Sat Mar 25 10:29:55 CST 2023
Patch  28822489     : applied on Sat Mar 25 10:27:55 CST 2023
Patch  27908644     : applied on Thu Jul 19 01:44:11 CST 2018
Patch  27923415     : applied on Thu Jul 19 01:41:38 CST 2018

8.回滚补丁

---关闭数据库相关服务
---回退补丁

[oracle@server01 ~]$ export PATH=$PATH:/u01/app/oracle/product/18.5.0/db_1/OPatch

[oracle@server01 ~]$ opatch lspatches
28092783;TXTPART TEXT QUERIES FAIL WITH ORA 600 [20084]
28864593;OCW RELEASE UPDATE 18.5.0.0.0 (28864593)
28822489;Database Release Update : 18.5.0.0.190115 (28822489)
27908644;UPDATE 18.3 DATABASE CLIENT JDK IN ORACLE HOME TO JDK8U171
27923415;OJVM RELEASE UPDATE: 18.3.0.0.180717 (27923415)

OPatch succeeded.

[oracle@server01 ~]$ opatch lsinv |grep applied
Patch  28092783     : applied on Sat Mar 25 13:25:33 CST 2023
Patch  28864593     : applied on Sat Mar 25 10:41:34 CST 2023
Patch  28822489     : applied on Sat Mar 25 10:37:20 CST 2023
Patch  27908644     : applied on Thu Jul 19 01:44:11 CST 2018
Patch  27923415     : applied on Thu Jul 19 01:41:38 CST 2018

[oracle@server01 ~]$ opatch rollback -id 28092783

[oracle@server01 ~]$ opatch lsinv |grep applied
Patch  28864593     : applied on Sat Mar 25 10:41:34 CST 2023
Patch  28822489     : applied on Sat Mar 25 10:37:20 CST 2023
Patch  27908644     : applied on Thu Jul 19 01:44:11 CST 2018
Patch  27923415     : applied on Thu Jul 19 01:41:38 CST 2018
暂无评论

发送评论 编辑评论


				
|´・ω・)ノ
ヾ(≧∇≦*)ゝ
(☆ω☆)
(╯‵□′)╯︵┴─┴
 ̄﹃ ̄
(/ω\)
∠( ᐛ 」∠)_
(๑•̀ㅁ•́ฅ)
→_→
୧(๑•̀⌄•́๑)૭
٩(ˊᗜˋ*)و
(ノ°ο°)ノ
(´இ皿இ`)
⌇●﹏●⌇
(ฅ´ω`ฅ)
(╯°A°)╯︵○○○
φ( ̄∇ ̄o)
ヾ(´・ ・`。)ノ"
( ง ᵒ̌皿ᵒ̌)ง⁼³₌₃
(ó﹏ò。)
Σ(っ °Д °;)っ
( ,,´・ω・)ノ"(´っω・`。)
╮(╯▽╰)╭
o(*////▽////*)q
>﹏<
( ๑´•ω•) "(ㆆᴗㆆ)
😂
😀
😅
😊
🙂
🙃
😌
😍
😘
😜
😝
😏
😒
🙄
😳
😡
😔
😫
😱
😭
💩
👻
🙌
🖕
👍
👫
👬
👭
🌚
🌝
🙈
💊
😶
🙏
🍦
🍉
😣
Source: github.com/k4yt3x/flowerhd
颜文字
Emoji
小恐龙
花!
上一篇
下一篇