1、错误1:Initialization error could not initialize
电脑上原本就装有oracle 11g 64位,但是PL/SQL却怎么也连接不上,报出“ Initialization error”的错误,搜集资料找到原因,原来PL/SQL是32位的,而oracle client是64位(当初安装server端自带的)的,二者不兼容,当然无法连接。
解决方法:
(1)下载32位client
下载免安装版的32位oracleclient,地址:http://www.oracle.com/technetwork/topics/winsoft-085727.html(依据已安装的oracleserver版本号下载相应的client)。我下载的是:instantclient-basic-win32-11.2.0.1.0.zip;
(2)解压
解压instantclient-basic-win32-11.2.0.1.0.zip,比如:D:appadminproduct11.2.0instantclient_11_2;
(3)加入环境变量
环境变量 - 系统变量 - 新建:TNS_ADMIN = D:appadminproduct11.2.0dbhome_1NETWORKADMIN(用来设定究竟使用哪个tns配置文件)、NLS_LANG = AMERICAN_AMERICA.UTF8(字符编码);
(4)PL/SQL设置
工具 - 首选项:
oracle主文件夹名:D:appadminproduct11.2.0dbhome_1
OCI库:D:appadminproduct11.2.0instantclient_11_2oci.dll
2、错误2:ORA - 12541:TNS:无监听程序
打开命令控制台,输入命令:lsnrctl status 查看监听器状态;
没有启动监听器,输入命令:lsnrctl start,假设未能成功启动,查看监听器的配置文件listener.ora是否配置正确:
# listener.ora Network Configuration File: D:appadminproduct11.2.0dbhome_1
etworkadminlistener.ora
# Generated by Oracle configuration tools.
DIRECT_HANDOFF_TTC_LISTENER = OFF
SID_LIST_LISTENER =
(SID_LIST =
(SID_DESC =
(SID_NAME = CLRExtProc)
(ORACLE_HOME = D:appadminproduct11.2.0dbhome_1)
(PROGRAM = extproc)
)
(SID_DESC =
(SID_NAME = PLSExtProc)
(ORACLE_HOME = D:appadminproduct11.2.0dbhome_1)
(PROGRAM = extproc)
)
(SID_DESC =
(GLOBAL_DBNAME = ORCL)
(ORACLE_HOME = D:appadminproduct11.2.0dbhome_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:appadmin
DEFAULT_SERVICE_LISTENER = (XE)
配置改动后,要又一次启动监听器。