ORA-12162: TNS:net service name is incorrectly specified Cause: The connect descriptor corresponding to the net service name in TNSNAMES.ORA or in the directory server (Oracle Internet Directory) is incorrectly specified. Action: If using local naming make sure there are no syntax errors in the corresponding connect descriptor in the TNSNAMES.ORA file. If using directory naming check the information provided through the administration used for directory naming. 检查tnsname.ora文件中的网络服务名的配置
Cause: The connect descriptor corresponding to the net service name in TNSNAMES.ORA or in the directory server (Oracle Internet Directory) is incorrectly specified.
Action: If using local naming make sure there are no syntax errors in the corresponding connect descriptor in the TNSNAMES.ORA file. If using directory naming check the information provided through the administration used for directory naming.
检查tnsname.ora文件中的网络服务名的配置
ORCL =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = 127.0.0.1)(PORT = 1521))
)
(CONNECT_DATA =
(SERVICE_NAME = orcl)
)
)
如果是的话,看看本机上是否装了不止一个数据库软件,比如同时装了多个Oracle服务端、多个Oracle客户端,或者同时装了服务端和客户端,如果是这种情况,在环境变量中将Oracle_home指定到你说的tnsnames.ora文件所在的那个目录下(实际上是tnsnames.ora所在的目录的上上级),或者将你的tnsnames.ora文件在这几个目录中分别拷贝粘贴一份
vi ~/.bash_profile
你试下在oracle用户下为.bash_profile添加下面的字段
ORACLE_SID=orcl
export ORACLE_SID