1. 安装oracle client:
注意oracle 的安装目录中不能包含空格
https://download.oracle.com/otn_software/nt/instantclient/19600/instantclient-basic-windows.x64-19.6.0.0.0dbru.zip
2.在Oracle client 安装目录 建立networkadmin,并将ORACLE服务器上tnsnames.ora 和sqlnet.ora 的文件放入此文件夹
tnsnames.ora 内容如下所示:
D4CDB = (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = d4cdb.doufupi.com)(PORT = 1521)) (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = D4CDB.doufupi.com) ) )
sqlnet.ora内容如下所示:
SQLNET.AUTHENTICATION_SERVICES= (NTS)#注意:如果Oracle安装在linux 系统上,此参数不要在linux系统上设置.否则无法连接 NAMES.DIRECTORY_PATH= (TNSNAMES, EZCONNECT)
oracle client 语言设定
SQL> select userenv('language') nls_lang from dual; NLS_LANG ---------------------------------------------------- AMERICAN_AMERICA.AL32UTF8
设定plsqldev OCI 环境变量
将以下内建立为plsqldev.bat 文件后,直接运行,plsqldev11.
@echo on set path=D:oracleinstantclient_19_6 set ORACLE_HOME=D:oracleinstantclient_19_6 set TNS_ADMIN=D:oracleinstantclient_19_6 etworkadmin set NLS_LANG=AMERICAN_AMERICA.AL32UTF8 start D:oracleinstantclient_19_6plsqldev11_64.exe set @pause @echo off
设定win10 系统环境变量如下
ORACLE_HOME:D:oracleinstantclient_19_6
NLS_LANG: AMERICAN_AMERICA.AL32UTF8
TNS_ADMIN: D:oracleinstantclient_19_6
etworkadmin
(增加)path: D:oracleinstantclient_19_6
问题:
ORA-12504: TNS:listener was not given the SERVICE_NAME in CONNECT_DATA