安装grid时:/oracle/app/11.2.0/grid/root.sh 报line 9379.

博客记录了Oracle 11g的安装配置过程,包括执行脚本修改权限、设置环境变量、创建文件等操作,还启动了多个服务并成功创建ASM和磁盘组。但在FirstNode配置时失败,通过查找日志文件,发现问题是由于/etc/hosts文件配置错误,添加127.0.0.1 localhost即可解决。

[root@itpux1 ~]# /oracle/app/oraInventory/orainstRoot.sh
Changing permissions of /oracle/app/oraInventory.
Adding read,write permissions for group.
Removing read,write,execute permissions for world.

Changing groupname of /oracle/app/oraInventory to oinstall.
The execution of the script is complete.
[root@itpux1 ~]# /oracle/app/11.2.0/grid/root.sh
Performing root user operation for Oracle 11g

The following environment variables are set as:
    ORACLE_OWNER= grid
    ORACLE_HOME=  /oracle/app/11.2.0/grid

Enter the full pathname of the local bin directory: [/usr/local/bin]:
   Copying dbhome to /usr/local/bin ...
   Copying oraenv to /usr/local/bin ...
   Copying coraenv to /usr/local/bin ...


Creating /etc/oratab file...
Entries will be added to the /etc/oratab file as needed by
Database Configuration Assistant when a database is created
Finished running generic part of root script.
Now product-specific root actions will be performed.
Using configuration parameter file: /oracle/app/11.2.0/grid/crs/install/crsconfig_params
Creating trace directory
User ignored Prerequisites during installation
Installing Trace File Analyzer
OLR initialization - successful
  root wallet
  root wallet cert
  root cert export
  peer wallet
  profile reader wallet
  pa wallet
  peer wallet keys
  pa wallet keys
  peer cert request
  pa cert request
  peer cert
  pa cert
  peer root cert TP
  profile reader root cert TP
  pa root cert TP
  peer pa cert TP
  pa peer cert TP
  profile reader pa cert TP
  profile reader peer cert TP
  peer user cert
  pa user cert
Adding Clusterware entries to upstart
CRS-2672: Attempting to start 'ora.mdnsd' on 'itpux1'
CRS-2676: Start of 'ora.mdnsd' on 'itpux1' succeeded
CRS-2672: Attempting to start 'ora.gpnpd' on 'itpux1'
CRS-2676: Start of 'ora.gpnpd' on 'itpux1' succeeded
CRS-2672: Attempting to start 'ora.cssdmonitor' on 'itpux1'
CRS-2672: Attempting to start 'ora.gipcd' on 'itpux1'
CRS-2676: Start of 'ora.cssdmonitor' on 'itpux1' succeeded
CRS-2676: Start of 'ora.gipcd' on 'itpux1' succeeded
CRS-2672: Attempting to start 'ora.cssd' on 'itpux1'
CRS-2672: Attempting to start 'ora.diskmon' on 'itpux1'
CRS-2676: Start of 'ora.diskmon' on 'itpux1' succeeded
CRS-2676: Start of 'ora.cssd' on 'itpux1' succeeded

已成功创建并启动 ASM。

已成功创建磁盘组dggrid1。

clscfg: -install mode specified
Successfully accumulated necessary OCR keys.
Creating OCR keys for user 'root', privgrp 'root'..
Operation successful.
CRS-4256: Updating the profile
Successful addition of voting disk 48b54f19e5314f14bfa0e745ec1a3f98.
Successfully replaced voting disk group with +dggrid1.
CRS-4256: Updating the profile
CRS-4266: Voting file(s) successfully replaced
##  STATE    File Universal Id                File Name Disk group
--  -----    -----------------                --------- ---------
 1. ONLINE   48b54f19e5314f14bfa0e745ec1a3f98 (/dev/mapper/dggrid1p1) [DGGRID1]
Located 1 voting disk(s).
CRS-2672: Attempting to start 'ora.asm' on 'itpux1'
CRS-2676: Start of 'ora.asm' on 'itpux1' succeeded
CRS-2672: Attempting to start 'ora.DGGRID1.dg' on 'itpux1'
CRS-2676: Start of 'ora.DGGRID1.dg' on 'itpux1' succeeded
/oracle/app/11.2.0/grid/bin/srvctl start nodeapps -n itpux1 ... failed
FirstNode configuration failed at /oracle/app/11.2.0/grid/crs/install/crsconfig_lib.pm line 9379.
/oracle/app/11.2.0/grid/perl/bin/perl -I/oracle/app/11.2.0/grid/perl/lib -I/oracle/app/11.2.0/grid/crs/install /oracle/app/11.2.0/grid/crs/install/rootcrs.pl execution failed

 

 

解决办法:

查找日志文件 :

[root@itpux1 log]# find /oracle/ -name oraagent_grid.log
/oracle/app/11.2.0/grid/log/itpux1/agent/crsd/oraagent_grid/oraagent_grid.log
/oracle/app/11.2.0/grid/log/itpux1/agent/ohasd/oraagent_grid/oraagent_grid.log

#more oraagent_grid.log

此问题是因:/etc/hosts文件配置错误,添加

127.0.0.1 localhost  

 

即可!

 

