Oracle connection appears ora-12154

Source: Internet
Author: User

Oracle connection appears ora-12154


After rac is configured, both nodes can be pinged with tnsping, but the following error occurs when connecting with sqlplus.
[Oracle @ rac2 admin] $ lsnrctl status

LSNRCTL for Linux: Version 9.2.0.4.0-Production on 04-MAR-2008 08:32:26

Copyright (c) 1991,200 2, Oracle Corporation. All rights reserved.

Connecting to (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP) (HOST = rac2) (PORT = 1521 )))
STATUS of the LISTENER
------------------------
Alias LISTENER
Version TNSLSNR for Linux: Version 9.2.0.4.0-Production
Start Date 04-MAR-2008 08:29:03
Uptime 0 days 0 hr. 3 min. 22 sec
Trace Level off
Security OFF
SNMP OFF
Listener Parameter File/home/oracle/9.2.0.4/network/admin/listener. ora
Listener Log File/home/oracle/9.2.0.4/network/log/listener. log
Listening Endpoints Summary...
(DESCRIPTION = (ADDRESS = (PROTOCOL = tcp) (HOST = rac2) (PORT = 1521 )))
Services Summary...
Service "PLSExtProc" has 1 instance (s ).
Instance "PLSExtProc", status UNKNOWN, has 1 handler (s) for this service...
Service "esal" has 2 instance (s ).
Instance "rac1", status READY, has 1 handler (s) for this service...
Instance "rac2", status READY, has 1 handler (s) for this service...
The command completed successfully
[Oracle @ rac2 admin] $ lsnrctl service

LSNRCTL for Linux: Version 9.2.0.4.0-Production on 04-MAR-2008 08:32:32

Copyright (c) 1991,200 2, Oracle Corporation. All rights reserved.

Connecting to (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP) (HOST = rac2) (PORT = 1521 )))
Services Summary...
Service "PLSExtProc" has 1 instance (s ).
Instance "PLSExtProc", status UNKNOWN, has 1 handler (s) for this service...
Handler (s ):
"DEDICATED" established: 0 refused: 0
LOCAL SERVER
Service "esal" has 2 instance (s ).
Instance "rac1", status READY, has 1 handler (s) for this service...
Handler (s ):
"DEDICATED" established: 0 refused: 0 state: ready
REMOTE SERVER
(Address = (protocol = tcp) (host = rac1) (port = 1521 ))
Instance "rac2", status READY, has 1 handler (s) for this service...
Handler (s ):
"DEDICATED" established: 0 refused: 0 state: ready
LOCAL SERVER
The command completed successfully
[Oracle @ rac2 admin] $ sqlplus cy/zh @ esal

SQL * Plus: Release 9.2.0.4.0-Production on Tue Mar 4 08:32:45 2008

Copyright (c) 1982,200 2, Oracle Corporation. All rights reserved.

ERROR:
ORA-12154: TNS: cocould not resolve service name


Enter user-name:
ERROR:
ORA-01017: invalid username/password; logon denied


Enter user-name: cy/zh @ rac1
ERROR:
ORA-12154: TNS: cocould not resolve service name


SP2-0157: unable to CONNECT to ORACLE after 3 attempts, exiting SQL * Plus
[Oracle @ rac2 admin] $ sqlplus cy/zh @ rac2

SQL * Plus: Release 9.2.0.4.0-Production on Tue Mar 4 08:32:59 2008

Copyright (c) 1982,200 2, Oracle Corporation. All rights reserved.

ERROR:
ORA-12154: TNS: cocould not resolve service name


Enter user-name:


Generally, you can solve the problem as follows:

Run cmd in the VM and use lsnrctl status to view the listener services.
If you see the listening service "orcl", you must write orcl In the tns configuration of the Local Machine (SERVICE_NAME = orcl). If you want to customize it, add the Custom Service name in the listener Configuration of the Virtual Machine. Remember to restart the listening service: lsnrctl reload.
The final configuration file is as follows:
Virtual Machine listener:

SID_LIST_LISTENER =
(SID_LIST =
(SID_DESC =
(GLOBAL_DBNAME = test) Custom Service name
(ORACLE_HOME = E: oracleproduct10.2.0db _ 1) db_home
(SID_NAME = test)

)
(SID_DESC =
(PROGRAM = extproc)
(SID_NAME = PLSExtProc)
(ORACLE_HOME = E: oracleproduct10.2.0db _ 1) # This Service ensures that you can use external processes, such as C Programs.
)
)

Local tns:

ORCL_XNJ =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP) (HOST = 182.12.15.232) (PORT = 1521 ))
)
(CONNECT_DATA =
(SERVICE_NAME = test) corresponds to the Custom Service name
)
)

Connect again to solve the problem!

Remember, you must start from the simplest reason. Don't see any changes to the number of processes and registries on the Internet as soon as you go up. Think about why the local machine can connect to the network, locate the problem.

An error occurred while connecting to oracle with VS2008 ora-12154 tns could not parse the specified connection identifier


Ensure that your code is correct:
(1) check whether the OracleOraDb10g_home1TNSListener service has been started, that is, the listening service.
(2) Check whether tnsnames. ora adds a connection string (SQLPLUS or pl/SQL is recommended). The path is generally % Oracle_home % product10.2.0db _ 1NETWORKADMINtnsnames. ora

The above answers are for reference.

Related Article

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.