ORA-12162: TNS:net service name 解决方案

ORA-12162: TNS:net service name is incorrectly specified问题


现象:


目前连接数据库时候出现问题了:

[oracle@as3]$ sqlplus “/ as sysdba”

ERROR:

ORA-12162: TNS:net service name is incorrectly specified



Enter user-name: oral

Enter password:

ERROR:

ORA-12162: TNS:net service name is incorrectly specified



Enter user-name: oral

Enter password:

ERROR:

ORA-12162: TNS:net service name is incorrectly specified



可能问题:

1:~.bash_profile文件中估计没有正确设置ORACLE_SID环境变量

2:检查sqlnet.ora中sqlnet.authentication_services设置

3:用 orapwd 重建密码文件


解决问题:


上面的问题经过检查是由于ORACLE_SID设置引起的,主要是因为在oracle环境变量中,虽然设置了ORACLE_SID,但是没有export引起的。最后在~.bash_profile中设置

export ORACLE_SID,问题解决!



下面是metalink.的解释:



The information in this document.nbspapplies to:

Oracle Server - Enterprise Edition - Version: 10.1.0.3 to 10.1.0.3

This problem can occur on any platform.

Affects most UNIX platforms (not seen on Microsoft Windows due to difference in BEQ communication specifics)

Errors

ORA-12162 "TNS:service name is incorrectly specified"



Symptoms

When trying to connect locally (BEQ) to the database, getting "ORA-12162 error tns:net service name

is incorrectly spelled"



This is unusual because a TNS:Net service name is not being specified, nor is the environement variable TWO_TASK set.



Cause

The user environment variable $ORACLE_SID is not set.

When this is not set, then SQL*Plus use, without a connect string, may result in an ORA-12162 error.

Solution

Add the ORACLE_SID to the .profile for the Oracle user.

This will give the BEQ adapter a route to connect to the instance.



References

原文地址:http://www.ixdba.net/article/ae/256.html

你可能感兴趣的:(oracle)