1、错误1:Initialization error
could not initialize
电脑上原本就装有oracle 11g 64位,可是PL/SQL却怎么也连接不上,报出“ Initialization
error”的错误,搜集资料找到原因,原来PL/SQL是32位的,而oracle client是64位(当初安装服务器端自带的)的,二者不兼容,当然无法连接。
解决方法:
(1)下载32位客户端
下载免安装版的32位oracle客户端,地址:http://www.oracle.com/technetwork/topics/winsoft-085727.html(根据已安装的oracle服务器版本下载对应的客户端),我下载的是:instantclient-basic-win32-11.2.0.1.0.zip;
(2)解压
解压instantclient-basic-win32-11.2.0.1.0.zip,例如:D:\app\admin\product\11.2.0\instantclient_11_2;
(3)添加环境变量
环境变量 - 系统变量 - 新建:TNS_ADMIN = D:\app\admin\product\11.2.0\dbhome_1\NETWORK\ADMIN(用来设定到底使用哪个tns配置文件)、NLS_LANG
= AMERICAN_AMERICA.UTF8(字符编码);
(4)PL/SQL设置
工具 - 首选项:
oracle主目录名:D:\app\admin\product\11.2.0\dbhome_1
OCI库:D:\app\admin\product\11.2.0\instantclient_11_2\oci.dll
2、错误2:ORA - 12541:TNS:无监听程序
打开命令控制台,输入命令:lsnrctl status 查看监听器状态;
没有启动监听器,输入命令:lsnrctl start,如果未能成功启动,查看监听器的配置文件listener.ora是否配置正确:
# listener.ora Network Configuration File: D:\app\admin\product\11.2.0\dbhome_1\network\admin\listener.ora
# Generated by Oracle configuration tools.
DIRECT_HANDOFF_TTC_LISTENER = OFF
SID_LIST_LISTENER =
(SID_LIST =
(SID_DESC =
(SID_NAME = CLRExtProc)
(ORACLE_HOME = D:\app\admin\product\11.2.0\dbhome_1)
(PROGRAM = extproc)
)
(SID_DESC =
(SID_NAME = PLSExtProc)
(ORACLE_HOME = D:\app\admin\product\11.2.0\dbhome_1)
(PROGRAM = extproc)
)
(SID_DESC =
(GLOBAL_DBNAME = ORCL)
(ORACLE_HOME = D:\app\admin\product\11.2.0\dbhome_1)
(SID_NAME = ORCL)
)
)
LISTENER =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1522))
(ADDRESS = (PROTOCOL = TCP)(HOST = admin-PC)(PORT = 1522))
)
)
ADR_BASE_LISTENER = D:\app\admin
DEFAULT_SERVICE_LISTENER = (XE)
配置修改后,要重新启动监听器。
版权声明:本文为博主原创文章,未经博主允许不得转载。