Oracle Patch清理

场景:
在对Oracle安装补丁后,会发现OS上被占用了大量的空间,本文档清理Opatch过程中的一些文件,释放空间

参考文档:
Can You Delete $ORACLE_HOME/.patch_storage Directory ? (Doc ID 403218.1)
How To Avoid Disk Full Issues Because OPatch Backups Take Big Amount Of Disk Space. (Doc ID 550522.1)

-- 查看$ORACLE_HOME下的隐藏文件夹.patch_storage。 可以看到之前的补丁过程,产生的一些文件。这些文件主要用于rollback补丁,如果不需要,可以清除,以释放空间。

[oracle@19ctest .patch_storage]$ du -sm *
1       29517242_Apr_17_2019_23_27_10
1       29585399_Apr_9_2019_19_12_47
2314    35042068_Apr_6_2023_15_25_04
1941    35320081_Jul_15_2023_12_54_11
2071    35643107_Oct_3_2023_13_34_29
1939    35943157_Jan_13_2024_05_42_55
2138    36233263_Apr_8_2024_17_16_56
1       interim_inventory.txt
1       LatestOPatchSession.properties
1       NApply
1       newdirs.txt
1       record_inventory.txt
[oracle@19ctest .patch_storage]$ pwd
/u01/app/oracle/product/19.0.0/db_1/.patch_storage
[oracle@19ctest .patch_storage]$ 

-- /u01目录剩余17G 

[oracle@19ctest .patch_storage]$ df -h
Filesystem                   Size  Used Avail Use% Mounted on
devtmpfs                     4.3G     0  4.3G   0% /dev
tmpfs                        4.4G     0  4.4G   0% /dev/shm
tmpfs                        4.4G  8.8M  4.4G   1% /run
tmpfs                        4.4G     0  4.4G   0% /sys/fs/cgroup
/dev/mapper/ol_19cdg01-root   17G  4.1G   13G  24% /
/dev/sdc1                    120G   74G   47G  62% /oradata
/dev/sdd1                    120G   60G   61G  50% /arch
/dev/sda1                   1014M  169M  846M  17% /boot
/dev/sde1                    100G   24G   76G  24% /mysql
/dev/sdf1                    120G   47G   74G  39% /oradatapdb
/dev/sdb1                     40G   24G   17G  59% /u01
tmpfs                        883M     0  883M   0% /run/user/0
[oracle@19ctest .patch_storage]$ 

-- opatch clean的帮助,该命令清除.patch_storage directory文件夹下的'restore.sh,make.txt' files and 'scratch,backup' 

[oracle@19ctest ~]$ opatch util cleanup -help
Oracle Interim Patch Installer version 12.2.0.1.41
Copyright (c) 2024, Oracle Corporation.  All rights reserved.


DESCRIPTION
     This utility cleans up 'restore.sh,make.txt' files and 'scratch,backup' 
     directories of the.patch_storage directory of Oracle Home.If -ps option is used, 
     then, it cleans the above specified areas only for that patch, else for all 
     patches under ORACLE_HOME/.patch_storage. You will be still able to
     rollback patches after this cleanup.

SYNTAX
opatch util cleanup  [-invPtrLoc <Path to oraInst.loc> ]
                     [-jre <LOC> ] [-oh <ORACLE_HOME> ]
                     [-silent] [-report]
                     [-ps <patch ID with time stamp>, this will
                       be located under ORACLE_HOME/.patch_storage/]

OPTIONS   
       -invPtrLoc
              Used to locate the oraInst.loc file. Needed when the
              installation used the -invPtrLoc flag. This should be
              the path to the oraInst.loc file.

       -jre
              This option tells OPatch to use JRE (java) from the
              specified location instead of the default location
              under Oracle Home. Both -jdk and -jre options cannot
              be specified together. OPatch will display error in
              that case.
            
       -oh
              The oracle home to work on. This takes precedence over
              the environment variable ORACLE_HOME.
         
       -ps
              This option is used to specify the Patch ID with timestamp.
              This Patch ID with timestamp should be the same as in
              .patch_storage directory.

              A directory by this name will be present under
              ORACLE_HOME/.patch_storage. If this directory is specified
              and is valid, then the contents specified in the description
              will be cleaned up only for this patch. Otherwise, all patch
              related directories will be acted upon by this utility.

      -silent 
              In silent mode, the cleanup always takes place.

      -report 
              Prints the operations without actually executing them.


OPatch succeeded.
[oracle@19ctest ~]$ 

