Oracle Database view, that is, how the process executes SQL statements.

Source: Internet
Author: User

Today we will mainly introduce the Oracle database Viewing Article, which describes the statements being executed by the Session and how to execute the actual SQL statement. SQL for the Oracle database. . The following is an introduction to the text.

 
 
  1. SELECT b.sql_text, sid, serial#, osuser, machine  
  2. FROM v$session a, v$sqlarea b  
  3. WHERE a.sql_address = b.address;  

Query the SQL statements issued by the front-end. SQL

 
 
  1. select user_name,sql_text  
  2. from v$open_cursor  
  3. where sid in 
    (select sid from (select sid,serial#,username,program from v$session where status='ACTIVE'));  

Query sessions by SPID

 
 
  1. SELECT * FROM v$session WHERE paddr IN 
    (SELECT addr FROM v$process WHERE spid=&spid); 

Query process by SID

 
 
  1. SELECT * FROM v$process WHERE addr IN 
    (SELECT paddr FROM v$session WHERE sid=&sid); 

How does DBA query operations performed by other users? SQL

 
 
  1. SELECT sql_text  
  2. FROM v$sql t1, v$session t2  
  3. WHERE t1.address = t2.sql_address  
  4. AND t2.sid = &sid;  

The above content is an introduction to the Oracle database to view what SQL statements are being executed by a process. I hope you will get some benefits.

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.