通過sqlnet.ora來設定特定ip的連接

来源:互联网 发布:阿里云地域介绍 编辑:程序博客网 时间:2024/05/17 02:05

The secret lies in the SQLNET.ORA file. This file can be found in your $ORACLE_HOME/network/admin directory along with your tnsnames.ora and listener.ora. Open it up and insert the following line:

tcp.validnode_checking = yes

This turns on the hostname/IP checking for your listeners. After this, you can supply lists of nodes to enable/disable, as such:

tcp.invited_nodes = (hostname1, hostname2)
tcp.excluded_nodes = (192.168.10.3)

Note that if you only specify invited nodes, all others will be excluded, so there is really no reason to do both. The same goes for excluded nodes: exclude a list of clients, invite all others

 

1修改sqlnet.ora,实现客户端IP限制
      如果要在网络上做一些IP地址的限制,一般情况下我们首先想到的是用网络层的防火墙软件。要找网管来设置。

      但是如果网管不在,或者仅仅想在数据库层来实现IP地址的限制,DBA们只要修改Server端的一个网络配置文件
    sqlnet.ora文件就可以了。
    
      (Oracle9i以上版本,在目录$ORACLE_HOME/network/admin 或者 %ORACLE_HOME%/network/admin 下)
    
      增加如下内容:

tcp.validnode_checking=yes

#允许访问的ip
tcp.invited_nodes =(ip1,ip2,……)

#不允许访问的ip
tcp.excluded_nodes=(ip1,ip2,……) 

      在OEM的Net Manager图形界面里是这样的配置画面:    
    
    
      修改sqlnet.ora后,重新启动listener服务,改动就可以生效了。
    
      如果我们从未允许的IP客户端连接过来,会出现以下错误:
    
      ERROR: ORA-12537: TNS: 连接已关闭
      
      这种在Oracle网络层实现客户端IP访问限制的方法在防火墙后面的公司内部网或者托管机房的内部网里可以采用。
      
      不允许访问IP地址的方法我觉得没有什么用,因为IP地址是很容易修改的。