使用本地的SQLPlus连接服务器上的Oracle数据库,这是由于本地有安装了Oracle数据库服务,所以才会系统先提示:ORA-12504:
TNS: 监听程序在 CONNECT_DATA 中未获得 SERVICE_NAME
再次输入用户名密码系统又提示:
ORA-12560: TNS: 协议适配器错误。如图所示:
提示:修改三个文件,但是要看你本地数据库服务安装在哪里:
我的是
:F:\app\qq\product\11.2.0\dbhome_1\NETWORK\ADMIN
服务器上的Oracle数据库的配置文件内容如下:
#######
listener.ora 配置文件
# listener.ora Network
Configuration File:
F:\oracle\product\10.2.0\instantclient_12_1\listener.ora
# Generated by Oracle configuration
tools.
SID_LIST_LISTENER =
(SID_LIST
=
(SID_DESC =
(SID_NAME = PLSExtProc)
(ORACLE_HOME =
F:\oracle\product\10.2.0\instantclient_12_1)
(PROGRAM = extproc)
)
)
LISTENER =
(DESCRIPTION_LIST
=
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST =
Lenovo-PC)(PORT = 1521))
)
)
#### tnsnames.ora 配置文件内容:
# tnsnames.ora Network Configuration File:
F:\oracle\product\10.2.0\instantclient_12_1\tnsnames.ora
# Generated by Oracle configuration
tools.
ORCL =
(DESCRIPTION
=
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST =
Lenovo-PC)(PORT = 1521))
)
(CONNECT_DATA =
(SERVICE_NAME = orcl)
)
)
EXTPROC_CONNECTION_DATA =
(DESCRIPTION
=
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = IPC)(KEY =
EXTPROC1))
)
(CONNECT_DATA =
(SID = PLSExtProc)
(PRESENTATION = RO)
)
)
--提示这个就是你要连接到服务器上的oracle
数据库名称:gzant
,和ip:192.168.1.10
gzant
=
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL =
TCP)(HOST = 192.168.1.10)(PORT = 1521))
)
(CONNECT_DATA =
(SID =
gzant)
)
)
### sqlnet.ora 配置文件内容:
# sqlnet.ora Network Configuration File:
F:\oracle\product\10.2.0\instantclient_12_1\sqlnet.ora
# Generated by Oracle configuration tools.
SQLNET.AUTHENTICATION_SERVICES= (NTS)
NAMES.DIRECTORY_PATH= (TNSNAMES, EZCONNECT)