create or replace trigger login_on_info -- 紀錄登入信息的觸發器
after logon on database
Begin
insert into login_log(session_id,login_on_time,login_off_time,user_in_db,machine,ip_address,run_program)
select AUDSID,sysdate,null,sys.login_user,machine,SYS_CONTEXT('USERENV','IP_ADDRESS'),program
from v$session where AUDSID = USERENV('SESSIONID'); --當前SESSION
END;