A few common SQL about sessions, processes, and requests

Source: Internet
Author: User

1. Check your SID

Select Sid from V$session where sid = (SELECT sid from V$mystat where rownum = 1);



2. Relationships between several IDs

SELECT s.sid session_id, P.spid os_process_id, P.pid oracle_process_id from  v$process p, v$session s WHERE p.addr = S. PADDR;



3. Kill session and Process

SELECT s.sid session_id,       p.spid os_process_id,       p.pid oracle_process_id,       ' alter system kill session ' | | To_char (S.SID) | | ',' || To_char (s.serial#) | |  "' immediate; ' Kill_db_session,       ' kill-9 ' | | p.spid kill_os_session from  v$process p, v$session s WHERE p.addr = S.paddr and   s.sid = &sid;   


4. the SQL being executed

   SELECT Sql_text from  v$sqltext_with_newlines sqlt, v$session s WHERE sqlt.address = s.sql_address and   sqlt.hash_ Value = S.sql_hash_value and   s.sid = &session_id ORDER by piece



5. Session of the Reference object , lock table session

SELECT acc.*,       ' alter system kill session ' | | to_char (SES.SID) | | ',' || To_char (ses.serial#) | | "       Immediate ' from  v$access acc, v$session ses WHERE acc. OBJECT like Upper (' table_name% ') and   acc.sid = Ses.sid;

6.of the requestSession andSql

<span style= "FONT-SIZE:18PX;" >select to_char (s.sid) | | ',' || To_char (s.serial#), sql_text from  applsys.fnd_concurrent_requests R,       v$process                       p,       v$session                       s ,       v$sqltext_with_newlines         sqlt WHERE r.oracle_process_id = p.spid and   p.addr = s.paddr (+) and   S.sql_ Address = sqlt.address (+) and   S.sql_hash_value = Sqlt.hash_value (+) and   r.request_id = &request_id ORDER by Piece;</span>



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.