<think>好的,我现在需要解决用户在Docker中启动Oracle容器遇到的退出状态码126的问题,具体错误是权限被拒绝,路径是/home/oracle/app/oracle/product/11.2.0/dbhome_2/bin/dbstart。首先,我得理解这个问题的根源。状态码126通常意味着执行权限不足,所以可能这个dbstart脚本没有可执行权限。用户之前提到过权限问题,但这里的具体路径指向了Oracle安装目录下的脚本,需要确认该文件的权限是否正确。接下来,用户可能使用的Oracle镜像版本是11.2.0,这个版本比较旧,可能需要注意镜像的构建方式。另外,路径中的dbhome_2可能意味着这是第二个数据库实例,或者安装路径有变化,需要检查Dockerfile或启动命令是否正确挂载了卷,或者是否在容器启动修改了文件权限。可能的解决方案包括进入容器内部检查该文件的权限,使用chmod+x赋予执行权限。如果镜像本身在构建没有正确设置权限,可能需要重新构建镜像或者在启动容器通过命令修改权限。另外,SELinux或AppArmor也可能导致权限问题,需要检查主机的安全设置。需要分步骤指导用户如何验证权限,如何修改,以及如何调整安全策略。同,考虑到用户可能不太熟悉Docker内部操作,需要给出具体的命令示例,比如使用docker exec进入容器,或者使用dockerrun添加参数。此外,用户可能需要知道如何检查日志,确认错误是否确实由该脚本引起。最后,生成相关问题要围绕权限、Oracle容器配置、Docker安全设置等方面,帮助用户深入理解可能遇到的问题。</think>### 问题分析 退出状态码 `126` 明确指向 **权限不足导致命令无法执行**,具体错路径为 `/home/oracle/app/oracle/product/11.2.0/dbhome_2/bin/dbstart`。该文件是 Oracle 数据库启动的核心脚本,若权限配置错误或路径不匹配,将直接导致容器启动失败[^1]。 --- ### 逐步解决方案 #### 1. **检查容器内文件权限** 首先确认 `dbstart` 脚本是否具有可执行权限。通过以下命令进入容器内部检查: ```bash # 临启动容器并进入交互模式(若容器已退出,需先删除旧容器) docker run -it --rm --entrypoint /bin/bash oracle-11g-image # 进入容器后检查权限 ls -l /home/oracle/app/oracle/product/11.2.0/dbhome_2/bin/dbstart ``` 若输出显示权限中缺少 `x`(例如 `-rw-r--r--`),需赋予执行权限: ```bash chmod +x /home/oracle/app/oracle/product/11.2.0/dbhome_2/bin/dbstart ``` #### 2. **修复镜像构建的权限问题** 如果使用自定义镜像,需在 `Dockerfile` 中确保权限正确设置: ```dockerfile FROM oracle-11g-base # 显式赋予执行权限 RUN chmod +x /home/oracle/app/oracle/product/11.2.0/dbhome_2/bin/dbstart ``` #### 3. **挂载卷避免权限覆盖** 若通过 `-v` 挂载主机目录到容器中,可能导致文件权限被覆盖。建议: - **避免直接挂载关键脚本目录**,仅挂载数据目录(如 `/opt/oracle/oradata`)。 - 若必须挂载,在启动命令中同步权限: ```bash docker run -d \ -v /host/dbstart:/home/oracle/app/oracle/product/11.2.0/dbhome_2/bin/dbstart \ --name oracle-container \ --entrypoint "/bin/bash" \ oracle-11g-image \ -c "chmod +x /home/oracle/app/oracle/product/11.2.0/dbhome_2/bin/dbstart && /original/entrypoint.sh" ``` #### 4. **处理 SELinux/AppArmor 限制** 若主机启用了 SELinux,可能因强制访问控制(MAC)导致权限问题。临解决方案: ```bash # 禁用 SELinux(仅调试用) sudo setenforce 0 # 或为容器添加 SELinux 标签 docker run --security-opt label=disable ... ``` 对于 AppArmor,需调整配置文件或禁用默认策略[^2]。 #### 5. **验证容器启动日志** 检查容器日志以确认错误是否与 `dbstart` 直接相关: ```bash docker logs --tail 50 <container_id> ``` 典型权限错误日志示例: ``` /bin/sh: /home/oracle/app/oracle/product/11.2.0/dbhome_2/bin/dbstart: Permission denied ``` --- ### 数学建模解释权限问题 设文件权限为八进制值 $P$,用户需满足: $$ P \land 0o111 \neq 0 $$ 其中 $0o111$ 表示可执行权限掩码。若 $P = 0o644$(即 `-rw-r--r--`),则: $$ 644_{8} \land 111_{8} = 0 \implies \text{权限不足} $$ 需通过 $P \leftarrow P \lor 0o111$ 赋予执行权限[^3]。 --- ### 验证步骤 1. 进入容器检查权限: ```bash docker exec -it <container_id> ls -l /home/oracle/app/oracle/product/11.2.0/dbhome_2/bin/dbstart ``` 2. 手动执行脚本测试: ```bash docker exec -it <container_id> /home/oracle/app/oracle/product/11.2.0/dbhome_2/bin/dbstart ``` --- ### 总结 核心问题为 `dbstart` 脚本权限不足。通过检查容器内权限、修复镜像构建步骤、调整挂载策略或放宽安全模块限制,可解决状态码 `126` 错误。 ---
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值