• [摘]Oracle限制某个数据库帐号只能在特定机器上连入数据库


          逛论坛的时候发现一个好脚本,记录下来以备日后有用:

    CREATE OR REPLACE TRIGGER sys.trg_work_log
    AFTER LOGON ON DATABASE
    declare
    v_program_name varchar2(200);
    v_username varchar2(100);
    v_ip varchar2(18);
    v_error varchar2(1000);
    begin
    select username,program,SYS_CONTEXT('USERENV','IP_ADDRESS')   
    into v_username,v_program_name,v_ip
    from sys.v_$session where AUDSID = SYS_CONTEXT('USERENV', 'SESSIONID');
    if (upper(v_username)='TEST') then
      if (UPPER(v_program_name) = 'SQLPLUS.EXE') then
         if (v_ip = ('10.142.244.30')) then
           RAISE_APPLICATION_ERROR(-20001,'You are not allowed to connect to the database,err01');
             
        end if;
      ELSE
         RAISE_APPLICATION_ERROR(-20001,'不能使用sqlplus登陸');
            
      end if;
    else
       RAISE_APPLICATION_ERROR(-20001,'You are not allowed to connect to the database');
       
    end if;
    
    END ;
    /
  • 相关阅读:
    nginx安装:linux环境下安装包安装
    Effective C++
    Win32 Msg
    C++ 17
    Win32 Threads
    Exceptional C++
    C++11
    STL 分类
    C++类型转换
    红黑树
  • 原文地址:https://www.cnblogs.com/killkill/p/2024417.html
Copyright © 2020-2023  润新知