User connection problems in Oracle

Source: Internet
Author: User

View user connections

Disconnect a connection

View connection IP

View user connections in Oracle
Select username, Sid, serial #, status from V $ session where username <> '1 ';
Select Sid, SES. Serial #, SES. username, Pro. username, Pro. spid, status
From v $ session SES, V $ process pro
Where SES. Username = 'product' and SES. paddr = pro. ADDR;
Select SES. username, Pro. * from V $ process pro, V $ session ses where SES. paddr = pro. ADDR and SES. Username <> '1 ';
From the preceding SQL statement, you can obtain the connected user, Oracle SID, and OS process number.
With the above information, you can stop the connection
Alter system kill session 'sid, serial # '; or directly kill the session according to the OS process number.
The preceding SQL statement cannot obtain the IP address of the connected client. Is there any ready-made view available?
To obtain an IP address
Method 1: $ ORACLE_HOME/Network/log/listener_orarac1.log
Method 2: Create a logon trigger
Create Table session_history...

Create or replace trigger logon_history
after logon database
begin
insert into session_history
select username, sysdate, sys_context ('userenv ', 'IP _ address') from V $ session where audsid = userenv ('sessionid');
commit;
end;

Method 3: netstat-anp | grep 1521
TCP 0 0 192.168.1.52: 1521 192.168.2.101: 45877 established 5582/oracleorcl1
TCP 0 0 192.168.1.52: 1521 192.168.2.101: 37343 established 5588/oracleorcl1
TCP 0 0 192.168.1.52: 1521 192.168.2.101: 50172 established 24184/oracleorcl1
TCP 0 0 192.168.1.52: 1521 192.168.2.101: 59023 established 5584/oracleorcl1
TCP 0 0 192.168.1.52: 1521 192.168.10.23: 1992 established 29055/oracleorcl1
TCP 0 0 192.168.1.52: 1521 192.168.2.101: 51121 established 5586/oracleorcl1
TCP 0 0 192.168.1.52: 1521 192.168.2.102: 44376 established 18104/oracleorcl1
TCP 0 0 192.168.1.52: 1521 192.168.2.102: 51209 established 27165/oracleorcl1
TCP 0 0 192.168.1.52: 1521 192.168.2.102: 59845 established 18102/oracleorcl1
TCP 0 0 192.168.1.52: 1521 192.168.2.102: 41867 established 22780/oracleorcl1
5582 in oracleorcl1 is the OS process number.

 

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.