清理.patch_storage目录

某天突然接到告警说oracle目录使用率高,经过检查发现.patch_storage占了大约40G的空间。
.patch_storage的作用?
每次在打补丁的时候,会对库文件和模块做一些改变;变动之前,opatch会在$ORACLE_HOME/.patch_storage/<patch-id_timestamp> 目录中创建一个snapshot。有时候会出现需要回滚补丁的时候,这个目录下面会有一个restore.sh脚本,这个脚本可以remove之前做过的changes。
目录结构:
drwxr-xr-x    4 oracle   oinstall        256 Nov 08 2016  17592127_Jan_8_2014_23_02_20
drwxr-xr-x    4 oracle   oinstall        256 Nov 08 2016  13343438_Dec_28_2011_01_17_39
drwxr-xr-x    4 oracle   oinstall        256 Nov 08 2016  13923374_Jun_14_2012_23_16_11
drwxr-xr-x    4 oracle   oinstall        256 Nov 08 2016  13696216_Apr_8_2012_21_52_22
drwxr-xr-x    4 oracle   oinstall        256 Nov 08 2016  14727310_Dec_31_2012_01_47_37
drwxr-xr-x    4 oracle   oinstall        256 Nov 08 2016  14275605_Oct_3_2012_23_27_54
drwxr-xr-x    4 oracle   oinstall        256 Nov 08 2016  16056266_Mar_13_2013_05_49_56
其中一个目录内的文件:
oracle/app/oracle/product/11.2.0/db_1/.patch_storage/17586955_Jun_16_2015_10_26_31$ ls -lrt
total 8
drwxr-xr-x    4 oracle   oinstall        256 Jan 10 23:30 original_patch
drwxr-xr-x    3 oracle   oinstall        256 Jan 10 23:30 files
-rwx--x---    1 oracle   oinstall       1533 Jan 10 23:30 rollback.sh

这也就是说,打补丁的时候是需要一定的磁盘空间的。不然这个copy的过程不能完成。理论上,一次补丁的最大所需空间为1.8G,但是实际上是会小于这个数值的,一般oracle目录也不会就剩下这么点空间,所以不用太过于关注。

下面是清理过程:
一节点:
[grid@byo87631:/oracle/app/product/grid]du -sg .patch_storage
37.73   .patch_storage
[grid@byo87631:/oracle/app/product/grid]opatch util cleanup
Invoking OPatch 11.2.0.1.6

Oracle Interim Patch Installer version 11.2.0.1.6
Copyright (c) 2011, Oracle Corporation.  All rights reserved.

UTIL session

Oracle Home       : /oracle/app/product/grid
Central Inventory : /oracle/app/oraInventory
   from           : /etc/oraInst.loc
OPatch version    : 11.2.0.1.6
OUI version       : 11.2.0.2.0
Log file location : /oracle/app/product/grid/cfgtoollogs/opatch/opatch2018-02-02_19-39-49PM.log

Invoking utility "cleanup"
OPatch will clean up 'restore.sh,make.txt' files and 'rac,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
Size of directory "/oracle/app/product/grid/.patch_storage" before cleanup is 40496924381 bytes.
Size of directory "/oracle/app/product/grid/.patch_storage" after cleanup is 23138284034 bytes.

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

OPatch succeeded.



二节点:
[grid@byo87632:/oracle/app/product/grid]du -sg .patch_storage
37.73   .patch_storage
[grid@byo87632:/oracle/app/product/grid]opatch util cleanup
Invoking OPatch 11.2.0.1.6

Oracle Interim Patch Installer version 11.2.0.1.6
Copyright (c) 2011, Oracle Corporation.  All rights reserved.

UTIL session

Oracle Home       : /oracle/app/product/grid
Central Inventory : /oracle/app/oraInventory
   from           : /etc/oraInst.loc
OPatch version    : 11.2.0.1.6
OUI version       : 11.2.0.2.0
Log file location : /oracle/app/product/grid/cfgtoollogs/opatch/opatch2018-02-02_19-54-42PM.log

Invoking utility "cleanup"
OPatch will clean up 'restore.sh,make.txt' files and 'rac,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
Size of directory "/oracle/app/product/grid/.patch_storage" before cleanup is 40496924381 bytes.
Size of directory "/oracle/app/product/grid/.patch_storage" after cleanup is 23138284034 bytes.

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

OPatch succeeded.

[grid@byo87632:/oracle/app/product/grid]du -sg .patch_storage
21.56   .patch_storage



从40多G清理到20多G。


来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/31480688/viewspace-2153822/,如需转载,请注明出处,否则将追究法律责任。

转载于:http://blog.itpub.net/31480688/viewspace-2153822/

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
### 回答1: 这行代码的作用是将第三维度(即维度2)上的元素进行复制,并在第三维度上扩展为self.patch_size[0]个元素。其中,unsqueeze(2)将第三维度上的元素添加一个维度,变成维度为1x1x1xNxM的张量,然后使用repeat()函数将它在第三维度上复制self.patch_size[0]次,使得张量的维度变成1x1xself.patch_size[0]xNxM。最后,再将第三维度上的元素除以self.patch_size[0],即对第三维度上的所有元素求均值,得到的结果是1x1xself.patch_size[0]xNxM的张量。 ### 回答2: unsqueeze(2)是指在索引2处增加一个维度。这个操作将原始张量的维度从3增加到4。 .repeat(1,1,self.patch_size[0],1,1)用于对指定的维度进行复制。表示在第2个维度上进行复制,复制次数为self.patch_size[0]。 self.patch_size[0]在这个表达式中是一个变量,它表示一个特定的尺寸大小。 所以整个操作的功能是:对于一个4维张量,通过增加一个维度,然后在指定的维度上复制指定的次数。最后再将结果除以self.patch_size[0]。 具体来说,这个操作可以理解为对一个特征图进行分块,生成多个具有相同特征的小块。每个小块的尺寸为self.patch_size[0],而每个小块的特征与原始特征图的特征相同。 这种操作在深度学习中常用于处理图像、语音等数据。它可以增加数据的多样性,提升模型的泛化能力。同样,它也可以减少模型的计算量和内存消耗。 ### 回答3: unsqueeze(2).repeat(1,1,self.patch_size[0],1,1) / self.patch_size[0] 是一个PyTorch中的操作。它的作用是在第二个维度上增加一个维度,然后将该维度的值按照给定的参数进行复制。这个操作可以理解为对一个张量进行扩展和重复。 具体而言,unsqueeze(2)的作用是在第二个维度上增加一个新的维度,这样原来的张量的维度会从原来的 (a, b, c, d) 变成 (a, b, 1, c, d)。这个操作可以用来处理涉及批量处理的场景,比如对一组图片进行处理。 接着,使用repeat函数对新增的维度进行复制。repeat(1, 1, self.patch_size[0], 1, 1) 中的参数表示每一个维度上的复制次数,其中1表示当前维度保持不变不复制,self.patch_size[0]表示在新增的维度上复制self.patch_size[0]次。 最后,对整个张量进行除法操作,其中self.patch_size[0]是一个数值,用来除以张量中的所有元素。这个操作可以理解为对扩展后的张量中的每一个元素都进行除法运算。 总的来说,unsqueeze(2).repeat(1,1,self.patch_size[0],1,1) / self.patch_size[0] 的效果是在给定的张量中在第二个维度上增加一个维度,并且将该维度的值复制多次。然后对整个张量中的所有元素进行除法操作,除数为self.patch_size[0]。

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值