oracle 限制ip登录,Oracle限制IP登录

二、使用触发器

由于sqlnet.ora方式不支持IP段,对于某个IP段的限制,可以使用触发器实现

1、需求:限制IP段 192.168.137登录

2、实现方式:

Oracle@oracle[/oracle/app/10g/network/admin]> sqlplus / as sysdba

SQL*Plus: Release 10.2.0.1.0 - Production on Mon Jun 15 12:25:32 2009

Copyright (c) 1982, 2005, Oracle. All rights reserved.

Connected to:

Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production

With the Partitioning, OLAP and Data Mining options

sys@ORCL>

sys@ORCL> create or replace trigger chk_ip

2 after logon on scott.schema

3 declare

4 ipaddr VARCHAR2(30);

5 begin

6 select sys_context('userenv', 'ip_address') into ipaddr from dual;

7 if ipaddr like ('192.168.137.%') then

8 raise_application_error('-20001', 'you can not logon by scott');

9 end if;

10 end chk_ip;

11 /

Trigger created.

sys@ORCL>

在192.168.137.1上登录,显示:

ORA-00604: error occurred at recursive SQL level 1

ORA-20001: you can not logon by scott

ORA-06512: at line 6

显然使用触发器会带来更多便利0b1331709591d260c1c78e86d0c51c18.png

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值