Directly speaking of the final operation, directly use the "service naming" and "listener" of Oracle Net Manager to configure
The file corresponding to the service name is tnsnames.ora, and the file corresponding to the listener is listener.ora . After filling in the corresponding information, click File-Save in the upper left corner. The corresponding configuration tool is " oracle net configuration assistant "
After the configuration is complete, enter the corresponding user password to log in.
If you directly enter the corresponding information with datagrip , you can log in directly.
=========Dividing line=======
The following is the experience of stepping on the pit: the other party’s version is Oracle 12C. That day, I picked up my Oracle/plsql tool from 2 years ago and configured tnsnames.ora to connect. Then report an error
Search for oci.dll through everything. I found that my win7 computer has oci.dll in two paths. This error was reported when the OCI library was replaced twice. Maybe the version is too old, and you need to replace it with a higher version of 64-bit plsql.
The next day, I installed Oracle 19c on the company's win7 computer, and found that the service could not be started. Found a blog that says win7 does not support 19c
https://blog.csdn.net/JiekeXu/article/details/104644453
Then install 19c on the win10 laptop, and the OracleOraDB19Home1TNSListener service starts normally. Also install plsql 13 (64 bit)
Install 19c reference blog https://www.jianshu.com/p/a089ef9c2e77
netstat -ano | findstr "1521" also shows the corresponding process/port.
According to the experience two years ago, configure the corresponding IP, port, and name on tnsnames.ora. Then he reported errors again and again.
The Oracle service is open, and it is said that listener.ora needs to be modified online. Then manually change it, and the connection is still wrong. It turns out that there are some syntax differences between some configurations and templates given on the Internet.
Finally, it can be connected by configuring with the Oracle Net Manager mentioned at the beginning.
Generally speaking, if plsql connects to Oracle, you need to change tnsnames.ora and listener.ora.
The configuration is attached below. tnsnames.ora
Mainly look at this section of ORCLCDB
# tnsnames.ora Network Configuration File: D:\studio\oracle19c\WINDOWS.X64_193000_db_home\NETWORK\ADMIN\tnsnames.ora
# Generated by Oracle configuration tools.
ORCLCDB =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = 47.xxx.xx.xx)(PORT = 3xxx))
)
(CONNECT_DATA =
(SID = ORCLCDB)
(SERVER = DEDICATED)
)
)
DB19C =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = LYBQYFXPWIJFAWJ)(PORT = 1521))
)
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = db19c)
)
)
LISTENER_DB19C =
(ADDRESS = (PROTOCOL = TCP)(HOST = LYBQYFXPWIJFAWJ)(PORT = 1521))
listener.ora
Mainly look at the ORCLCDB section of SID_DESC and the DESCRIPTION under LISTENER
# listener.ora Network Configuration File: D:\studio\oracle19c\WINDOWS.X64_193000_db_home\NETWORK\ADMIN\listener.ora
# Generated by Oracle configuration tools.
SID_LIST_LISTENER =
(SID_LIST =
(SID_DESC =
(GLOBAL_DBNAME = db19c)
(ORACLE_HOME = D:\studio\oracle19c\WINDOWS.X64_193000_db_home\bin)
(SID_NAME = db19c)
)
(SID_DESC =
(GLOBAL_DBNAME = ORCLCDB)
(ORACLE_HOME = D:\studio\oracle19c\WINDOWS.X64_193000_db_home\bin)
(SID_NAME = ORCLCDB)
)
)
LISTENER =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = LYBQYFXPWIJFAWJ)(PORT = 1521))
)
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = 47.xxx.xx.xx)(PORT = 3xxx))
)
)
ADR_BASE_LISTENER = D:\studio\oracle19c\WINDOWS.X64_193000_db_home\log
After successfully logging in, the top display:
If you are not sure about the grammar, and there are errors after copying and pasting, use Oracle Net Manager to configure. The corresponding configuration in the generated file is correct.