问题现象:
$ crontab -l
16 22 * * * /home/oracle/script/get_last_seq.sh$ /home/oracle/script/get_last_seq.sh
/home/oracle/script/get_last_seq.sh[3]: ulimit: The specified value exceeds the user's allowable limit.
/home/oracle/script/get_last_seq.sh[4]: /var/tmp/sh11818.13: Cannot create the specified file.
logout
解决办法:
1、ulimit: The specified value exceeds the user's allowable limit.
解决方法如下:
#ulimit -n 655352、$ /home/oracle/script/get_last_seq.sh
/home/oracle/script/get_last_seq.sh[4]: /var/tmp/sh12135.13: Cannot create the specified file.
logout
该问题排查步骤如下:
使用oracle用户在/var/tmp下创建目录报错无权限:$ pwd
/var/tmp
$ mkdir 1
mkdir: cannot access .: Permission denied
使用oracle用户在/tmp下创建目录正常:
$ cd /tmp
$ mkdir 1
$ rm -rf 1
$
查看确认两个目录权限不一样,如下:
$ cd /$ ll
total 10260
…
drwxrwxrwx 18 root root 8192 Aug 9 10:08 tmp
drwxr-xr-x 9 oracle dba 1024 May 8 2015 u01
drwxrwxrwx 2 root sys 96 Dec 15 2011 u02
dr-xr-xr-x 22 bin bin 8192 Mar 14 2007 usr
dr-xr-xr-x 27 bin bin 8192 Aug 3 17:35 var
drwxrwxrwx 2 root sys 96 Jul 22 2009 volbak
drwxr-xr-x 9 weblogic bea 1024 Apr 2 2010 weblogic
-rw-r--r-- 1 root sys 0 Sep 21 2007 weblogic.prefs
drwxr-xr-x 5 wls103 wls103 1024 Apr 10 2015 wls1035
$ pwd
/var
$ ll
total 160
…
drwxr-xr-x 2 root root 8192 Aug 9 10:07 tmp
drwxr-xr-x 2 root sys 8192 Aug 4 10:18 tombstones
dr-xr-xr-x 6 bin bin 96 Sep 9 2004 uucp
dr-xr-xr-x 5 bin bin 96 Apr 10 2007 vx
drwxr-xr-x 2 bin bin 8192 Sep 9 2004 yp
修改如下:
#chmod -R 777 tmp
#ll
total 160
…
drwxrwxrwx 2 root root 8192 Aug 9 10:07 tmp
drwxr-xr-x 2 root sys 8192 Aug 4 10:18 tombstones
dr-xr-xr-x 6 bin bin 96 Sep 9 2004 uucp
dr-xr-xr-x 5 bin bin 96 Apr 10 2007 vx
drwxr-xr-x 2 bin bin 8192 Sep 9 2004 yp
修改后,oracle用户可在/var/tmp下创建文件
$ pwd
/var/tmp
$ mkdir 1
$ rm -rf 1
$
至此脚本/home/oracle/script/get_last_seq.sh执行正常。