ORA-12154: TNS: unable to resolve the specified connection identifier resolved

Source: Internet
Author: User

ORA-12154: TNS: unable to resolve the specified connection identifier resolved

I believe that people who have used Oracle databases must have encountered the "ORA-12154: TNS: unable to resolve the specified connection identifier" error, I would like to make a small summary here.

The connection to the Oracle database in a program is different from that to other common databases, such as MySql and SQL Server. These databases can be connected by specifying IP addresses directly, however, Oracle needs to connect by configuring the network service name on the Oracle client. Otherwise, the ORA-12154: TNS: the specified connection identifier cannot be resolved ".

The procedure for configuring the Oracle client is as follows:

After the Oracle client is installed, go to "Oracle-connector lient10g_home1-> Configure and port tools-> Net Manager" in the Start menu and open (Win7, if the Win8 user does not obtain the Administrator Account Login, run it as an Administrator.) Expand "Oracle Net configuration-> Local-> service name" and click "plus sign" on the left to configure the new network service.

Finally, click "Next". If you do not know or forget the Oracle service name, you can view the service. For example, the host name configured here is my local host, find oracle-related services in my computer services

The above service name shows that the service name I installed is "ORCL", or log on to the server using SQL Plus using the sys account and enter the command

Show parameter service_name.

OracleDBConsoleORCL is a service for Oracle Web Page Management tools. Its access address is generally "http: // 127.0.0.1: 1158/em/console/logon ", if you are not used to using this to manage databases, you do not need to start the database.

OracleJobSchedulerORCL is used to manage tasks scheduled in Oracle and generally does not need to be started.

OracleOraDb10g_home1iSQL * Plus is an SQL Plus service. If you are not used to operating the database under the command line, you do not need to start it.

Both OracleServiceORCL and OracleOraDb10g_home1TNSListener must be enabled. The former is the primary service and the latter is the listener service.

After configuring the Net Manager service in the Oracle client, you can access the Oracle database through the network service name we configured. In this configuration, D: \ Oracle \ product \ 10.2.0 \ client_1 \ NETWORK \ ADMIN \ tnsnames. add a line of configuration in ora (because my Oracle is installed in the Oracle directory of drive D, the specific path depends 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 the Oracle client and server are installed on the same computer at the same time, the same configuration file D will also exist in the installation directory of the server: \ Oracle \ product \ 10.2.0 \ db_1 \ NETWORK \ ADMIN \ tnsnames. ora, in this case, if we have configured the client Net Manager and connected to the Oracle database, there may be "ORA-12154: TNS: Unable to parse the specified connection identifier", you should be skeptical, which path of the configuration file is accessed? In this case, you can use the tnsping command

If you are configuring the NETWORK service in the client Net Manager, but the resolved parameter file is D: \ Oracle \ product \ 10.2.0 \ db_1 \ NETWORK \ ADMIN \ sqlnet. ora, so I think you should understand. There are two solutions to this problem:

1. Configure the same NETWORK service for the Net Manager on the server, or directly Copy D: \ Oracle \ product \ 10.2.0 \ client_1 \ NETWORK \ ADMIN \ tnsnames. configure to D: \ Oracle \ product \ 10.2.0 \ db_1 \ NETWORK \ ADMIN \ tnsnames in ora. ora, you need to do this every time you configure a new network service. If you don't want to be so troublesome, use the second solution.

2. Modify the Path value of the system environment variable and move D: \ Oracle \ product \ 10.2.0 \ client_1 \ bin to D: \ Oracle \ product \ 10.2.0 \ db_1 \ bin; once and for all.

Note: The cause of this situation is that the oracle client and Database Service are installed on a computer at the same time, and the client is installed before the Database Service is installed, if you first install the database service and then install the client, this will not happen.

After configuring oracle according to the above method, I believe that the oracle database can be connected normally in the program.

After I installed the PLSQL Developer Software, the login appeared "ORA-12154: TNS: unable to resolve the specified connection identifier", if it is Win7, A white box may even pop up for Win8 users. In this case, you need to run PLSQL Developer as an administrator and make sure that your PLSQL Developer is the oracle client configuration you have read to cancel login, on the PLSQL Developer toolbar, find "Tools-> Preferences" and select "cmdlient10g_home1" for Oracle Home on the Connection node of Oracle. After saving the settings, close PLSQL Developer and log on to the console.

Note that PLSQL Developer cannot be installed in a directory with parentheses, such as the 64bit system's Program Files (x86) directory, it keeps popping up "ORA-12154: TNS: unable to resolve the specified connection identifier ". The same problem may occur 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 encountered by beginners using Oracle database, as long as we understand the way it works, calmly troubleshoot, I believe it is easy to find a solution to the problem.

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.