首页 > 代码库 > 【翻译自mos文章】 在Oracle software 被安装时, /dev/null0文件被创建。

【翻译自mos文章】 在Oracle software 被安装时, /dev/null0文件被创建。


在Oracle software 被安装时, /dev/null0文件被创建。

参考原文:
File /dev/null0 Is Created After Installation Of Oracle Software (Doc ID 1322550.1)

适用于:
Oracle Database - Enterprise Edition - Version 10.2.0.1 and later
Information in this document applies to any platform.


症状:
由于安全原因,只有被许可的文件才能出现在/dev下.

1. on HP-IA

[celchp4]/refresh/home> ls -al /dev/ | grep null
crw-rw-rw- 1 bin bin 3 0x000002 May 16 07:30 null
-rw-r--r-- 1 root sys 0 Jul 1 2010 null0
[celchp4]/refresh/home> ll /dev/null
crw-rw-rw- 1 bin bin 3 0x000002 May 16 07:53 /dev/null
[celchp4]/refresh/home> ll /dev/null0
-rw-r--r-- 1 root sys 0 Jul 1 2010 /dev/null0
[celchp4]/refresh/home>

2. on IBM AIX

[celcaix4]/home/bugmnt> ls -al /dev/ | grep null
crw-rw-rw- 1 root system 2, 2 May 16 07:58 null
-rw-r--r-- 1 root system 0 Apr 08 2010 null0
crw------- 1 root system 7, 2 Jul 28 2009 sysdumpnull
[celcaix4]/home/bugmnt> ll /dev/null
crw-rw-rw- 1 root system 2, 2 May 16 07:58 /dev/null
[celcaix4]/home/bugmnt> ll /dev/null0
-rw-r--r-- 1 root system 0 Apr 08 2010 /dev/null0
[celcaix4]/home/bugmnt>

3. on Oracle Solaris

[celcsol4]/home/bugmnt> ls -al /dev/ | grep null
lrwxrwxrwx 1 root root 9 Sep 10 2010 dtremote -> /dev/null
lrwxrwxrwx 1 root other 27 May 14 2008 null -> ../devices/pseudo/mm@0:null
-rw-r--r-- 1 root other 0 Aug 31 2010 null0
[celcsol4]/home/bugmnt>


4. on Linux

grid@gcsst1:/dev> ls -al /dev/ | grep null
crw-rw-rw- 1 root root 1, 3 2009-02-24 03:06 null
lrwxrwxrwx 1 root root 4 2011-04-06 15:16 XOR -> null
grid@gcsst1:/dev>


变化:
Oracle 软件被安装

原因:
运行 root.sh 会生成 ‘/dev/null0‘.

[pst4:/]# ls /dev/null*
/dev/null
[pst4:/]# /db01/oracle/product/10.2/db_2/root.sh
Running Oracle10 root.sh script...

The following environment variables are set as:
ORACLE_OWNER= oracle
ORACLE_HOME= /db01/oracle/product/10.2/db_2

Enter the full pathname of the local bin directory: [/usr/local/bin]:
The file "dbhome" already exists in /usr/local/bin. Overwrite it? (y/n) [n]:
The file "oraenv" already exists in /usr/local/bin. Overwrite it? (y/n) [n]:
The file "coraenv" already exists in /usr/local/bin. Overwrite it? (y/n) [n]:

Entries will be added to the /var/opt/oracle/oratab file as needed by
Database Configuration Assistant when a database is created
Finished running generic part of root.sh script.
Now product-specific root actions will be performed.
[pst4:/]# ls /dev/null*
/dev/null /dev/null0
[pst4:/]#


a. from root.sh script




#
# If LOG is not set, then send output to /dev/null
#

if [ "x${LOG}" = "x" -o "${LOG}" = "" ];then
LOG=/dev/null
else
$CP $LOG ${LOG}0 2>/dev/null
$ECHO "" > $LOG
fi

b. from truss output

91502 27646: execve("/usr/bin/cp", 0x0003B95C, 0x0003B978) argc = 3
91503 27646: argv: /usr/bin/cp /dev/null /dev/null0
91504 27646: envp: HOME=/ LANG=POSIX
91505 27646: LD_LIBRARY_PATH=:/usr/openwin/lib:/usr/X11R6/lib LOGNAME=root
91506 27646: MAIL=/var/mail//root OLDPWD=/
91507 27646: PATH=/usr/sbin:/usr/bin:/usr/openwin/bin:/usr/X11R6/bin:.
91508 27646: PS1=[pst4:$PWD]# PWD=/db01/oracle/product/10.2/db_2
91509 27646: SHELL=/bin/bash SHLVL=1 SSH_CLIENT=10.179.117.70 2617 22
91510 27646: SSH_CONNECTION=10.179.117.70 2617 10.179.112.34 22
91511 27646: SSH_TTY=/dev/pts/2 TERM=xterm TZ=ROK USER=root
91512 27646: _=/usr/bin/truss
91513 27646: resolvepath("/usr/lib/ld.so.1", "/lib/ld.so.1", 1023) = 12

...

91577 27646: munmap(0xFF260000, 32768) = 0
91578 27646: pathconf("/dev/null", 20) = 1
91579 27646: acl("/dev/null", GETACLCNT, 0, 0x00000000) = 4
91580 27646: stat64("/dev/null", 0xFFBFEDA0) = 0
91581 27646: acl("/dev/null", GETACL, 4, 0x000276C8) = 4
91582 27646: stat64("/dev/null0", 0x00026630) = 0
91583 27646: stat64("/dev/null0", 0x00026630) = 0
91584 27646: open64("/dev/null", O_RDONLY) = 3
91585 27646: creat64("/dev/null0", 0666) = 4
91586 27646: stat64("/dev/null0", 0x00026630) = 0
91587 27646: fstat64(3, 0x000266C8) = 0
91588 27646: read(3, 0xFFBF6F00, 32768) = 0

解决方案:
忽略这个现象并删除‘/dev/null0‘ 这个文件,只要没有进程使用这个文件(使用lsof 或者fuser 或者其他任何合适的工具来检查 null0是否被进程在使用)

【翻译自mos文章】 在Oracle software 被安装时, /dev/null0文件被创建。