Linux 下Oracle 环境变量- bash- ulimit- open files- cannot modify limit 解决

    技术2022-05-19  20

     

    设置Oracle 环境变量的时候报错:

    [oracle@qs-dmm-rh1 ~]$ source .bash_profile

    -bash: ulimit: open files: cannot modify limit: 不允许的操作

     

    设置的环境变量如下:

    # Oracle Settings

    TMP=/tmp; export TMP

    TMPDIR=$TMP; export TMPDIR

    ORACLE_BASE=/u01/app/oracle; export ORACLE_BASE

    ORACLE_HOME=$ORACLE_BASE/product/10.2.0/db_1; export ORACLE_HOME

    ORACLE_SID=orcl; export ORACLE_SID

    ORACLE_TERM=xterm; export ORACLE_TERM

    PATH=/usr/sbin:$PATH; export PATH

    PATH=$ORACLE_HOME/bin:$PATH; export PATH

    LD_LIBRARY_PATH=$ORACLE_HOME/lib:/lib:/usr/lib; export LD_LIBRARY_PATH

    CLASSPATH=$ORACLE_HOME/jre:$ORACLE_HOME/jlib:$ORACLE_HOME/rdbms/jlib; export CLASSPATH

    if [ $USER = "oracle" ]; then

    if [ $SHELL = "/bin/ksh" ]; then

    ulimit -p 16384

    ulimit -n 65536

    else

    ulimit -u 16384 -n 65536

    fi

    fi

     

    把最后一段if 判断去掉后,在source正常.

     

    在安装Oracle 过程中还有其他几个地方参数配置:

    /etc/security/limits.conf 文件里添加:

    oracle              soft    nproc   2047

    oracle              hard    nproc   16384

    oracle              soft    nofile  1024

    oracle              hard    nofile  65536

     

    我们cat limits.conf 文件时,在最上面有参数的解释:

    # - nofile - max number of open files

    # - nproc - max number of processes

     

    这个参数的意思和ulimit -u -n 参数作用是一样的。

    -u

    用户最大可用的进程数。

    -n

    可以打开最大文件描述符的数量。

     

    关于ulimit 的更多内从,参考:

           通过 ulimit 改善系统性能

    http://www.cndba.cn/Dave/article/645

          

     

    我们开始删除的那段配置,应该是写在/etc/profile 文件里的。

          

           /etc/profile: 此文件为系统的每个用户设置环境信息,当用户第一次登录时,该文件被执行.并从/etc/profile.d目录的配置文件中搜集shell的设置.

     

    Make the following changes to the default shell start-up file:

     

    1For the Bourne, Bash, or Korn shell, add the following lines to the /etc/profile

    file:

    if [ $USER = "oracle" ]; then

    if [ $SHELL = "/bin/ksh" ]; then

    ulimit -p 16384

    ulimit -n 65536

    else

    ulimit -u 16384 -n 65536

    fi

    fi

     

    2For the C shell, add the following lines to the /etc/csh.login file:

    ( $USER == "oracle" ) then

    limit maxproc 16384

    limit descriptors 65536

    endif

     

     

     

     

     

    ---------------------------------------------------------------------------------------------------

    QQ: 492913789

    Email:ahdba@qq.com

    Blog: http://www.cndba.cn/dave

    DBA1 群:62697716(); DBA2 群:62697977() DBA3 群:62697850()  

    DBA 超级群:63306533(); DBA4 群: 83829929 DBA5群: 142216823

    聊天 群:40132017

    --加群需要在备注说明Oracle表空间和数据文件的关系,否则拒绝申请


    最新回复(0)