Oracle Landing Trigger

Source: Internet
Author: User

1. Create a table in SYS mode that records the details of the client's login to the database server

Create Tablelogon_logs (logon_time date,usernamevarchar2( -), machinevarchar2( -), Ipadrvarchar2( -), programvarchar2( -), modulevarchar2( -), terminalvarchar2( -));

2. Create a trigger in SYS mode:

Create or Replace TriggerLogusersconnectsafter Logon on Database         beginInsert  intoLogon_logsValues(Sysdate,User, Sys_context ('USERENV','HOST'), Sys_context ('USERENV','IP_Address'), Sys_context ('USERENV','ACTION'), Sys_context ('USERENV','MODULE'), Sys_context ('USERENV','TERMINAL'));Commit;End;/

--View login_history table
select * from Logon_logs;

select Count (*) from v$session;

--View all sessions of the current client computer named Rhel
select count (*) from v$session where machine = ' RHEL ';

--View the current number of connections for each client computer
select Count (*), machine from V$session Group by machine;

Oracle Landing Trigger

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.