如何连接另一台电脑的oracle数据库?

A电脑为oracle服务端,B电脑为oracle客户端。

配置步骤:

首先AB在同一局域网;

服务端:

①修改ORACLE_HOME\NETWORK\ADMIN\listener.ora,把HOST改为本机IP(HOST = 172.20.10.3):

# listener.ora Network Configuration File: D:\app\ty\product\12.1.0\dbhome_1\NETWORK\ADMIN\listener.ora
# Generated by Oracle configuration tools.

SID_LIST_LISTENER =
(SID_LIST =
(SID_DESC =
(SID_NAME = CLRExtProc)
(ORACLE_HOME = D:\app\ty\product\12.1.0\dbhome_1)
(PROGRAM = extproc)
(ENVS = "EXTPROC_DLLS=ONLY:D:\app\ty\product\12.1.0\dbhome_1\bin\oraclr12.dll")
)
)

LISTENER =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521))
)
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = 172.20.10.3)(PORT = 1521))
)
)

ADR_BASE_LISTENER = D:\app\ty\product\12.1.0\dbhome_1\log

 

②修改ORACLE_HOME\NETWORK\ADMIN\tnsnames.ora,把HOST改为本机IP(HOST = 172.20.10.3):

# tnsnames.ora Network Configuration File: D:\app\ty\product\12.1.0\dbhome_1\network\admin\tnsnames.ora
# Generated by Oracle configuration tools.

LISTENER_ORCL =
(ADDRESS = (PROTOCOL = TCP)(HOST = 172.20.10.3)(PORT = 1521))


ORACLR_CONNECTION_DATA =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521))
)
(CONNECT_DATA =
(SID = CLRExtProc)
(PRESENTATION = RO)
)
)

ORCL =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = 172.20.10.3)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = orcl)
)
)

客户端:

上面2个文件的HOST和服务端一致(有时候也不用配);

连接:服务端IP:1521/实例名。

 

如何连接另一台电脑的oracle数据库?

上一篇:linux 之 非root用户安装mysql5.7.27


下一篇:关于Linux终端下 gdb 调试程序断点的设置详解 和 core 文件查看