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

来源:互联网 发布:逆战代刷淘宝 编辑:程序博客网 时间:2024/05/18 03:13

设置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://blog.csdn.net/tianlesoftware/archive/2011/03/07/6229521.aspx

 

 

我们开始删除的那段配置,应该是写在/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

0 0
原创粉丝点击