PLSQL链接不上oracle

 ORA-12154: TNS:could not resolve the connect identifier specified

win10上安装了一个11g的客户端,发现连接不上公司的数据库,解决的办法参考下面的方法。

 

      解决了 Initialization error Could not load  的问题,在登陆界面填写完信息进行登录时,又出现了另一个

 

问题 ORA-12154: TNS:could not resolve the connect identifier specified ,即无法解析指定的连接

标识符。这说明缺少了一个环境变量,TNS_ADMIN

     

      解决方法:

windows:

右击我的电脑 -> 属性 -> 高级 -> 环境变量 -> Administrator 的用户变量 -> 新建

                         

                          变量名为:TNS_ADMIN

                         

                          变量值为:%ORACLE_HOME%/NETWORK/ADMIN/

--解决乱码                     

 新建变量,设置变量名:NLS_LANG,变量值:SIMPLIFIED CHINESE_CHINA.ZHS16GBK,确定即可                       

                                              其中 %ORACLE_HOME% Orcale 的安装路径,

    其实,设置的该环境变量的值为 tnsnames.ora文件所在路径,特别是重装后或其它操作,忘了设置

TNS_ADMIN 变量,PL/SQL 登陆就会报无法解析指定的连接标识符的错误,而设置TNS_ADMIN

量是为了能够找到 tnsnames.ora。如果本机上安装了ORACLE,并且设置了 ORACLE_HOME 环境变

量,那么会自动在 %ORACLE_HOME%/NETWORK/ADMIN/位置查找 tnsnames.ora 文件。

 

 

PLSQL连Oracle数据库Could not load "……\bin\oci.dll"

    64win7上装PL/SQL,经常会遇见“Could not load "……\bin\oci.dll"”这个错误,我查了一下资料,原因是PL/SQL只对32OS进行支持,解决方法是额外加载一个oci.dll文件,操作如下:

      Step1:

       到如下地址下载包含oci.dll文件包“instantclient_10_2",将该文件解压到“D:\Program Files \”

       http://download.csdn.NET/detail/shenkxiao/4181424

     Step2:

      装好Oracle客户端,并配好TNS后,启动PL/SQL,点击登录中的取消按钮,不登录直接进入PL/SQL操作界面,点击工具首选项如下:

    

<!--[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]-->http://img.my.csdn.net/uploads/201203/28/1332943289_3659.jpg<!--[endif]-->

附图一PL/SQL首选项

 

     Step3:选择Step1目录下插件中的oci.dll文件,点击确认,如下图:

     

<!--[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]-->http://img.my.csdn.net/uploads/201203/28/1332943289_8573.jpg<!--[endif]-->

附图二PL/SQL加载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]-->http://img.my.csdn.net/uploads/201203/28/1332943690_2491.jpg<!--[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]-->http://img.my.csdn.net/uploads/201203/28/1332943798_9655.jpg<!--[endif]-->

 

猜你喜欢

转载自2929582988.iteye.com/blog/2348274