某天突然接到告警說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/opatch3018-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/opatch3018-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。
當前文章:清理.patch_storage目錄
分享路徑:http://m.2m8n56k.cn/article32/jssisc.html
成都網站建設公司_創新互聯,為您提供品牌網站建設、網站內鏈、移動網站建設、網站制作、手機網站建設、營銷型網站建設
廣告
聲明:本網站發布的內容(圖片、視頻和文字)以用戶投稿、用戶轉載內容為主,如果涉及侵權請盡快告知,我們將會在第一時間刪除。文章觀點不代表本網站立場,如需處理請聯系客服。電話:028-86922220;郵箱:[email protected]。內容未經允許不得轉載,或轉載時需注明來源:
創新互聯