ORA-12154: TNS:could not resolve the connect identifier specified
I installed an 11g client on win10 and found that I could not connect to the company's database. For the solution, please refer to the following method.
Solved the problem of Initialization error Could not load . After filling in the information on the login interface to log in, another message appeared.
Problem ORA-12154: TNS:could not resolve the connect identifier specified , that is, the specified connection could not be resolved
identifier. This shows that an environment variable, TNS_ADMIN , is missing .
Solution:
windows:
Right-click My Computer -> Properties -> Advanced -> Environment Variables -> Administrator 's User Variables -> New ,
The variable name is: TNS_ADMIN
The variable value is: %ORACLE_HOME%/NETWORK/ADMIN/
--Resolve garbled characters
Create a new variable, set the variable name: NLS_LANG , the variable value: SIMPLIFIED CHINESE_CHINA.ZHS16GBK , OK
Where %ORACLE_HOME% is the installation path of Oracle ,
In fact, the value of the set environment variable is the path where the tnsnames.ora file is located, especially after reinstallation or other operations, I forgot to set it
TNS_ADMIN variable, PL/SQL login will report the error " Unable to parse the specified connection identifier " , and set the TNS_ADMIN variable
The amount is to be able to find tnsnames.ora . If ORACLE is installed on this machine and the ORACLE_HOME environment variable is set
amount, then it will automatically find the tnsnames.ora file in the %ORACLE_HOME%/NETWORK/ADMIN/ location .
PLSQL even Oracle database Could not load " ...\bin\oci.dll"
When PL/SQL is installed on 64 -bit win7 , the error "Could not load "...\bin\oci.dll"" is often encountered . I checked the information, and the reason is that PL/SQL only supports 32 -bit OS . The solution Is to additionally load an oci.dll file , the operation is as follows:
Step1:
Download the package "instantclient_10_2" containing oci.dll from the following address , and extract the file to "D:\Program Files\"
http://download.csdn.NET/detail/shenkxiao/4181424
Step2:
After installing the Oracle client and configuring TNS , start PL/SQL , click the " Cancel " button in the login, and directly enter the PL/SQL operation interface without logging in. Click " Preferences " under " Tools " as follows:
<!--[if gte vml 1]><v:shapetype id="_x0000_t75" coordsize="21600,21600" o:spt="75" o:preferrelative="t" path="m@4@5l@4@11@9@11@9@5xe" filled="f" stroked="f"> <v:stroke joinstyle="miter"/> <v:formulas> <v:f eqn="if lineDrawn pixelLineWidth 0"/> <v:f eqn="sum @0 1 0"/> <v:f eqn="sum 0 0 @1"/> <v:f eqn="prod @2 1 2"/> <v:f eqn="prod @3 21600 pixelWidth"/> <v:f eqn="prod @3 21600 pixelHeight"/> <v:f eqn="sum @0 0 1"/> <v:f eqn="prod @6 1 2"/> <v:f eqn="prod @7 21600 pixelWidth"/> <v:f eqn="sum @8 21600 0"/> <v:f eqn="prod @7 21600 pixelHeight"/> <v:f eqn="sum @10 21600 0"/> </v:formulas> <v:path o:extrusionok="f" gradientshapeok="t" o:connecttype="rect"/> <o:lock v:ext="edit" aspectratio="t"/> </v:shapetype><v:shape id="图片_x0020_4" o:spid="_x0000_i1028" type="#_x0000_t75" alt="http://img.my.csdn.net/uploads/201203/28/1332943289_3659.jpg" style='width:258.75pt; height:299.25pt;visibility:visible;mso-wrap-style:square'> <v:imagedata src="file:///C:\Users\ADMINI~1\AppData\Local\Temp\msohtmlclip1\01\clip_image001.jpg" o:title="1332943289_3659"/> </v:shape><![endif]--><!--[if !vml]-->lock v:ext="edit" aspectratio="t"/> </v:shapetype><v:shape id="图片_x0020_4" o:spid="_x0000_i1028" type="#_x0000_t75" alt="http://img.my.csdn.net/uploads/201203/28/1332943289_3659.jpg" style='width:258.75pt; height:299.25pt;visibility:visible;mso-wrap-style:square'> <v:imagedata src="file:///C:\Users\ADMINI~1\AppData\Local\Temp\msohtmlclip1\01\clip_image001.jpg" o:title="1332943289_3659"/> </v:shape><![endif]--><!--[if !vml]-->lock v:ext="edit" aspectratio="t"/> </v:shapetype><v:shape id="图片_x0020_4" o:spid="_x0000_i1028" type="#_x0000_t75" alt="http://img.my.csdn.net/uploads/201203/28/1332943289_3659.jpg" style='width:258.75pt; height:299.25pt;visibility:visible;mso-wrap-style:square'> <v:imagedata src="file:///C:\Users\ADMINI~1\AppData\Local\Temp\msohtmlclip1\01\clip_image001.jpg" o:title="1332943289_3659"/> </v:shape><![endif]--><!--[if !vml]-->visibility:visible;mso-wrap-style:square'> <v:imagedata src="file:///C:\Users\ADMINI~1\AppData\Local\Temp\msohtmlclip1\01\clip_image001.jpg" o:title="1332943289_3659"/> </v:shape><![endif]--><!--[if !vml]-->visibility:visible;mso-wrap-style:square'> <v:imagedata src="file:///C:\Users\ADMINI~1\AppData\Local\Temp\msohtmlclip1\01\clip_image001.jpg" o:title="1332943289_3659"/> </v:shape><![endif]--><!--[if !vml]--><!--[endif]-->
Figure 1 : PL/SQL Preferences
Step3: Select the oci.dll file in the plug-in in the Step1 directory , click " Confirm " , as shown below:
<!--[if gte vml 1]><v:shape id="图片_x0020_3" o:spid="_x0000_i1027" type="#_x0000_t75" alt="http://img.my.csdn.net/uploads/201203/28/1332943289_8573.jpg" style='width:330pt;height:352.5pt;visibility:visible;mso-wrap-style:square'> <v:imagedata src="file:///C:\Users\ADMINI~1\AppData\Local\Temp\msohtmlclip1\01\clip_image003.jpg" o:title="1332943289_8573"/> </v:shape><![endif]--><!--[if !vml]--><!--[endif]-->
Figure 2 : PL/SQL loads OCI.dll
Step4: 登录页面中在“数据库”选项中输入TNS中的IP:端口/数据库实例(经测试,此处必须这样写,否则不能正常连接)
<!--[if gte vml 1]><v:shape id="图片_x0020_2" o:spid="_x0000_i1026" type="#_x0000_t75" alt="http://img.my.csdn.net/uploads/201203/28/1332943690_2491.jpg" style='width:252.75pt;height:168pt;visibility:visible;mso-wrap-style:square'> <v:imagedata src="file:///C:\Users\ADMINI~1\AppData\Local\Temp\msohtmlclip1\01\clip_image005.jpg" o:title="1332943690_2491"/> </v:shape><![endif]--><!--[if !vml]--><!--[endif]-->
附图三:登录
<!--[if gte vml 1]><v:shape id="图片_x0020_1" o:spid="_x0000_i1025" type="#_x0000_t75" alt="http://img.my.csdn.net/uploads/201203/28/1332943798_9655.jpg" style='width:452.25pt;height:71.25pt;visibility:visible;mso-wrap-style:square'> <v:imagedata src="file:///C:\Users\ADMINI~1\AppData\Local\Temp\msohtmlclip1\01\clip_image007.jpg" o:title="1332943798_9655"/> </v:shape><![endif]--><!--[if !vml]--><!--[endif]-->