TNSNames configuration missing spaces caused by ORA-12154

Source: Internet
Author: User
Tags reserved oracle database sqlplus

Today, a netizen came to me to say with sqlplus remote connection always error, not connected, the final check found that his native tnsnames file configuration format is not the cause of the

Here are my simulated environments, as follows:

[Oracle@localhost admin]$ Sqlplus Scott/tiger@goolen
Sql*plus:release 11.2.0.1.0 Production on Thu Dec 26 20:23:45 2013
Copyright (c) 1982, Oracle. All rights reserved.
ERROR:

Ora-12154:tns:could not resolve the connect identifier specified


[Oracle@localhost admin]$ tnsping Goolen
TNS Ping Utility for linux:version 11.2.0.1.0-production on 26-dec-2013 20:27:55
Copyright (c) 1997, Oracle. All rights reserved.
Used parameter files:

Used TNSNames Adapter to resolve the alias
Attempting to contact (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP) (HOST = 192.168.100.50) (PORT = 1521)) (Connect_data = (SER VER = dedicated) (service_name = Goolen)
Tns-12533:tns:illegal ADDRESS Parameters


++++telnet 1521 Port No problem
[Oracle@localhost admin]$ telnet 192.168.100.50 1521
Trying 192.168.100.50 ...
Connected to 192.168.100.50 (192.168.100.50).
Escape character is ' ^] '.
Q
Quit
Connection closed by foreign host.


++++ I suddenly think of a long ago read a piece of article, said that the format of the file configuration will cause the connection failed, but not very clear, I think he should be the problem

Then I found myself testing it locally, and it was true that if a line under Service_Name was missing a space, it would cause the same error

Then let him check his tnsnames file, and sure enough, he said it was on the internet casually posted in the format


+ + + View the contents of the TNSNames file:

[Oracle@localhost admin]$ Cat Tnsnames.ora
Goolen =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP) (HOST = 192.168.100.50) (PORT = 1521))
(Connect_data =
(SERVER = dedicated)
(service_name = Goolen)
)
)

Oracle@localhost admin]$ Sqlplus Scott/tiger@goolen
Sql*pls:release 11.2.0.1.0 Production on Thu Dec 26 20:23:45 2013

Copyright (c) 1982, Oracle. All rights reserved.
ERROR:
Ora-12154:tns:could not resolve the connect identifier specified

+ + + then let him change the format, put a space in front, and then connect again, OK

[Oracle@localhost admin]$ Cat Tnsnames.ora
Goolen =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP) (HOST = 192.168.100.50) (PORT = 1521))
(Connect_data =
(SERVER = dedicated)
(service_name = Goolen)
)
)
[Oracle@localhost admin]$ Sqlplus Scott/tiger@goolen

Sql*plus:release 11.2.0.1.0 Production on Thu Dec 26 20:41:40 2013

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

Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.1.0-64bit Production
With the partitioning, OLAP, Data Mining and Real application testing options

Sql>
Sql>


Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.