How to install and use the Oracle performance analysis tool statpack

Source: Internet
Author: User

Oracle performance analysis tool statpackThe installation and usage are what we will introduce in this article. Through Statspack, we can easily determine the bottleneck of the Oracle database and record the database performance status, remote technical support staff can also quickly learn the running status of your database. To enable automatic database collection, you need to modify two parameters:

Lab environment:

OS: redhat 5.5

DB: oracle11g

Parameter settings: job_queue_processes and timed_statistics

Query whether job_queue_processes is greater than 0: show parameter job_queue_processes;

If it is 0, we need to modify alter system set job_queue_processes = 10;

Check whether timed_statistics is true.

Modify: alter system set timed_statistics = true;

Install statpack:

User operations that require sysdba permissions, first create user tablespace, which depends on the size of the amount of information we collect to set, generally set to MB

 
 
  1. create tablespace perfstat '/home/oracle/perfstat.dbf' size 500m extent management local;  
  2. @$ORACLE_HOME/rdbms/admin/spcreate.sql 

Set a password for perfstat.

Input tablespace and temporary tablespace

SPCPKG complete. please check spcpkg. lis for any errors. the preceding statement is successful. the lis file is executed and re-built. If an error occurs during creation, we can delete and re-create the file:

@ $ ORACLE_HOME/rdbms/admin/spdrop. SQL: Click Create again.

Generate the survey report and switch to the perfstat User:

Collect System Information: execute statspack. snap;

View collected statistics:

 
 
  1. SQL> select snap_id,snap_time,startup_time from stats$snapshot;  
  2. SNAP_ID SNAP_TIME STARTUP_T  
  3. ---------- --------- ---------  
  4. 1 14-AUG-11 14-AUG-11  
  5. 2 14-AUG-11 14-AUG-11  
  6. 5 14-AUG-11 14-AUG-11  
  7. 3 14-AUG-11 14-AUG-11  
  8. 4 14-AUG-11 14-AUG-11 

We can also make him automatically count the system: @ $ ORACLE_HOME/rdbms/admin/spauto. SQL

Let's take a look at the main content of the file:

 
 
  1. variable jobno number;  
  2. variable instno number;  
  3. begin  
  4. select instance_number into :instno from v$instance;  
  5. dbms_job.submit(:jobno,'statspack.snap;',trunc(sysdate+1/24,'HH'), 'trunc(SYSDATE+1/24,''HH'')', TRUE, :instno);  
  6. commit;  
  7. end; 

You can set the collection time by modifying this value.

1/24 HH every hour

1/48 MI every 30 minutes

1/144 MI every ten minutes

1/288 MI every five minutes

Remove automatic collection:

View the job number:

 
 
  1. select job,job_user,priv_user,last_date,next_date,interval from user_jobs; 

Run:

 
 
  1. execute dbms_jobs.remove('job'); 

Clear statistics:

 
 
  1. @$ORACLE_HOME/rdbms/admin/sptrunc.sql; 

Statpack collection type:

Level: controls the type of collected data.

Threshold: Set the missing value of collected data. The default collection type is 5. We can change the collection type;

Execute statpack. snap (I _snap_level => 10, I _modify_parameter => 'true ');

Modify the collection method only: execute statpack. snap (I _snap_level => 10 );

Threshold: the snapshot threshold applies only to SQL statements obtained from the stat $ SQL _summary table.

Generate System Report: @ $ ORACLE_HOME/rdbms/admin/spreport. SQL

Enter the snap value we are querying and the path I am storing.

This article describes how to install and use the Oracle performance analysis tool statpack!

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.