-- 从清理过程看,会清理'restore.sh,make.txt' files and 'scratch,backup' directories.但仍然可以对补丁进行rollback 

[oracle@19ctest ~]$ opatch util cleanup
Oracle Interim Patch Installer version 12.2.0.1.41
Copyright (c) 2024, Oracle Corporation.  All rights reserved.


Oracle Home       : /u01/app/oracle/product/19.0.0/db_1
Central Inventory : /u01/app/oraInventory
   from           : /u01/app/oracle/product/19.0.0/db_1/oraInst.loc
OPatch version    : 12.2.0.1.41
OUI version       : 12.2.0.7.0
Log file location : /u01/app/oracle/product/19.0.0/db_1/cfgtoollogs/opatch/opatch2024-05-08_13-30-06PM_1.log

Invoking utility "cleanup"
OPatch will clean up 'restore.sh,make.txt' files and 'scratch,backup' directories.
You will be still able to rollback patches after this cleanup.
Do you want to proceed? [y|n]
y
User Responded with: Y

Backup area for restore has been cleaned up. For a complete list of files/directories
deleted, Please refer log file.

OPatch succeeded.
[oracle@19ctest ~]$ 

一些log 

[May 8, 2024 1:30:11 PM] [INFO]     [OPSR-MEMORY] Loaded all one offs from inventory. Heap memory in use: 29 (MB)
[May 8, 2024 1:30:11 PM] [INFO]     [OPSR-TIME] Raw inventory loaded successfully
[May 8, 2024 1:30:11 PM] [INFO]     Invoking utility "cleanup"
[May 8, 2024 1:30:11 PM] [INFO]     [OPSR-TIME] Cleaning up backup
[May 8, 2024 1:30:11 PM] [INFO]     OPatch will clean up 'restore.sh,make.txt' files and 'scratch,backup' directories.
                                    You will be still able to rollback patches after this cleanup.
                                    Do you want to proceed? [y|n]

-- 执行完毕后,貌似没有变化,可能和自己环境有关(19年开始测试补丁,基本上每个季度都测试,后面把又把数据库用RMAN做了迁移,又转换成了PDB模式)。

[oracle@19ctest ~]$ df -h
Filesystem                   Size  Used Avail Use% Mounted on
devtmpfs                     4.3G     0  4.3G   0% /dev
tmpfs                        4.4G     0  4.4G   0% /dev/shm
tmpfs                        4.4G  8.8M  4.4G   1% /run
tmpfs                        4.4G     0  4.4G   0% /sys/fs/cgroup
/dev/mapper/ol_19cdg01-root   17G  4.1G   13G  24% /
/dev/sdc1                    120G   74G   47G  62% /oradata
/dev/sdd1                    120G   60G   61G  50% /arch
/dev/sda1                   1014M  169M  846M  17% /boot
/dev/sde1                    100G   24G   76G  24% /mysql
/dev/sdf1                    120G   47G   74G  39% /oradatapdb
/dev/sdb1                     40G   24G   17G  59% /u01
tmpfs                        883M     0  883M   0% /run/user/0
[oracle@19ctest ~]$ 

-- 也可能和log中的以下有关 

[oracle@19ctest db_1]$ tail -f /u01/app/oracle/product/19.0.0/db_1/cfgtoollogs/opatch/opatch2024-05-08_13-30-06PM_1.log
[May 8, 2024 1:30:59 PM] [INFO]     Cannot delete as either pathToBeDeleted is empty or it does not contain .patch_storage :
[May 8, 2024 1:30:59 PM] [INFO]     Cannot delete as either pathToBeDeleted is empty or it does not contain .patch_storage :
[May 8, 2024 1:30:59 PM] [INFO]     Cannot delete as either pathToBeDeleted is empty or it does not contain .patch_storage :
[May 8, 2024 1:30:59 PM] [INFO]     Cannot delete as either pathToBeDeleted is empty or it does not contain .patch_storage :
[May 8, 2024 1:30:59 PM] [INFO]     Cannot delete as either pathToBeDeleted is empty or it does not contain .patch_storage :
[May 8, 2024 1:30:59 PM] [INFO]     Cannot delete as either pathToBeDeleted is empty or it does not contain .patch_storage :
[May 8, 2024 1:30:59 PM] [INFO]     Cannot delete as either pathToBeDeleted is empty or it does not contain .patch_storage :
[May 8, 2024 1:30:59 PM] [INFO]     Cannot delete as either pathToBeDeleted is empty or it does not contain .patch_storage :
[May 8, 2024 1:30:59 PM] [INFO]     [OPSR-TIME] Loading cooked inventory

