How to define a specific IP access oracle database

You can use the login trigger, cmgw or add a file protocol.ora at $ OREACLE_HOME / network / admin (. Some os may be protocol.ora), 9i can directly modify the sqlnet.ora:

  Add the following:

  tcp.validnode_checking=yes

  # Ip access is allowed

  tcp.inited_nodes=(ip1,ip2,……)

  # Ip access is not permitted

tcp.excluded_nodes=(ip1,ip2,……)

Trigger defined using IP:

create table logcontrol

(IPDET VARCHAR2(15)

)

/

create table limitip

(

 IPDET VARCHAR2(15),

 NOTE  VARCHAR2(50)

)

/

create table yclogin

(

IPDET VARCHAR2(15),

attempdate date default sysdate

)

/

insert into logcontrol values('130.76.1.135');

insert into limitip values ​​( '130.76.1.135', 'interface to the database');

/

CREATE OR REPLACE TRIGGER log_control                                            

AFTER logon ON DATABASE                                                          

declare                                                                          

  oname number(2);                                                               

  pragma autonomous_transaction;                                                 

begin                                                                            

if SYS_CONTEXT('USERENV','IP_ADDRESS') is not null                               

then                                                                              

select count(*) into oname from logcontrol                                       

where trim(IPDET)=SYS_CONTEXT('USERENV','IP_ADDRESS');                                 

  if oname<1 then                                                                 

  insert into yclogin values(SYS_CONTEXT('USERENV','IP_ADDRESS'));               

  commit;                                                                        

   Raise_application_error (-20999, 'ip access limited, there is a need please apply in writing to the system administrator!');

   EXECUTE IMMEDIATE 'DISCONNECT';                                               

  end if;                                                                        

end if;                                                                           

end;                      

Guess you like

Origin www.cnblogs.com/fanweisheng/p/11113222.html