虚拟机里的Linux安装了Oracle,由于在Windows物理机要用到PL/SQL Developer连接到虚拟机里的Oracle,
但是不想在物理机里在重新安装一下Oracle了(太大了,没地了=。=)。于是用到了Oracle Instant Client。
好了废话不多说了。步骤如下:
1、先在Linux里配置好监听。listener.ora 文件内容如下
# listener.ora Network Configuration File: /u01/app/oracle/product/10.2.0/db_1/network/admin/listener.ora
# Generated by Oracle configuration tools.
SID_LIST_LISTENER =
(SID_LIST =
(SID_DESC =
(SID_NAME = PLSExtProc)
(ORACLE_HOME = /u01/app/oracle/product/10.2.0/db_1)
(PROGRAM = extproc)
)
(SID_DESC =
(GLOBAL_DBNAME = wiseman)
(ORACLE_HOME = /u01/app/oracle/product/10.2.0/db_1)
(SID_NAME = wiseman)
)
)
LISTENER =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.0.99)(PORT = 1521))
)
(DESCRIPTION =
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC0))
)
)
注:SID_name的大小写必须和Linux里的SID一样。我的是小写
2、然后是Windows端的配置了,先把http://www.oracle.com/technetwork/topics/winsoft-085727.html下的
instantclient-basic-nt-11.2.0.3.0.zip下载下来(我的是32位系统),然后解压到C:\Oracle\instantclient_11_2下,然后把tnsnames.ora复制到C:\Oracle\instantclient_11_2\network\admin下。内容如下:
GGDB =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST =192.168.0.99)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = WISEMAN)
)
)
3、最后设置PL/SQL Developer,工具-->首选项下改成如下图内容即可
现在重启一下PL/SQL Developer,再次登陆就行了。
补充:
Instant Client 不自带SQL*Plus所以可以在刚才的页面下载它,instantclient-sqlplus-nt-11.2.0.3.0.zip。下载完后,
在配置一下windows端的系统变量。
NLS_lANG=SIMPLIFIED CHINESE_CHINA.ZHS16GBK
TNS_ADMIN=C:\Oracle\instantclient_11_2
Path=C:\Oracle\instantclient_11_2
现在就可以用 sqlplus [email protected] 进行连接了。