-- 查看到的补丁

SYS@cdbtest SQL> select comments from dba_registry_history;

COMMENTS
--------------------------------------------------------------------------------
RDBMS_19.23.0.0.0DBRU_LINUX.X64_240405
Patch applied from 19.3.0.0.0 to 19.21.0.0.0: Release_Update - 230930151951
Patch applied from 19.21.0.0.0 to 19.22.0.0.0: Release_Update - 240104023954
Patch applied from 19.22.0.0.0 to 19.23.0.0.0: Release_Update - 240406004238

SYS@cdbtest SQL> alter session set container =test;

Session altered.

SYS@cdbtest SQL> select comments from dba_registry_history;

COMMENTS
--------------------------------------------------------------------------------
RDBMS_19.23.0.0.0DBRU_LINUX.X64_240405
Patch applied on 19.3.0.0.0: Release_Update - 190410122720
Patch applied from 19.3.0.0.0 to 19.5.0.0.0: Release_Update - 190909180549
Patch applied from 19.5.0.0.0 to 19.11.2.0.0: Release_Update_Revision - 21100717
1159

RAN jvmpsu.sql
OJVM RU post-install
Patch rolled back from 19.11.2.0.0 to 19.11.0.0.0: Release_Update - 210413004009
Patch applied from 19.11.0.0.0 to 19.14.0.0.0: Release_Update - 211225122123
Patch applied from 19.14.0.0.0 to 19.15.0.0.0: Release_Update - 220331125408

COMMENTS
--------------------------------------------------------------------------------
Patch applied from 19.15.0.0.0 to 19.17.0.0.0: Release_Update - 220924224051
Patch applied from 19.17.0.0.0 to 19.18.0.0.0: Release_Update - 230111171738
Patch applied on 19.18.0.0.0: Release_Update - 230111171738
Patch applied on 19.18.0.0.0: Release_Update - 230111171738
Patch applied from 19.18.0.0.0 to 19.19.0.0.0: Release_Update - 230322020406
Patch applied from 19.19.0.0.0 to 19.20.0.0.0: Release_Update - 230715022800
Patch applied from 19.20.0.0.0 to 19.21.0.0.0: Release_Update - 230930151951
Patch applied on 19.21.0.0.0: Release_Update - 230930151951
Patch applied on 19.21.0.0.0: Release_Update - 230930151951
Patch applied on 19.21.0.0.0: Release_Update - 230930151951
Patch applied on 19.21.0.0.0: Release_Update - 230930151951

COMMENTS
--------------------------------------------------------------------------------
Patch applied on 19.21.0.0.0: Release_Update - 230930151951
Patch applied on 19.21.0.0.0: Release_Update - 230930151951
Patch applied on 19.21.0.0.0: Release_Update - 230930151951
OJVM RU post-deinstall
Patch applied on 19.21.0.0.0: Release_Update - 230930151951
Patch applied from 19.21.0.0.0 to 19.22.0.0.0: Release_Update - 240104023954
Patch applied from 19.22.0.0.0 to 19.23.0.0.0: Release_Update - 240406004238

27 rows selected.

SYS@cdbtest SQL> 

-- 也可以手工清除,官网上对于手工清除,是这样说明的 

Additionally, further cleanup of the $ORACLE_HOME/.patch_storage is possible if there are directories from patches applied to previous versions. This can be done manually as follows:

1.  run command:

$ opatch lsinventory

2.  Remove all the sub-directories from $ORACLE_HOME/.patch_storage that are not present in the list of installed patches. Directory names would be prefaced with the patchid for example:

13343438_<timestamp>

example to find sub-directories : $ opatch lsinventory | grep -E "(^Patch.*applied)|(^Sub-patch)"

Note: List of patches include the sub patches of install Bundle patches, PSU, GI PSU.  Hence you should NOT remove the sub patch folders.

[oracle@19ctest ~]$ opatch lsinventory | grep -E "(^Patch.*applied)|(^Sub-patch)"
Patch  36233263     : applied on Fri Apr 19 08:54:31 CST 2024
Patch  29585399     : applied on Thu Apr 18 15:21:33 CST 2019
[oracle@19ctest ~]$ 

-- 手工清理掉

rm -rf  29517242_Apr_17_2019_23_27_10
rm -rf  35042068_Apr_6_2023_15_25_04
rm -rf  35320081_Jul_15_2023_12_54_11
rm -rf  35643107_Oct_3_2023_13_34_29
rm -rf  35943157_Jan_13_2024_05_42_55

--清理后空间,剩余25G 

