$CRS_HOME/cdata下大量数字命名的文件,占用空间大

本文描述了Oracle集群中OCR自动备份文件不断累积导致文件系统空间耗尽的问题。由于权限设置错误,Cluster Ready Services (CRS) 无法正常覆盖旧备份文件。文章提供了问题的根本原因、受影响版本以及解决此问题的方法,包括手动更改文件所有权和权限。

问题现象:
    <CRS_HOME>/cdata目录下存在大量数字命名的文件,导致文件系统爆满

$ls -alrth /opt/oracle/product/CRS/cdata/crs
-rw-r--r-- 1 root root 3.9M Oct 19 00:51 25974360
-rw-r--r-- 1 root root 3.9M Oct 19 04:51 39631111
-rw-r--r-- 1 root root 3.9M Oct 19 08:51 20660854
-rw-r--r-- 1 root root 3.9M Oct 19 12:51 35589462
-rw-r--r-- 1 root root 3.9M Oct 19 16:51 12309480
$ls  /opt/oracle/product/CRS/cdata/crs |egrep '^[0-9]+'   |wc -l
9692
Automatic OCR Backup Filling Up <CRS_HOME>/cdata/<clustername> Directory (Doc ID 1191067.1)
ls -l $GRID_HOME/cdata/$CLUSTERNAME
-rwxr-xr-x 1 grid oinstall 6791168 Jul 16 22:45 week.ocr
-rwxr-xr-x 1 grid oinstall 6791168 Jul 16 22:45 day.ocr
-rwxr-xr-x 1 grid oinstall 6791168 Jul 16 22:45 backup02.ocr
-rwxr-xr-x 1 grid oinstall 6791168 Jul 17 02:45 backup01.ocr
-rwxr-xr-x 1 grid oinstall 6791168 Jul 17 02:45 day_.ocr
-rw------- 1 root root     7114752 Jul 17 11:43 backup00.ocr
-rw------- 1 root root     7114752 Jul 17 15:43 35568671.ocr
-rw------- 1 root root     7114752 Jul 17 19:43 38296812.ocr..
-rw------- 1 root root     7143424 Aug 30 05:40 37208845.ocr
-rw------- 1 root root     7143424 Aug 30 09:40 38455890.ocr
Due to bug 9446443, automatic OCR backups are incorrectly owned which is preventing CRSD from overwriting them.

Applies to:Oracle Database - Enterprise Edition - Version 10.2.0.1 and later
Information in this document applies to any platform.Symptoms

Automatic OCR backup rotation is not working with 11gR2 Grid Infrastructure, instead of overwriting existing backup file, CRSD keeps creating new backup files which taking more and more space:

ls -l $GRID_HOME/cdata/$CLUSTERNAME
-rwxr-xr-x 1 grid oinstall 6791168 Jul 16 22:45 week.ocr
-rwxr-xr-x 1 grid oinstall 6791168 Jul 16 22:45 day.ocr
-rwxr-xr-x 1 grid oinstall 6791168 Jul 16 22:45 backup02.ocr
-rwxr-xr-x 1 grid oinstall 6791168 Jul 17 02:45 backup01.ocr
-rwxr-xr-x 1 grid oinstall 6791168 Jul 17 02:45 day_.ocr
-rw------- 1 root root     7114752 Jul 17 11:43 backup00.ocr
-rw------- 1 root root     7114752 Jul 17 15:43 35568671.ocr
-rw------- 1 root root     7114752 Jul 17 19:43 38296812.ocr
..
-rw------- 1 root root     7143424 Aug 30 05:40 37208845.ocr
-rw------- 1 root root     7143424 Aug 30 09:40 38455890.ocrCause
Due to bug 9446443, automatic OCR backups are incorrectly owned which is preventing CRSD from overwriting them.
Expected ownership and permission on Linux - all 7 of them:
-rw------- 1 root root 11640832 Aug 30 08:46 backup00.ocr
-rw------- 1 root root 11640832 Aug 30 04:46 backup01.ocr
-rw------- 1 root root 11640832 Aug 30 00:46 backup02.ocr
-rw------- 1 root root 11640832 Aug 30 00:46 day_.ocr
-rw------- 1 root root 11640832 Aug 29 00:46 day.ocr
-rw------- 1 root root 11640832 Aug 26 00:45 week_.ocr
-rw------- 1 root root 11640832 Aug 19 00:44 week.ocrSolution
bug 9446443 is fixed in 11.2.0.2, 12.1.

