Oracle控制ip的连接


Oracle控制ip的连接(我们也可以用数据库触发器记录用户的登录情况,但是不能记录dba权限的用户),单纯的设定允许的IP 和 禁止的IP,在oracle9i以前有文档说增加或修改protocol.ora文件,在9i及以后版本中真正起作用的是sqlnet.ora文件,我们修改sqlnet.ora其实是最好最快的方法

sqlnet.ora文件的功能:
1. Specify the client domain to append to unqualified names
2. Prioritize naming methods
3. Enable logging and tracing features
4. Route connections through specific processes
5. Configure parameters for external naming
6. Configure Oracle Advanced Security
7. Use protocol-specific parameters to restrict access to the database
我在这里用的就是第7个功能

在sqlnet.ora中增加如下部分
-----------------------------

tcp.validnode_checking=yes 
 
#允许访问的IP
tcp.invited_nodes=(ip1,ip2……) 
 
#禁止访问的IP
tcp.excluded_nodes=(ip1,ip2……)
 
之后重新启动监听器即可

eg:
# sqlnet.ora Network Configuration File: E:\oracle\product\10.2.0\db_3\network\admin\sqlnet.ora
# Generated by Oracle configuration tools.
# This file is actually generated by netca. But if customers choose to
# install "Software Only", this file wont exist and without the native
# authentication, they will not be able to connect to the database on NT.
SQLNET.AUTHENTICATION_SERVICES= (NTS)
NAMES.DIRECTORY_PATH= (TNSNAMES, EZCONNECT)
#skate modify
tcp.validnode_checking=yes
tcp.invited_nodes=(192.168.0.103)
tcp.excluded_nodes=(192.168.0.10)

需要注意的问题:
1、 需要设置参数为YES,这样才能激活。
2、 建议设置允许访问的IP,因为IP地址有可能被随意修改,就不能起到自己的目的。
3、 TCP当参数TCP.INVITED_NODES和TCP.EXCLUDED_NODES设置的地址相同的时候将覆盖TCP.EXCLUDED_NODES设置。
4、 需要重启监听器才能生效。
5、 这个方式只是适合TCP协议。
6、 这个配置适用于9i以上版本。在9i之前的版本使用文件protocol.ora。
7、 在服务器上直接连接数据库不受影响。
8、 这种限制方式事通过监听器来限制的。
9、 这个限制只是针对IP检测,对于用户名检测事不支持的。

相关内容