Two problems with plsql connecting to the database

Question 1: The database drop-down box on the plsql login page is blank 

Solution: Set the system environment variable TNS_ADMIN, because I installed the client and set the value to E:\app\chan\product\instantclient_11_2\network\adminThe problem is solved

Issue 2: ORA-12154: TNS: The specified connect identifier could not be resolved, as follows:

1. Configuring the orcle client to configure new network services cannot be added, but it does not affect the configuration data added in tnsnames.ora

2. The server that the oracle client is installed first and then installed

3. The result of the tnsping command shows that the sqlnet file of the server is read

4. The connect node of plsql has been allocated to the client directory and file

5. sqlplus can read the connector of the server tnsnames.ora file

6. plsql can only read one connector before installing the server, any other connectors are invalid

 

According to the solution in the following article, I didn't solve it. Forget it, write the address port service name directly in the database. It's just a little troublesome.

 

Reprinted from: https://www.cnblogs.com/psforever/p/3929064.html

 I believe that people who have used Oracle database must have encountered the "ORA-12154: TNS: The specified connection identifier cannot be resolved" error, I will make a small summary here.

      The way to connect to the Oracle database in the program is different from other commonly used databases, such as MySql and Sql Server. These databases can be connected by directly specifying the IP, but Oracle needs to be connected by configuring the network service name through the Oracle client. Otherwise, "ORA-12154: TNS: cannot resolve the specified connect identifier". The detailed steps for configuring the Oracle client are as follows:
      After installing the Oracle client, find "Oracle - OraClient10g_home1—>Configuration and Migration Tools—>Net Manager" in the start menu and open it (Win7, Win8 users need to log in if they do not have an Administrator account) Run as administrator), expand "Oracle Net Configuration -> Local -> Service Naming" and click the "plus sign" on the left to configure a new network service

 

      Finally, click "Next" to complete. If you don't know or forget the Oracle service name, you can get it by viewing the service. For example, the host name I configured here is my local machine. Find the oracle-related service in my computer service.

From the above service name, it can be seen that the service name I installed is "ORCL", or log in with the sys account through SQL Plus on the server side, and enter the command
show parameter service_name to view.
OracleDBConsoleORCL is the service of the Oracle web management tool. The access address is generally "http://127.0.0.1:1158/em/console/logon/logon". If you are not used to using this to manage the database, you don't need to start it.
OracleJobSchedulerORCL manages scheduled tasks in Oracle and generally does not need to be started.
OracleOraDb10g_home1iSQL*Plus is a service of SQL Plus. If you are not used to operating the database under the command line, you can not start it.
Both OracleServiceORCL and OracleOraDb10g_home1TNSListener need to be enabled. The former is the main service and the latter is the listening service.

     When the service is configured in the Net Manager in the Oracle client, the Oracle database can be accessed through the network service name we configured. This configuration is essentially like D:\Oracle\product\10.2.0\client_1\NETWORK\ADMIN\ A line of configuration is added to tnsnames.ora (since my Oracle is installed in the Oracle directory of disk D, the specific path depends on the path selected during installation).

copy code
# 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)
    )
  )
copy code

    If both the Oracle client and the server are installed on the same computer, the same configuration file D:\Oracle\product\10.2.0\db_1\NETWORK\ADMIN\tnsnames.ora will also exist in the installation directory of the server , in this case, if we configure the client Net Manager and then connect to the Oracle database, "ORA-12154: TNS: Unable to resolve the specified connection identifier" may appear. At this time, you should doubt, what exactly am I accessing Which path is the configuration file in? At this point you can use the tnsping command

 

      If you configure the network service in the client Net Manager, but the use parameter file parsed at this time is D:\Oracle\product\10.2.0\db_1\NETWORK\ADMIN\sqlnet.ora, then I miss you should understand. There are two solutions for this situation:
      First: configure the same network service on the Net Manager on the server side, or directly copy the configuration in D:\Oracle\product\10.2.0\client_1\NETWORK\ADMIN\tnsnames.ora Go 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. If you don't want to be so troublesome, use the second solution.     
      Second: Modify the Path value of the system environment variable, and move the D:\Oracle\product\10.2.0\client_1\bin; path to D:\Oracle\product\10.2.0\db_1\bin; the front can be done once and for all.
      Note: The reason for the above situation is that the oracle client and database service are installed on one computer at the same time, and the client is installed first, and then the database service is installed. If the database service is installed first, then the client is installed. This will not happen on the end.
      After configuring oracle according to the above method, it is believed that the oracle database can be connected normally in the program.

      When I log in after installing the PLSQL Developer software, "ORA-12154: TNS: The specified connection identifier cannot be resolved" still appears. If it is Win7 or Win8 users, a white box may even pop up. At this time, you need to Run PLSQL Developer as an administrator, and make sure that your PLSQL Developer is the oracle client configuration read, cancel the login directly, find "Tools->Preferences" in the PLSQL Developer toolbar, and find Oracle Home in the Oracle Connection node Select OraClient10g_home1, save and close PLSQL Developer to log in normally.

 

     It should be noted that when installing PLSQL Developer, it cannot be installed in a directory with parentheses, such as the Program Files (x86) directory of a 64bit system, no matter how you set it, it will still pop up "ORA-12154: TNS: The specified connect identifier could not be resolved". The same problem occurs in other Oracle database management software, such as Toad for Oracle

     "ORA-12154: TNS: The specified connection identifier could not be resolved" is one of the more common problems encountered by newbies using Oracle database. As long as we understand how it works and investigate calmly, I believe it is easy to find the problem solution.

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=326070264&siteId=291194637