IT貓撲網(wǎng):您身邊最放心的安全下載站! 最新更新|軟件分類|軟件專題|手機(jī)版|論壇轉(zhuǎn)貼|軟件發(fā)布

您當(dāng)前所在位置: 首頁數(shù)據(jù)庫Oracle → 禁止特定IP訪問Oracle數(shù)據(jù)庫

禁止特定IP訪問Oracle數(shù)據(jù)庫

時(shí)間:2015-06-28 00:00:00 來源:IT貓撲網(wǎng) 作者:網(wǎng)管聯(lián)盟 我要評論(0)

  通過使用數(shù)據(jù)庫服務(wù)器端的sqlnet.ora文件可以實(shí)現(xiàn)禁止指定IP主機(jī)訪問數(shù)據(jù)庫的功能,這對于提升數(shù)據(jù)庫的安全性有很大的幫助,與此同時(shí),這個(gè)技術(shù)為我們管理和約束數(shù)據(jù)庫訪問控制提供了有效的手段。下面是實(shí)現(xiàn)這個(gè)目的的具體步驟僅供參考:

  1.默認(rèn)的服務(wù)器端sqlnet.ora文件的內(nèi)容:

  這里我們以Oracle 10.2.0.3版本為例進(jìn)行簡述,先來看一下當(dāng)前sqlnet.ora文件內(nèi)容:

  # 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)

  2.確認(rèn)客戶端的IP地址:

  C:\Documents and Settings\Administrator>ipconfig

  Windows IP Configuration

  Ethernet adapter Local Area Connection 2:

  Media State . . . . . . . . . . . : Media disconnected

  Ethernet adapter Local Area Connection:

  Connection-specific DNS Suffix? . :

  IP Address. . . . . . . . . . . . : 9.123.112.16

  Subnet Mask . . . . . . . . . . . : 255.255.255.0

  Default Gateway . . . . . . . . . : 9.123.112.1

  3.在客戶端分別使用tnsping命令和sqlplus命令來驗(yàn)證數(shù)據(jù)庫的連通性:

  C:\Documents and Settings\Administrator>tnsping irmdb

  TNS Ping Utility for 32-bit Windows: Version 10.2.0.3.0 - Production on 06-APR-2010 11:05:09

  Copyright (c) 1997, 2006, Oracle.? All rights reserved.

  Used parameter files:

  C:\oracle\product\10.2.0\db_1\network\admin\sqlnet.ora

  Used TNSNAMES adapter to resolve the alias

  Attempting to contact (DESCRIPTION = (ADDRESS_LIST = (ADDRESS = (PROTOCOL = TCP)

  (HOST = 9.123.112.34)(PORT = 1521))) (CONNECT_DATA = (SERVICE_NAME = irmdb)))

  OK (20 msec)

  C:\Documents and Settings\Administrator>sqlplus /nolog

  SQL*Plus: Release 10.2.0.3.0 - Production on Tue Apr 6 11:05:12 2010

  Copyright (c) 1982, 2006, Oracle.? All Rights Reserved.

  SQL> conn irmadmin/passw0rd@irmdb

  Connected.

  到這里說明在客戶端兩種方式都證明的數(shù)據(jù)庫的可連通性。

  4.限制客戶端IP地址9.123.112.16對當(dāng)前irmdb數(shù)據(jù)庫的訪問:

  我們只需要在服務(wù)器端的sqlnet.ora文件中添加下面的內(nèi)容即可。

  # 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)

  tcp.validnode_checking=yes

  tcp.invited_nodes=(9.123.112.34)

  tcp.excluded_nodes=(9.123.112.16)

  第一行的含義:開啟IP限制功能;

  第二行的含義:允許訪問數(shù)據(jù)庫的IP地址列表,多個(gè)IP地址使用逗號分開,此例中我們寫入數(shù)據(jù)庫服務(wù)器的IP地址;

  第三行的含義:禁止訪問數(shù)據(jù)庫的IP地址列表,多個(gè)IP地址使用逗號分開,此處我們寫入欲限制的IP地址9.123.112.16。

  5.重新啟服務(wù)器端listener后生效(這里也可以通過lsnrctl reload方式實(shí)現(xiàn)):

  C:\Documents and Settings\Administrator>lsnrctl stop

  LSNRCTL for 32-bit Windows: Version 10.2.0.3.0 - Production on 06-APR-2010 11:07:48

  Copyright (c) 1991, 2006, Oracle.? All rights reserved.

  Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=rmesvr34.cn.ibm.com)(POR

  T=1521)))

  The command completed successfully

  C:\Documents and Settings\Administrator>lsnrctl start

  LSNRCTL for 32-bit Windows: Version 10.2.0.3.0 - Production on 06-APR-2010 11:07:52

  Copyright (c) 1991, 2006, Oracle.? All rights reserved.

  Starting tnslsnr: please wait...

  TNSLSNR for 32-bit Windows: Version 10.2.0.3.0 - Production

  System parameter file is C:\oracle\product\10.2.0\db_1\network\admin\listener.ora

  Log messages written to C:\oracle\product\10.2.0\db_1\network\log\listener.log

  Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=rmesvr34.cn.ibm.com)(POR

  T=1521)))

  Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=rmesvr34.cn.ibm.com)(POR

  T=1521)))

  STATUS of the LISTENER

  ------------------------

  Alias?? LISTENER

  Version TNSLSNR for 32-bit Windows: Version 10.2.0.3.0 - Produ

  ction

  Start Date??? 06-APR-2010 11:07:53

  Uptime? 0 days 0 hr. 0 min. 2 sec

  Trace Level?? off

  Security????? ON: Local OS Authentication

  SNMP??? OFF

  Listener Parameter File?? C:\oracle\product\10.2.0\db_1\network\admin\listener.o

  ra

  Listener Log File?? C:\oracle\product\10.2.0\db_1\network\log\listener.log

  Listening Endpoints Summary...

  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=rmesvr34.cn.ibm.com)(PORT=1521)))

  Services Summary...

  Service "PLSExtProc" has 1 instance(s).

  Instance "PLSExtProc", status UNKNOWN, has 1 handler(s) for this service...

  The command completed successfully

  C:\Documents and Settings\Administrator>sqlplus /nolog

  SQL*Plus: Release 10.2.0.3.0 - Production on Tue Apr 6 11:07:57 2010

  Copyright (c) 1982, 2006, Oracle.? All Rights Reserved.

  SQL> conn / as sysdba;

  Connected.

  SQL> alter system register;

  System altered.

  SQL> quit

  Disconnected from Oracle Database 10g Enterprise Edition Release 10.2.0.3.0 - Pr

  oduction

  With the Partitioning, OLAP and Data Mining options

  C:\Documents and Settings\Administrator>lsnrctl status

  LSNRCTL for 32-bit Windows: Version 10.2.0.3.0 - Production on 06-APR-2010 11:08:05

  Copyright (c) 1991, 2006, Oracle.? All rights reserved.

  Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=rmesvr34.cn.ibm.com)(PORT=1521)))

  STATUS of the LISTENER

  ------------------------

  Alias?? LISTENER

  Version TNSLSNR for 32-bit Windows: Version 10.2.0.3.0 - Produ

  ction

  Start Date??? 06-APR-2010 11:07:53

  Uptime? 0 days 0 hr. 0 min. 12 sec

  Trace Level?? off

  Security????

關(guān)鍵詞標(biāo)簽:Oracle,數(shù)據(jù)庫

相關(guān)閱讀

文章評論
發(fā)表評論

熱門文章 Oracle中使用alter table來增加,刪除,修改列的語法 Oracle中使用alter table來增加,刪除,修改列的語法 oracle中使用SQL語句修改字段類型-oracle修改SQL語句案例 oracle中使用SQL語句修改字段類型-oracle修改SQL語句案例 誤刪Oracle數(shù)據(jù)庫實(shí)例的控制文件 誤刪Oracle數(shù)據(jù)庫實(shí)例的控制文件 為UNIX服務(wù)器設(shè)置Oracle全文檢索 為UNIX服務(wù)器設(shè)置Oracle全文檢索

相關(guān)下載

    人氣排行 oracle中使用SQL語句修改字段類型-oracle修改SQL語句案例 Oracle中使用alter table來增加,刪除,修改列的語法 ORACLE SQL 判斷字符串是否為數(shù)字的語句 ORACLE和SQL語法區(qū)別歸納(1) oracle grant 授權(quán)語句 ORACLE修改IP地址后如何能夠使用 如何加速Oracle大批量數(shù)據(jù)處理 Oracle刪除表的幾種方法