"Oracle Series" Oracle uses client_info in v$Session to query the terminal IP address of the database.

v$sessionBy default, the client cannot be obtained directly from , and the stored procedure IPneeds to be executed to record the address of the login data terminal in the field.dbms_application_info.set_client_infoIPclient_info

You can use the following methods 创建触发器to complete the automatic IPaddress recording function:

Lite

create or replace trigger login_on_record_ip
  after logon on database
begin
  dbms_application_info.set_client_info(sys_context('userenv', 'ip_address'));
end;
/

Detailed version

create or replace trigger login_on_record_ip
  after logon on database
begin
  dbms_application_info.set_client_info(sys_context('userenv', 'ip_address'));
  dbms_session.set_identifier(sys_context('userenv', 'HOST'));
exception
  when others then
    rollback;
end;
/

Guess you like

Origin blog.csdn.net/liuhuanping/article/details/133378857