[oracle@19ctest .patch_storage]$ df -h
Filesystem                   Size  Used Avail Use% Mounted on
devtmpfs                     4.3G     0  4.3G   0% /dev
tmpfs                        4.4G     0  4.4G   0% /dev/shm
tmpfs                        4.4G  8.8M  4.4G   1% /run
tmpfs                        4.4G     0  4.4G   0% /sys/fs/cgroup
/dev/mapper/ol_19cdg01-root   17G  4.1G   13G  24% /
/dev/sdc1                    120G   74G   47G  62% /oradata
/dev/sdd1                    120G   60G   61G  50% /arch
/dev/sda1                   1014M  169M  846M  17% /boot
/dev/sde1                    100G   24G   76G  24% /mysql
/dev/sdf1                    120G   47G   74G  39% /oradatapdb
/dev/sdb1                     40G   16G   25G  39% /u01
tmpfs                        883M     0  883M   0% /run/user/0
[oracle@19ctest .patch_storage]$ 

END

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.mfbz.cn/a/604742.html

如若内容造成侵权/违法违规/事实不符,请联系我们进行投诉反馈qq邮箱809451989@qq.com,一经查实,立即删除!

相关文章

05-08 周三 FastBuild FastAPI 引入并发支持和全局捕获异常

时间版本修改人描述2024年5月8日20:41:03V0.1宋全恒新建文档 简介 由于FastBuild之前花费了大概5天的时间优化&#xff0c;但最近重新部署&#xff0c;又发现了一些问题&#xff0c;就很痛苦&#xff0c;五一之后&#xff0c;自己又花了三天的时间系统的进行了优化。 上一波优…

刷题训练之模拟

> 作者&#xff1a;დ旧言~ > 座右铭&#xff1a;松树千年终是朽&#xff0c;槿花一日自为荣。 > 目标&#xff1a;熟练掌握模拟算法。 > 毒鸡汤&#xff1a;学习&#xff0c;学习&#xff0c;再学习 ! 学&#xff0c;然后知不足。 > 专栏选自&#xff1a;刷题训…

华为车BU迈入新阶段,新任CEO对智能车的3个预判

作者 |张马也 编辑 |德新 4月24日&#xff0c;北京车展前夕&#xff0c;华为召开了新一年的智能汽车解决方案新品发布会。 这次发布会&#xff0c;也是华为智能汽车解决方案BU&#xff08;简称「车BU」&#xff09;CEO 靳玉志的公开首秀。 一开场&#xff0c;靳玉志即抛出了…

损失一件外套?

2024/05/07&#xff0c;晴 碎碎念一波&#xff01; 早上洗漱完要出门时&#xff0c;发现自己昨天穿的外套不见了&#xff01;&#xff01;&#xff01;外套上身效果很不错&#xff0c;买了1年多穿的频率非常高&#xff0c;现在丢了还真挺可惜。 衣服口袋有一个耳机&#xff0…

信创基础软件之数据库

一、数据库概述 数据库是一种用于存储和管理拥有固定格式和结构数据的仓库型数据管理系统。其主要用于业务数据的存储和业务逻辑运算&#xff0c;具体负责保障数据的安全性、完整性、多用户对数据的并发使用以及发生故障后的系统恢复。 二、数据库的体系架构 数据库内核:对数…

Java中next()与nextLine()的区别[不废话,直接讲例子]

在使用牛客进行刷题时&#xff0c;我们很多时候会遇到这样的情况&#xff1a; 区别很简单&#xff0c;如果你要输入用空格或者回车分开的数据如&#xff1a; abc_def_ghi 这三组数据&#xff08; _ 是空格&#xff09; 用hasNext: 执行结果&#xff1a; 如果只用换行符号进行…

返回链表的中间节点题目讲解(超快方法)

一&#xff1a;题目 二&#xff1a;思路讲解 采用快慢指针方法来解决 1&#xff1a;slow指针一次跳一个节点&#xff0c;fast指针一次跳两个节点&#xff0c;这样当fast到尾节点的时候&#xff0c;slow刚好到中间节点&#xff0c;但是奇数个的时候&#xff0c;fast不会刚好的…

Java | Leetcode Java题解之第59题螺旋矩阵II

题目&#xff1a; 题解&#xff1a; class Solution {public int[][] generateMatrix(int n) {int num 1;int[][] matrix new int[n][n];int left 0, right n - 1, top 0, bottom n - 1;while (left < right && top < bottom) {for (int column left; co…

DenseCLIP环境配置

