ORA-12154: TNS:could not resolve the connect identifier specified. Solved.
进入系统属性页面
rundll32.exe shell32.dll,Control_RunDLL sysdm.cpl,,3
并添加系统环境变量
ORACLE_HOME = ${path} TNS_ADMIND = ${path}\network\admin NLS_LANG = AMERICAN_AMERICA.ZHS16GBK
其中${path} = 从http://www.oracle.com/technetwork/topics/winx64soft-089540.html 下载的 instantclient-basic-windows.x64-12.2.0.1.0.zip 解压目录.
将${path}值追加进系统环境变量Path值,并在${path}下创建子目录\network\admin 并创建 tnsnames.ora 文件
注意:目标数据库需要创建监听并开启服务. 状态查询 参考命令 lsnrctl status
ora文件参考
![](https://images.cnblogs.com/OutliningIndicators/ContractedBlock.gif)
# tnsnames.ora Network Configuration File: ${path}\network\admin\tnsnames.ora # Generated by Oracle configuration tools. #LISTENER_ORCL = # (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.18.148)(PORT = 1521)) # #ORACLR_CONNECTION_DATA = # (DESCRIPTION = # (ADDRESS_LIST = # (ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521)) # ) # (CONNECT_DATA = # (SID = CLRExtProc) # (PRESENTATION = RO) # ) # ) ORCL = (DESCRIPTION = (ADDRESS_LIST = (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.18.148)(PORT = 1521)) ) (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = orcl) ) )
![](https://files.cnblogs.com/files/wjshan0808/0.bmp)