1. 下载
http://www.oracle.com/technetwork/database/features/instant-client/index-097480.html
2. 三个包
instantclient-basic-windows.x64-12.1.0.2.0.zip
instantclient-jdbc-windows.x64-12.1.0.2.0.zip
instantclient-sqlplus-windows.x64-12.1.0.2.0.zip
3. 解压
全部解压到同一个目录下,比如d:sqlplus
4. 修改环境变量
NLS_LANG = SIMPLIFIED CHINESE_CHINA.ZHS16GBK(或AMERICAN_AMERICA.ZHS16GBK)
TNS_ADMIN = d:sqlplus
LD_LIBRARY_PATH = d:sqlplus
SQLPATH = d:sqlplus
5. TNSNAME.ORA文件
在d:sqlplus目录下创建TNSNAME.ORA文件,自己敲容易出问题,建议直接到安装oracle数据库的机器上拷贝过来用,内容如下:
# tnsnames.ora Network Configuration File: D:oracleproduct10.1.0db_2
etworkadmin nsnames.ora
# Generated by Oracle configuration tools.
ORCL =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.208.120)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = orcl)
)
)
EXTPROC_CONNECTION_DATA =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC))
)
(CONNECT_DATA =
(SID = PLSExtProc)
(PRESENTATION = RO)
)
)
6. 安装ODBC驱动
命令行下,切换到d:sqlplus,运行odbc_install.exe
7. sqlplus连接
sqlplus 用户名/密码@192.168.208.120:1521/orcl
这样tnsnames.ora文件也用不到
注:
需要配置Oracle允许远程连接
否则会报错:ORA-12541: TNS: 无监听程序