直接看raoyongming/DenseCLIP: [CVPR 2022] DenseCLIP: Language-Guided Dense Prediction with Context-Aware Prompting (github.com) 但这里的环境配置可能和现在不太适配&#xff0c;自己配了好久没弄好 后面尝试了另外的版本的&#xff08;但这个版本少了一些内容&#…

MySQL-ELK基础

1&#xff1a;什么是 ELK ELK是由一家elastic公司开发的三个开源项目的首字母缩写&#xff0c;这三个项目分别是&#xff1a;Elasticsearch、Logstash 和 Kibana。三个项目各有不同的功能&#xff0c;之后又增加了许多新项目, 于是 从5.X版本后改名为Elastic Stack Elastic S…

电脑屏幕监控软件都有哪些 | 五大好用屏幕监控软件盘点

电脑屏幕监控软件在企业管理、家庭教育等方面发挥着越来越重要的作用。 这些软件通过实时监控电脑屏幕活动&#xff0c;为用户提供了强大的管理和监控功能。 本文将为您盘点五大好用的电脑屏幕监控软件&#xff0c;帮助您更好地了解并选择适合自己的软件。 电脑屏幕监控软件都…

J1019基于SpringBoot的护肤品推荐系统设计与实现(源码+包运行+技术指导)

项目描述 临近学期结束&#xff0c;开始毕业设计制作&#xff0c;你还在做java程序网络编程&#xff0c;期末作业&#xff0c;老师的作业要求觉的困难吗?不知道毕业设计该怎么办?网页功能的数量是否太多?没有合适的类型或系统?等等。今天给大家介绍一篇基于SpringBoot的护…

Visual Studio C++ 2019进行安装

Visual Studio C 2019进行下载安装 链接&#xff1a;https://my.visualstudio.com/Downloads?qvisual%20studio%202017&wt.mc_idomsftvscom~older-downloads

Linux网站服务

1.概念:HTML:超级文本编辑语言 网页:使用HTML,PHP,JAVA语言格式书写的文件。 主页:网页中呈现用户的第一个界面。 网站:多个网页组合而成的一台网站服务器。 URL:统一资源定位符&#xff0c;访问网站的地址。 网站架构:LAMP: LinuxApacheMYSQLPHP(系统服务器程序数据管理…

Mamba结构的Demo源码解读

文章目录 前言一、mamba结构构建辅助函数解读1、dataclass方法解读2、Norm归一化LayerNormRMSNormRMSNorm源码 3、nn.Parameter方法解读 二、mamba原理二、mamba模型构建1、主函数入口源码解读2、Mamba类源码解读 三、ResidualBlock的mamba结构源码解读四、MambaBlock构成Resid…

【C++】二叉搜索树(手撕插入、删除、寻找)

一、什么是二叉搜索树 二叉搜索树又称二叉排序树&#xff0c;它或者是一棵空树&#xff0c;或者是具有以下性质的二叉树: 若它的左子树不为空&#xff0c;则左子树上所有节点的值都小于根节点的值若它的右子树不为空&#xff0c;则右子树上所有节点的值都大于根节点的值它的左…

collections模块

tuple的功能 只有可哈希的对象才可以作为字典的key&#xff0c;而immutable的对象是可哈希的 tuple的拆包&#xff0c;分别进行映射 拆包的灵活用法 tuple的不可变不是绝对的 nametuple的详解 __slots__是用于限制class里面有那些属性值的&#xff0c;可以自行去了解一下 f…

Python基础详解三

一&#xff0c;函数的多返回值 def methodReturn():return 1,2x,ymethodReturn() print(x,y) 1 2 二&#xff0c;函数的多种参数使用形式 缺省参数&#xff1a; def method7(name,age,address"淄博"):print("name:"name",age"str(age)&quo…

你需要知道vim操作 源头都在vimtutor里

vim之源&#xff1a;vimtutor vim的五种模式Normal mode&#xff08;正常模式&#xff09;Insert mode&#xff08;插入模式&#xff09;Visual mode&#xff08;可视模式&#xff09;Replace mode&#xff08;替换模式&#xff09;Command-line mode&#xff08;命令行模式&am…

Gradle 基础学习(三) 认识Command-Line Interface

Gradle命令行接口 除了IDE外&#xff0c;我们主要通过Gradle命令行接口来运行Gradle任务和管理Gradle项目。 下面是Gradle命令行使用的一些参考&#xff0c;熟悉后建议实际项目中使用Gradle Wrapper&#xff0c;gradle用法都可以替换为gradlew (macOS / Linux) 或gradlew.bat…
最新文章