今天在数据库服务器上添加了一个新的账号,想通过这个账号来使用系统认证登录到oracle。创建好账号后,在该账号的.bash_profile文件中添加oracle的环境变量,同时把它加入到dba组中。这样一般就可以使用该账号进行系统认证登录了。不过今天倒霉,就是登不进去,报错了:
$ sqlplus / as sysdba
SQL*Plus: Release 10.2.0.4.0 - Production on ÐÇÆÚËÄ 11ÔÂ 25 09:55:03 2010
Copyright (c) 1982, 2007, Oracle. All Rights Reserved.
ERROR:
ORA-09925: Unable to create audit trail file
Linux-x86_64 Error: 13: Permission denied
Additional information: 9925
ORA-09925: Unable to create audit trail file
Linux-x86_64 Error: 13: Permission denied
Additional information: 9925
刚开始看到这个错误的时候以为是没有权限写audit trail 文件,结果到相应的目录下查看adump相应的权限是组只有读和执行的权限,没有写权限。于是使用chmod g+w adump命令给组加上写权限。结果是:
[xie@bogon ~]$ sqlplus / as sysdba
SQL*Plus: Release 10.2.0.1.0 - Production on Thu Nov 25 10:15:32 2010
Copyright (c) 1982, 2005, Oracle. All rights reserved.
Connected to an idle instance.
SQL> conn / as sysdba
Connected to an idle instance.
SQL> startup
ORA-10997: another startup/shutdown operation of this instance inprogress
ORA-09967: unable to create or open lock file
Linux-x86_64 Error: 13: Permission denied
奇怪了,起了一个空实例。可是数据库明明是启动着的。到adump目录下查看
-rw-r----- 1 oracle dba 628 Nov 18 17:57 ora_2120.aud
-rw-r----- 1 oracle dba 630 Nov 19 17:36 ora_19418.aud
-rw-r----- 1 oracle dba 628 Nov 22 14:24 ora_6105.aud
-rw-r----- 1 oracle dba 628 Nov 22 15:31 ora_8334.aud
-rw-rw---- 1 oracle dba 623 Nov 25 09:34 ora_776.aud
-rw-r----- 1 xie dba 619 Nov 25 10:15 ora_1232.aud
-rw-r----- 1 xie dba 619 Nov 25 10:15 ora_1233.aud
注意到刚生成的文件属主是‘xie‘这个用户,而不是oracle,查看一下不用用户下文件的内容:
查看:oracle的ora_776.aud文件
ORACLE_HOME = /u01/oracle/product/10.2.0/dbs
System name: Linux
Node name: bogon
Release: 2.6.9-78.ELsmp
Version: #1 SMP Wed Jul 9 15:46:26 EDT 2008
Machine: x86_64
Instance name: think
Redo thread mounted by this instance: 1
Oracle process number: 17
Unix process pid: 776, image:oracle@bogon(TNS V1-V3)
Thu Nov 25 09:34:28 2010
ACTION : 'CONNECT'
DATABASE USER: '/'
PRIVILEGE : SYSDBA
CLIENT USER: xie
CLIENT TERMINAL: pts/1
STATUS: 0
查看xie用户的ora_1232.aud
ORACLE_HOME = /u01/oracle/product/10.2.0/dbs
System name: Linux
Node name: bogon
Release: 2.6.9-78.ELsmp
Version: #1 SMP Wed Jul 9 15:46:26 EDT 2008
Machine: x86_64
Instance name: think
Redo thread mounted by this instance: 0 <none>
Oracle process number: 0
Unix process pid: 1232, image:oracle@bogon
Thu Nov 25 10:15:32 2010
ACTION : 'CONNECT'
DATABASE USER: '/'
PRIVILEGE : SYSDBA
CLIENT USER: xie
CLIENT TERMINAL: pts/1
STATUS: 0
注意看红颜色表示的部分内容。
看来不是这个adump文件权限的问题。那会是什么问题呢,后来到网上搜索,找到了真正的原因:
正常情况下$ORACLE_HOME/bin/oracle文件的权限是:
-rwsr-sr-x
可此数据库的此文件的权限是:
-rwxr-xr-x ---没了s位,即没了强制位。
默认情况下,用户执行一个指令,会以该用户的身份来运行进程。
指令文件上加了强制位,可以让用户执行的指令,以指令文件的拥有者或是所属组的身份运行进程
chmod 6755 $ORACLE_HOME/bin/oracle命令给该文件的用户和组加上强制位