Home > Database > Mysql Tutorial > body text

oracle MTS模式下防火墙如何开通

WBOY
Release: 2016-06-07 16:36:48
Original
1106 people have browsed it

最近在搭建一台测试环境时,发现开通监听1521端口的防火墙后,远程 连接还是无法连接,只有允许ip不限制端口时就能正常连接到数据库。 原因如下: 首先这台数据库是MTS,也就是共享模式: SQL show parameter shared_servers;NAME TYPE VALUE----------------

最近在搭建一台测试环境时,发现开通监听1521端口的防火墙后,远程 连接还是无法连接,只有允许ip不限制端口时就能正常连接到数据库。

原因如下:

首先这台数据库是MTS,也就是共享模式:

SQL> show parameter shared_servers;
NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
max_shared_servers                   integer
shared_servers                       integer     1
Copy after login

共享模式的连接方式是客户端连接监听如1521后,会redirect到dispatcher,而dispatcher的端口是随机的。如果你只开通了1521,那是连接不了数据库的,你会发现telnet ip 1521通,但就是连接不上数据库。

在这种情况 下你可以用如下方法解决:

可以在客户端进行Dedicated模式连接,在tnsnames.ora中增加SERVER=DEDICATED配置:

test =
  (DESCRIPTION =
    (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.97.1)(PORT = 1521))
    (CONNECT_DATA =
     (SERVER = DEDICATED)
      (SERVICE_NAME = test)
    )
  )
Copy after login

然后固定dispatcher的端口

# vi initSID.ora
*.dispatchers="(address=(protocol=tcp)(port=49316))(dispatchers=3)"
Copy after login

重启实例

可以这样查看dispatcher的端口,然后再开通防火墙:

SQL> select name,network from v$dispatcher;
NAME
----
NETWORK
--------------------------------------------------------------------------------
D000
(ADDRESS=(PROTOCOL=tcp)(HOST=auto_oracle.dmc.com)(PORT=49316))
Copy after login

配置防火墙允许访问49316端口。

这个时候需要开通两个端口,一个是1521和49316。

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!