v$session
By default, the client cannot be obtained directly from , and the stored procedure IP
needs to be executed to record the address of the login data terminal in the field.dbms_application_info.set_client_info
IP
client_info
You can use the following methods 创建触发器
to complete the automatic IP
address 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;
/