It's recommended to apply patch to fix the issue, but if patch is unavailable, workaround is to change ownership and permission of all 7 automatic backup files manually. OCR should be owned by root, but depend on platform, group may or may not be root - you can check any randomly named backup file to identify what ownership and permission it should have; in example below:

-rw------- 1 root root     7143424 Aug 30 09:40 38455890.ocr

With this, please change all 7 automatic backup files to be owned  by root:root with permission "-rw-------"References
NOTE:1083982.1 - Incorrect Ownership and Permission after Relinking or Patching 11gR2 Grid Infrastructure
BUG:9446443 - ROOTCRS.PL RESETS THE PERMISSIONS ON /CDATA/
BUG:7313884 - NEWLY GENERATED OCR BACKUP IN CDATA DIRECTORY CAN'T BE RENAMED
BUG:5893629 - CRSD CRASHES AFTER BEING UNABLE TO DELETE BACKUP OCR FILE
你遇到的错误: ``` -bash: start: command not found ``` 说明你在执行命令时语法有误。你输入的是: ```bash $GRID_HOME/bin/crsctl start crs ``` 但 shell 把 `$GRID_HOME/bin/crsctl` 解析成了命令,而 `start` 被当成了一个独立的命令(它不是),所以报错 “start: command not found”。 但实际上,正确的用法是把整个 `$GRID_HOME/bin/crsctl` 作为命令,`start crs` 是它的参数。 --- ### ✅ 正确的解决方法: 确保 `$GRID_HOME` 环境变量已正确设置,并使用如下格式运行命令: ```bash $GRID_HOME/bin/crsctl start crs ``` 但这必须在 `$GRID_HOME` 已定义且路径正确的情况下才能工作。 --- ### 🔍 检查与修复步骤: #### 1. **确认 `$GRID_HOME` 是否设置** ```bash echo $GRID_HOME ``` 如果输出为空或不正确,你需要先设置它,例如: ```bash export GRID_HOME=/u01/app/19.0.0/grid ``` > 注意:路径根据你的实际安装路径调整,常见路径如 `/u01/app/grid/product/19.3.0/grid` 或类似。 #### 2. **确认 `crsctl` 文件是否存在** ```bash ls -l $GRID_HOME/bin/crsctl ``` 如果提示文件不存在,请检查 Grid Infrastructure 安装路径是否正确。 #### 3. **以完整路径方式运行(推荐测试用)** 避免变量问题,直接使用绝对路径: ```bash /u01/app/19.0.0/grid/bin/crsctl start crs ``` > 替换为你的实际 GRID_HOME 路径。 #### 4. **需要 root 权限运行** `crsctl start crs` 必须由 **root 用户** 在集群的每个节点上运行,并且通常只在停止 CRS 后启动时使用。 ✅ 所以你应该确保: - 当前是 `root` 用户(你确实是) - Grid Infrastructure 已安装并配置 - 集群状态当前是关闭的(否则会提示 CRS already running) --- ### 🛠️ 示例正确操作流程: ```bash # 设置环境变量(根据实际情况修改路径) export GRID_HOME=/u01/app/19.0.0/grid # 验证 crsctl 可执行 ls -l $GRID_HOME/bin/crsctl # 启动 CRS(即 OHASD + Clusterware) $GRID_HOME/bin/crsctl start crs ``` 预期输出(成功时): ``` CRS-4123: Oracle High Availability Services has been started. ``` --- ### ⚠️ 补充说明: - `crsctl start crs` 用于 **启动整个 Clusterware 栈**(包括 OHASD、CRSD、CSSD、EVMD 等)。 - 如果你是单机环境(比如使用 Oracle Restart),则应使用: ```bash $GRID_HOME/bin/crsctl start has ``` - 相应地,查看状态用: ```bash $GRID_HOME/bin/crsctl check crs # 集群环境 $GRID_HOME/bin/crsctl check has # 单机 Restart 环境 ``` --- ### ❌ 常见错误原因总结: | 错误 | 原因 | |------|------| | `command not found` | `$GRID_HOME` 未设置或路径错误 | | 权限不足 | 不是以 root 运行 | | CRS already active | CRS 已经在运行 | | File not executable | `crsctl` 没有执行权限 | --- ### ✅ 最终建议命令(假设路径正确): ```bash # 设置路径 export GRID_HOME=/u01/app/19.0.0/grid # 启动 CRS $GRID_HOME/bin/crsctl start crs ``` ---
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值