Oracle 配置客户端
1. 已安装Oracle情况下
找到tnsnames.ora文件(D:\oracle\product\10.2.0\db_1\network\ADMIN)添加红色部分内容
# tnsnames.ora Network Configuration File: D:\oracle\product\10.2.0\db_1\network\admin\tnsnames.ora
# Generated by Oracle configuration tools.
# 本地
ORCL = # orcl明用于连接时数据库名称
(DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = zhanggaosong-PC)(PORT = 1521)) (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = orcl) )
# 远程 (192.168.1.125)
orcl125= # orcl明用于连接时数据库名称
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.1.125)(PORT = 1521)) // 192.168.1.125服务器Ip
)
(CONNECT_DATA =
(SERVICE_NAME = orcl)
)
)
)EXTPROC_CONNECTION_DATA =
(DESCRIPTION = (ADDRESS_LIST = (ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1)) ) (CONNECT_DATA = (SID = PLSExtProc) (PRESENTATION = RO) ))2 . 未安装Oracle 情况下
解压下载的 instantclient-basic-win32-11.1.0.6.0.zip 到指定路径(如D:\oracle_client),在instantclient_11_1文件夹下新建network/admin.新建tnsnames.ora
orcl=
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.1.125)(PORT = 1521))
)
(CONNECT_DATA =
(SERVICE_NAME = orcl)
)
)
在PL/SQL 中选择首选项如图
设置环境变量 解决乱码问题
新建变量,设置变量名:NLS_LANG,变量值:SIMPLIFIED CHINESE_CHINA.ZHS16GBK,确定即可