oracle 登陸限制ip
生產庫中常用的就2種 一個是sqlnet.ora,一個是用trigger,由於最近用到過特此記錄(實際使用中常用就是server端sqlnet.ora直接限制).
#10g client connet 11g database
[oracle@ora10g admin]$ sqlplus system/a123@test
SQL*Plus: Release 10.2.0.4.0 - Production on Fri Apr 23 21:10:22 2010
Copyright (c) 1982, 2007, Oracle. All Rights Reserved.
Connected to:
Oracle Database 11g Enterprise Edition Release 11.1.0.6.0 - Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
SQL>
1.sqlnet.ora方式
[oracle@vm11g admin]$ vi sqlnet.ora
tcp.validnode_checking=yes
tcp.invited_nodes =(192.168.1.99)
tcp.excluded_nodes=(192.168.1.66)
~
~
TCP.EXCLUDED_NODES
設定禁止訪問資料庫的IP地址列表。
TCP.INVITED_NODES
設定允許訪問資料庫的IP地址列表,當這個引數和TCP.EXCLUDED_NODES設定的地址相同的時候將覆蓋TCP.EXCLUDED_NODES設定。
TCP.VALIDNODE_CHECKING
檢測上述引數的設定。
~[oracle@vm11g admin]$ lsnrctl start 重起lsnr
LSNRCTL for Linux: Version 11.1.0.6.0 - Production on 12-APR-2010 09:19:45
Copyright (c) 1991, 2007, Oracle. All rights reserved.
Starting /home/oracle/product/11g/database/bin/tnslsnr: please wait...
TNSLSNR for Linux: Version 11.1.0.6.0 - Production
System parameter file is /home/oracle/product/11g/database/network/admin/listener.ora
Log messages written to /home/oracle/diag/tnslsnr/vm11g/listener/alert/log.xml
Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=vm11g)(PORT=1521)))
Connecting to (ADDRESS=(PROTOCOL=tcp)(HOST=)(PORT=1521))
STATUS of the LISTENER
------------------------
Alias LISTENER
Version TNSLSNR for Linux: Version 11.1.0.6.0 - Production
Start Date 12-APR-2010 09:19:45
Uptime 0 days 0 hr. 0 min. 0 sec
Trace Level off
Security ON: Local OS Authentication
SNMP OFF
Listener Parameter File /home/oracle/product/11g/database/network/admin/listener.ora
Listener Log File /home/oracle/diag/tnslsnr/vm11g/listener/alert/log.xml
Listening Endpoints Summary...
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=vm11g)(PORT=1521)))
The listener supports no services
The command completed successfully
SQL> alter system register;
System altered.
SQL> exit
Disconnected from Oracle Database 11g Enterprise Edition Release 11.1.0.6.0 - Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
[oracle@vm11g admin]$ lsnrctl status
LSNRCTL for Linux: Version 11.1.0.6.0 - Production on 12-APR-2010 09:35:53
Copyright (c) 1991, 2007, Oracle. All rights reserved.
Connecting to (ADDRESS=(PROTOCOL=tcp)(HOST=)(PORT=1521))
STATUS of the LISTENER
------------------------
Alias LISTENER
Version TNSLSNR for Linux: Version 11.1.0.6.0 - Production
Start Date 12-APR-2010 09:35:44
Uptime 0 days 0 hr. 0 min. 15 sec
Trace Level off
Security ON: Local OS Authentication
SNMP OFF
Listener Parameter File /home/oracle/product/11g/database/network/admin/listener.ora
Listener Log File /home/oracle/diag/tnslsnr/vm11g/listener/alert/log.xml
Listening Endpoints Summary...
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=vm11g)(PORT=1521)))
Services Summary...
Service "xh" has 1 instance(s).
Instance "xh", status READY, has 1 handler(s) for this service...
Service "xhXDB" has 1 instance(s).
Instance "xh", status READY, has 1 handler(s) for this service...
Service "xh_XPT" has 1 instance(s).
Instance "xh", status READY, has 1 handler(s) for this service...
The command completed successfully
#已經連線不上了
[oracle@ora10g admin]$ sqlplus system/a123@test
SQL*Plus: Release 10.2.0.4.0 - Production on Fri Apr 23 21:23:14 2010
Copyright (c) 1982, 2007, Oracle. All Rights Reserved.
ERROR:
ORA-12537: TNS:connection closed
[oracle@vm11g admin]$ rm -rf sqlnet.ora
2.trigger方式 思路很簡單 就是登陸時候 sys_context獲取下使用者資訊中的ip_address(還可以獲取很多比如sessionid之類),然後丟擲一個異常
create or replace trigger test_ip
after logon on xh.schema
declare
ip VARCHAR2(50);
begin
select sys_context('userenv', 'ip_address') into ip from dual;
if ip='192.168.1.66' then
raise_application_error('-20002', 'this is test you can not loggon');
end if;
end test_ip;
SQL> set linesize 1000
SQL> select owner,status,trigger_type,triggering_event from dba_triggers where trigger_name='TEST_IP';
OWNER STATUS TRIGGER_TYPE TRIGGERING_EVENT
------------------------------ -------- ---------------- -----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
SYS ENABLED AFTER EVENT LOGON
SQL>
[oracle@ora10g admin]$
[oracle@ora10g admin]$ sqlplus xh/a123@test
SQL*Plus: Release 10.2.0.4.0 - Production on Fri Apr 23 21:44:04 2010
Copyright (c) 1982, 2007, Oracle. All Rights Reserved.
ERROR:
ORA-00604: error occurred at recursive SQL level 1
ORA-20002: this is test you can not loggon
ORA-06512: at line 6
Enter user-name:
SYS_CONTEXT('USERENV','TERMINAL') terminal,
SYS_CONTEXT('USERENV','LANGUAGE') language,
SYS_CONTEXT('USERENV','SESSIONID') sessionid,
SYS_CONTEXT('USERENV','INSTANCE') instance,
SYS_CONTEXT('USERENV','ENTRYID') entryid,
SYS_CONTEXT('USERENV','ISDBA') isdba,
SYS_CONTEXT('USERENV','NLS_TERRITORY') nls_territory,
SYS_CONTEXT('USERENV','NLS_CURRENCY') nls_currency,
SYS_CONTEXT('USERENV','NLS_CALENDAR') nls_calendar,
SYS_CONTEXT('USERENV','NLS_DATE_FORMAT') nls_date_format,
SYS_CONTEXT('USERENV','NLS_DATE_LANGUAGE') nls_date_language,
SYS_CONTEXT('USERENV','NLS_SORT') nls_sort,
SYS_CONTEXT('USERENV','CURRENT_USER') current_user,
SYS_CONTEXT('USERENV','CURRENT_USERID') current_userid,
SYS_CONTEXT('USERENV','SESSION_USER') session_user,
SYS_CONTEXT('USERENV','SESSION_USERID') session_userid,
SYS_CONTEXT('USERENV','PROXY_USER') proxy_user,
SYS_CONTEXT('USERENV','PROXY_USERID') proxy_userid,
SYS_CONTEXT('USERENV','DB_DOMAIN') db_domain,
SYS_CONTEXT('USERENV','DB_NAME') db_name,
SYS_CONTEXT('USERENV','HOST') host,
SYS_CONTEXT('USERENV','OS_USER') os_user,
SYS_CONTEXT('USERENV','EXTERNAL_NAME') external_name,
SYS_CONTEXT('USERENV','IP_ADDRESS') ip_address,
SYS_CONTEXT('USERENV','NETWORK_PROTOCOL') network_protocol,
SYS_CONTEXT('USERENV','BG_JOB_ID') bg_job_id,
SYS_CONTEXT('USERENV','FG_JOB_ID') fg_job_id,
SYS_CONTEXT('USERENV','AUTHENTICATION_TYPE') authentication_type,
SYS_CONTEXT('USERENV','AUTHENTICATION_DATA') authentication_data
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/12020513/viewspace-660840/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- Oracle資料庫限制訪問IPOracle資料庫
- 如何限制ip訪問Oracle資料庫Oracle資料庫
- ssh設定使用者從指定的IP登陸
- SSH安全登陸原理:密碼登陸與公鑰登陸密碼
- se://error/ Oracle 19c EM Exporess無法登陸ErrorOracle
- tp登陸
- 共享登陸
- .htaccess IP訪問限制
- Linux配置SSH免密登陸(公私鑰登陸)Linux
- 登陸驗證
- postgresql如何登陸SQL
- 單點登陸
- iis使用動態 IP 限制
- Windows限制訪問指定IPWindows
- koa2+vue實現登陸以及是否登陸控制Vue
- 小技巧:如何突破某些網站只能登陸後才能進行文字拷貝的限制網站
- oracle 程式滿了,登陸不上資料庫的解決方法Oracle資料庫
- vnc登陸,7個步驟在CentOS 7下vnc登陸VNCCentOS
- Linux伺服器---ftp限制ipLinux伺服器FTP
- python ftp登陸(匿名)PythonFTP
- git 登陸時注意Git
- linux ssh免登陸Linux
- SSH免密登陸
- 如何處理帝國cms後臺設定IP限制後,將自己的IP都限制了
- 帝國CMS後臺設定IP限制後,將自己的IP都限制了,如何處理?
- 教程:已在其地方登陸或會話已過期,請重新登陸會話
- iis 配置中,IP地址和域限制
- 如何使用iPhone限制IP地址跟蹤iPhone
- 登陸頁面測試
- vue-element-admin 登陸Vue
- JS實現登陸介面JS
- 如何快速接入 GitHub 登陸Github
- shiro 登陸的問題。
- 14、sso單點登陸
- 登陸認證框架:SpringSecurity框架SpringGse
- 登陸框select繞過
- 愷英網路登陸2024 CCG EXPO,人氣IP與VR新遊集體亮相VR
- sqlmap+tor解決ip黑名單限制SQL
- python爬蟲如何減少ip的限制Python爬蟲