Oracle的版本及类型:12c
Oracle本地访问host为localhost,和其他关系型数据库mysql,sql server一样,Oracle远程访问同样需要修改host等参数。
因此,在部署Oracle前,需要确认的事只有一个:确保安装Oracle的机器有静态ip(在局域网内是静态ip也行)
1.关闭windows防火墙,在linux环境下就关闭linux的防火墙
2.修改Oracle的net manager配置
打开oracle的net manager,配置如下(主要是讲连接类型修改为共享服务器):
3.配置连接数
打开Database Configuration Assistant
一直next就行了
4.修改监听ip
找到安装Oracle的ADMIN目录,笔者的目录为:
D:\app\orcl\product\12.1.0\dbhome_1\NETWORK\ADMIN
文件夹下打开下述文件:
修改如下(主要是修改HOST的值):
tnsnames.ora
<pre name="code" class="sql"># tnsnames.ora Network Configuration File:
# D:\app\orcl\product\12.1.0\dbhome_1\NETWORK\ADMIN\tnsnames.ora
# Generated by Oracle configuration tools.
ORACLR_CONNECTION_DATA =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521))
)
(CONNECT_DATA =
(SID = CLRExtProc)
(PRESENTATION = RO)
)
)
LISTENER_ORCL =
(ADDRESS = (PROTOCOL = TCP)(HOST = 10.60.38.154)(PORT = 1521))
ORCL =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = localhost)(PORT = 1521))
)
(CONNECT_DATA =
(SERVER = SHARED)
(SERVICE_NAME = orcl)
)
)
listener.ora
# listener.ora Network Configuration File:
# D:\app\orcl\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\orcl\product\12.1.0\dbhome_1)
(PROGRAM = extproc)
(ENVS = "EXTPROC_DLLS=ONLY:D:\app\orcl\product\12.1.0\dbhome_1\bin\oraclr12.dll")
)
)
LISTENER =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = 10.60.38.154)(PORT = 1521))
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521))
)
)
上面两份文件的代码加粗部分为需要修改的。可以看出,主要是把host从localhost修改为本机的静态ip。
5.修改完毕后重启所有服务(这点非常重要),之后通过sql developer测试成功