环境变量TWO_TASK

[root@zyh tiv]# sqlplus system/oracle

SQL*Plus: Release 11.2.0.1.0 Production on Tue Oct 19 14:34:23 2010
Copyright (c) 1982, 2009, Oracle.  All rights reserved.
ERROR:
ORA-12162: TNS:net service name is incorrectly specified
Enter user-name:
ERROR:
ORA-12162: TNS:net service name is incorrectly specified
Enter user-name:
ERROR:
ORA-12162: TNS:net service name is incorrectly specified
SP2-0157: unable to CONNECT to ORACLE after 3 attempts, exiting SQL*Plus
[root@zyh tiv]#
[root@zyh tiv]# export ORACLE_SID=orcl
[root@zyh tiv]# sqlplus system/oracle
SQL*Plus: Release 11.2.0.1.0 Production on Tue Oct 19 14:34:59 2010
Copyright (c) 1982, 2009, Oracle.  All rights reserved.
ERROR:
ORA-12546: TNS:permission denied
Enter user-name:
ERROR:
ORA-12546: TNS:permission denied
Enter user-name:
ERROR:
ORA-12546: TNS:permission denied
SP2-0157: unable to CONNECT to ORACLE after 3 attempts, exiting SQL*Plus

[root@zyh tiv]# sqlplus system/oracle@orcl

SQL*Plus: Release 11.2.0.1.0 Production on Tue Oct 19 14:39:02 2010

Copyright (c) 1982, 2009, Oracle.  All rights reserved.
???:
Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
SQL>

上面通过Oracle*NET就可以通过,那这是什么原因呢?
因为用非Oracle用户连接数据,熥 常会走IPC协议,但是如果此用户对$ORACLE_HOME/bin,$ORACLE_HOME/lib没有执行权限,就不能走IPC连接,只能走oracle*net了,就要设TWO_TASK变量指定服务名



[root@zyh tiv]# export TWO_TASK=orcl
[root@zyh tiv]# sqlplus system/oracle

SQL*Plus: Release 11.2.0.1.0 Production on Tue Oct 19 14:45:36 2010
Copyright (c) 1982, 2009, Oracle.  All rights reserved.
???:
Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
SQL>

那么为什么其他的是对的,这个环境的问题出在那儿了?

[oracle@zyh bin]$ ls -l oracle
-rwxr-xr-x 1 oracle oinstall 173515991 09-27 16:33 oracle
[oracle@zyh bin]$ chmod u+s oracle
[oracle@zyh bin]$ chmod g+s oracle

[oracle@zyh bin]$ ls -l oracle
-rwsr-sr-x 1 oracle oinstall 173515991 09-27 16:33 oracle
现在的权限才是对的

再测试一下
[root@zyh trace]# sqlplus system/oracle

SQL*Plus: Release 11.2.0.1.0 Production on Tue Oct 19 15:52:23 2010

Copyright (c) 1982, 2009, Oracle.  All rights reserved.


???:
Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options

SQL>



作者: lzdyxin   发布时间: 2010-10-19