Home >Database >SQL >What should I do if ora-12154: The specified connection identifier cannot be resolved?

What should I do if ora-12154: The specified connection identifier cannot be resolved?

(*-*)浩
(*-*)浩Original
2019-11-16 09:38:3865279browse

What should I do if ora-12154: The specified connection identifier cannot be resolved?

Use PL/SQL Developer to connect to the company's Oracle database. The following error message appears when logging in: ORA-12154: TNS: Unable to parse the specified connection identifier , ( Sometimes the error dialog box may not appear, but the connection cannot be made. If you try several times, the error dialog box as shown below will pop up). (Recommended learning: mysql learning)

What should I do if ora-12154: The specified connection identifier cannot be resolved?

1. Check the service

If this problem occurs, first What we think of is checking whether there is a problem with the service OracleOraDb11g_home2TNSListener. Enter services.msc during operation, open the service window, and check whether the OracleOraDb11g_homeTNSListener service is running. If not, start it.

2. Use SQL PLUS to test the connection.

If there are still problems, we use SQL PLUS to test whether we can connect. Run cmd and enter

sqlplus sys/password@database SID as sysdba

in the command prompt window. For example:

sqlplus sys/abc123@orcl as sysdba

If you can connect , the problem is easier to solve, indicating that there is no problem with our database instance. The problem should lie in the configuration of the Oracle client and pl/sql developer.

3. Check the tnsnames.ora configuration

In the client installation path, mine is D:\oracle\instantclient_12_1\NETWORK\ADMIN, create a file, The name is: tnsnames.ora. If it has been created before, just open it and add it directly. Add the following content to tnsnames.ora:

SID名 =
  (DESCRIPTION =    (ADDRESS = (PROTOCOL = TCP)(HOST = localhost)(PORT = 1522))    (CONNECT_DATA =      (SERVER = DEDICATED)      (SERVICE_NAME = SID名)  )

Note that there cannot be any other characters in front of the SID name, especially spaces!

After saving, see if you can log in. If it still doesn't work, click the "Cancel" button in the login window of pl/sql developer. After entering pl/sql developer, execute "Tools"-> "Preferences"-> Connection, and configure as shown in the figure below ( The oracle home directory is the path of the oracle client).

What should I do if ora-12154: The specified connection identifier cannot be resolved?

The above is the detailed content of What should I do if ora-12154: The specified connection identifier cannot be resolved?. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn