Explain SQL statements for Oracle Performance Detection

Source: Internet
Author: User

The following articles mainly talk about Oracle Performance Check SQL statements. On a website with good reputation, I found a reference to Oracle Performance Check SQL statements and related code examples, to share with you. The following is a detailed description of the article.

Oracle Performance Check SQL statements

1. Waiting for monitoring cases

 
 
  1. select event,sum(decode(wait_Time,0,0,1)) "Prev",  
  2. sum(decode(wait_Time,0,1,0)) "Curr",count(*) "Tot"  
  3. from v$session_Wait  
  4. group by event order by 4;  

2. rollback segment contention

 
 
  1. select name, waits, gets, waits/gets "Ratio"  
  2. from v$rollstat a, v$rollname b  
  3. where a.usn = b.usn;  

3. Monitor the I/O ratio of tablespaces

 
 
  1. select df.tablespace_name name,df.file_name "file",f.phyrds pyr,  
  2. f.phyblkrd pbr,f.phywrts pyw, f.phyblkwrt pbw  
  3. from v$filestat f, dba_data_files df  
  4. where f.file# = df.file_id  
  5. order by df.tablespace_name;  

4. I/O ratio of the monitored File System

 
 
  1. select substr(a.file#,1,2) "#", substr(a.name,1,30) "Name",  
  2. a.status, a.bytes, b.phyrds, b.phywrts  
  3. from v$datafile a, v$filestat b  
  4. where a.file# = b.file#;  

5. Search for all indexes under a user in Oracle Performance Detection

 
 
  1. select user_indexes.table_name, user_indexes.index_name,
    uniqueness, column_name  
  2. from user_ind_columns, user_indexes  
  3. where user_ind_columns.index_name = user_indexes.index_name  
  4. and user_ind_columns.table_name = user_indexes.table_name  
  5. order by user_indexes.table_type, user_indexes.table_name,  
  6. user_indexes.index_name, column_position;  

6. Monitor SGA hit rate

 
 
  1. select a.value + b.value "logical_reads", c.value "phys_reads",  
  2. round(100 * ((a.value+b.value)-c.value) / (a.value+b.value))
     "BUFFER HIT RATIO"  
  3. from v$sysstat a, v$sysstat b, v$sysstat c  
  4. where a.statistic# = 38 and b.statistic# = 39  
  5. and c.statistic# = 40;  

7. Monitor the hit rate of the Dictionary Buffer in SGA

 
 
  1. select parameter, gets,Getmisses , getmisses/
    (gets+getmisses)*100 "miss ratio",  
  2. (1-(sum(getmisses)/ (sum(gets)+sum(getmisses))))*100 "Hit ratio"  
  3. from v$rowcache  
  4. where gets+getmisses <>0  
  5. group by parameter, gets, getmisses;  

The above content is an introduction to the SQL statements used for Oracle performance testing. I hope you will find some gains.

Related Article

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.