Speaking of ora-12154 problems, there are a lot of solutions online, the reasons are basically unified: TNS or Listener Configuration is incorrect. Generally, incorrect Listener Configuration rarely occurs. Most people follow the default configuration to "Next", which is basically the service name of orcl. If you can connect to orcl locally, other machines cannot connect to listener. Most of them are incorrect TNS configurations. I encountered a phenomenon: A 2003 virtual machine was created on the machine, and Oracle10g was installed on the virtual machine. The default configuration is as follows. Only the Oracle10g client is installed on this machine. When I used to connect to the orcl service of the local database in the LAN (the database is the same as the database in the LAN), there is no problem, but the orcl service in the connection virtual machine does not connect, always reports ora-12154 error. In the virtual machine, PLSQL can connect to the Virtual Machine Oracle, but cannot connect to the Oracle in the local area network.
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: \ oracle \ product \ 10.2.0 \ db_1) db_home
(Sid_name = test)
)
(Sid_desc =
(Program = EXTPROC)
(Sid_name = plsextproc)
(ORACLE_HOME = E: \ oracle \ product \ 10.2.0 \ db_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.