日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問(wèn) 生活随笔!

生活随笔

當(dāng)前位置: 首頁(yè) > 编程资源 > 编程问答 >内容正文

编程问答

Oracle做ip连接限制

發(fā)布時(shí)間:2023/12/10 编程问答 27 豆豆
生活随笔 收集整理的這篇文章主要介紹了 Oracle做ip连接限制 小編覺(jué)得挺不錯(cuò)的,現(xiàn)在分享給大家,幫大家做個(gè)參考.

Oracle做ip連接限制


限制登錄oracle的IP地址有兩種方法

一、編輯$ORACLE_HOME/network/admin/sqlnet.ora,增加

tcp.validnode_checking = yes

#tcp.invited_nodes=() #允許訪問(wèn)的IP列表,各IP之間用逗號(hào)分隔

tcp.excluded_nodes=() #限制訪問(wèn)的IP列表,個(gè)IP之間用逗號(hào)分隔

注意:

?不能同時(shí)使用tcp.invited_nodes和tcp.excluded_nodes
?只能指定具體的IP地址,不能指定IP段
?只能限制TCP協(xié)議
?需要重啟監(jiān)聽(tīng)生效

1、需求:限制IP 192.168.137.1登錄

2、實(shí)現(xiàn)方式:

oracle@oracle[/oracle/app/10g]> cd $ORACLE_HOME/network/admin
oracle@oracle[/oracle/app/10g/network/admin]> ls -l
total 16
drwxr-x— 2 oracle oinstall 4096 Dec 30 11:37 samples
-rw-r—– 1 oracle oinstall 172 Dec 26 2003 shrept.lst
-rw-r–r– 1 oracle oinstall 236 Dec 30 13:10 sqlnet.ora
-rw-r–r– 1 oracle oinstall 347 Mar 25 21:22 tnsnames.ora
oracle@oracle[/oracle/app/10g/network/admin]> vi sqlnet.ora

# sqlnet.ora Network Configuration File: /oracle/app/10g/network/admin/sqlnet.ora
# Generated by Oracle configuration tools.

SQLNET.RECV_TIMEOUT = 0

SQLNET.EXPIRE_TIME = 0

SQLNET.SEND_TIMEOUT = 0

SQLNET.INBOUND_CONNECT_TIMEOUT = 0

tcp.validnode_checking = yes

#tcp.invited_nodes=()

tcp.excluded_nodes=(192.168.137.1)

oracle@oracle[/oracle/app/10g/network/admin]> lsnrctl stop

LSNRCTL for Linux: Version 10.2.0.1.0 – Production on 15-JUN-2009 12:10:05

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

Connecting to (ADDRESS=(PROTOCOL=tcp)(HOST=)(PORT=1521))
The command completed successfully
oracle@oracle[/oracle/app/10g/network/admin]> lsnrctl start

LSNRCTL for Linux: Version 10.2.0.1.0 – Production on 15-JUN-2009 12:10:17

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

Starting /oracle/app/10g/bin/tnslsnr: please wait…

TNSLSNR for Linux: Version 10.2.0.1.0 – Production
Log messages written to /oracle/app/10g/network/log/listener.log
Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=oracle)(PORT=1521)))

Connecting to (ADDRESS=(PROTOCOL=tcp)(HOST=)(PORT=1521))
STATUS of the LISTENER
————————
Alias LISTENER
Version TNSLSNR for Linux: Version 10.2.0.1.0 – Production
Start Date 15-JUN-2009 12:10:17
Uptime 0 days 0 hr. 0 min. 0 sec
Trace Level off
Security ON: Local OS Authentication
SNMP OFF
Listener Log File /oracle/app/10g/network/log/listener.log
Listening Endpoints Summary…
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=oracle)(PORT=1521)))
The listener supports no services
The command completed successfully

在192.168.137.1上登錄,顯示

ORA-12547:TSN:丟失連接

二、使用觸發(fā)器

由于sqlnet.ora方式不支持IP段,對(duì)于某個(gè)IP段的限制,可以使用觸發(fā)器實(shí)現(xiàn)

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

2、實(shí)現(xiàn)方式:

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


總結(jié)

以上是生活随笔為你收集整理的Oracle做ip连接限制的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問(wèn)題。

如果覺(jué)得生活随笔網(wǎng)站內(nèi)容還不錯(cuò),歡迎將生活随笔推薦給好友。