Ora-12154:tns: Unable to resolve the specified connection identifier

Source: Internet
Author: User

Believe that someone who has used an Oracle database must have encountered a "ORA-12154:TNS: Unable to resolve the specified connection identifier" error, I will make a small summary here.

The way the Oracle database is connected in a program is different from other commonly used databases such as Mysql,sql server, which can be connected by directly specifying IP, but Oracle needs to be connected through the way that the Oracle client configures the network service name. Otherwise, the "Ora-12154:tns: cannot resolve the specified connection identifier" will appear. The detailed steps for configuring the Oracle client are as follows:
After the Oracle client is installed, in the Start menu, locate the Oracle-oraclient10g_home1-> Configuration and Migration Tool->net Manager and open (Win7, WIN8 user If you do not have access to Administrator account login needs to run as an administrator, expand "Oracle NET configuration---local and service naming" click on the left "plus" to configure a new network service

Finally, click "Next" to complete, if you do not know or forget the Oracle service name can be obtained through the view service, such as I configured here hostname is my native, in my Computer services to find Oracle-related services

Through the service name above, you can see that I installed the service name is "ORCL", or on the server via SQL plus using the SYS account login, enter the command
Show parameter Service_Name view.
ORACLEDBCONSOLEORCL is a service for Oracle Web-side management tools that typically have an access address of "Http://127.0.0.1:1158/em/console/logon/logon", If you are not accustomed to using this to manage the database, you do not have to start.
ORACLEJOBSCHEDULERORCL is a scheduled task in the management of Oracle and generally does not need to be started.
Oracleoradb10g_home1isql*plus is a SQL plus service, and if you are not accustomed to operating the database under the command line, you may not need to start.
Oracleserviceorcl,oracleoradb10g_home1tnslistener need to be open, the former is the main service, the latter is the monitoring service.

When you configure a service in the Oracle client, you can access the Oracle database through the network service name that we configured, and this configuration really wants to D:\Oracle\product\10.2.0\client_1\NETWORK\ A single line of configuration is added to the Admin\tnsnames.ora (because my Oracle is installed in the D-disk Oracle directory, depending on the path selected during installation).

# Tnsnames.ora Network Configuration file:d:\oracle\product\10.2.0\client_1\network\admin\tnsnames.ora# Generated by Oracle configuration Tools. ORCL =  (DESCRIPTION = (    address_list = (      ADDRESS = (PROTOCOL = TCP) (HOST = 127.0.0.1) (PORT = 1521))    ( Connect_data =      (service_name = ORCL)    )  )

If both the Oracle client and the server are installed on the same computer, the same configuration file will be present in the server installation directory D:\Oracle\product\10.2.0\db_1\NETWORK\ADMIN\ Tnsnames.ora, in this case, if we configure client Net Manager and then connect to the Oracle database, "ORA-12154:TNS: The specified connection identifier cannot be resolved" then you should suspect that Which path do I access the configuration file under? You can now use the tnsping command

      If you are a network service that is configured in client Net Manager, then the parsed usage parameter file is D:\Oracle\product\10.2.0\db_1\ Network\admin\sqlnet.ora, then I think you should understand. There are two solutions to this situation:
      First: NET Manager on the server also configures the same network service, or copies the D:\Oracle\product\10.2.0\ directly Configuration in Client_1\network\admin\tnsnames.ora to D:\Oracle\product\10.2.0\db_1\NETWORK\ADMIN\ Tnsnames.ora, you need to do this every time you configure a new network service, and if you don't want to be so troublesome then use the second solution.      
      Second: Modify the System environment variable path value to D:\Oracle\product\10.2.0\ Client_1\bin; The path moves to D:\Oracle\product\10.2.0\db_1\bin;
      Note: This occurs because the Oracle client and database services are installed on a single computer and are caused by installing the client first, and then installing the database service. This will not happen if you install the database service first and then install the client.
       After configuring Oracle based on the above, it is believed that the Oracle database can be connected properly in the program.

When I installed the Plsql developer software after logging in the "Ora-12154:tns: Unable to resolve the specified connection identifier", if it is win7,win8 users can even appear a white box, you need to run as an administrator plsql Developer, and make sure your plsql Developer is read by the Oracle client configuration, cancel the login directly, find "Developer" in the Plsql tools->preferences toolbar, Locate the Oracle Home selection oraclient10g_home1 in Oracle's connection node and close Plsql developer after saving to log in.

It is important to note that the Plsql developer cannot be installed in a directory with parentheses, such as the program Files (x86) directory of the 64bit system, it will appear no matter how you set it, it still pops up "Ora-12154:tns: Unable to resolve the specified connection identifier. The same problem can be seen in other Oracle database management software, such as Toad for Oracle

"Ora-12154:tns: Unable to resolve the specified connection identifier" is one of the more common problems experienced by novice users of Oracle database, as long as we understand how it works, calmly troubleshoot, and believe it's easy to find a solution to the problem.

Ora-12154:tns: Unable to resolve the specified connection identifier

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.