Question 1. What Is A Statspack?
Statspack is the abbreviation for statistics package. The statspack consists of a collection of SQL, PL/SQL and SQL*Plus scripts. The statspack helps you to collect, store, compare, format and analyze performance data for an Oracle instance.
With the statspack, you can, for example, determine the cause of performance problems or determine and quantify the effects of profile parameter changes. Refer to the section about typical usage scenarios for more information.
Question 2. Where Are The Statspack Scripts Located?
The statspack scripts are installed automatically in the $ORACLE_HOME/rdbms/admin directory (Unix) or the %ORACLE_HOME%rdbms admin directory (Windows) when you install the Oracle9i database software.
The most important scripts are:
- spcreate.sql: Installs the statspack;
- spdrop.sql : Uninstalls the statspack;
- spauto.sql : Automates the collection of statistics;
- spreport.sql: Creates a performance report;
- spdoc.txt : Provides documentation for the statspack;
spcreate.sql and spdrop.sql must be executed with the SYSDBA privilege.
spauto.sql and spreport.sql should be executed under the PERFSTAT user.
Question 3. Where Can I Find More Information About The Statspack?
– Oracle9i Database Performance Tuning Guide and Reference
Chapter 21: Using Statspack
– Statistics Package (Statspack) README: spdoc.txt
This readme is located under:
$ORACLE_HOME/rdbms/admin spdoc.txt (UNIX) or
%ORACLe_HOME%rdbms admin spdoc.txt (Windows)
Question 4. For Which Oracle Releases Is The Statspack Available?
The statspack is available as of Oracle 8i (8.1.6) and was enhanced with Oracle9i. This note only refers to Oracle9i Release 2 (9.2.0).
Question 5. What Are The Advantages Of The Statspack Compared With Utlbstat/utlestat?
The data collected by the statspack is more extensive and is saved in tables in the Oracle database so that you can use it later to diagnose performance problems or to create trend analyses. The overall diagnosis generated by the statspack includes an overview over the instance status (instance health), a load profile, the main SQL statements with the highest resource consumption and information about queues, events and profile parameters.
Question 6. Should I Install The Statspack In Its Own Tablespace?
Yes, we recommend that you install the statspack in a separate tablespace called PERFSTAT. You should create the tablespace as follows:
SQL>CREATE TABLESPACE “PERFSTAT”
SIZE 100M AUTOEXTEND ON NEXT 20M MAXSIZE 2000M
EXTENT MANAGEMENT LOCAL
SEGMENT SPACE MANAGEMENT AUTO;
brspace only supports the creation of data tablespaces for SAP data, but not for non-SAP data. Therefore, you should use sqlplus, not brspace, to create the PERFSTAT tablespace.
Question 7. What User Do I Use To Execute The Statspack?
When you install the statspack, the PERFSTAT statspack database user is created automatically with the minimum access authorizations for the Oracle dictionary (V$-Views). The statspack and all required tables, indexes, and so on belong to the PERFSTAT user. You collect the statistics, write the collected data to the database and evaluate the data during the creation of performance reports under this user.
Question 8. How Much Memory Is Required For The Statspack?
At the beginning, approximately 100 MB are required for the installation.
The future space requirements of the statspack depend on how often you are generating snapshots, the size of the database and the size of the instance. In addition, they are also influenced by the snapshot level which determines the amount of data that is collected in a snapshot. Therefore, we cannot give you any general recommendations about the size of the statspack. We only recommend that you observe the expansion of the statspack, especially if you are generating snapshots automatically, so that you can make an estimate about future space requirements.
Question 9. How Do I Install The Statspack?
The background installation proceeds as follows:
SQL>connect / as sysdba
SQL>define default tablespace=’PERFSTAT’
SQL>define temporary tablespace=’PSAPTEMP’
SQL>define perfstat password=perfstat
The PERFSTAT tablespace must already have been created.
SYSTEM is not allowed as a default tablespace.
SQL>connect / as sysdba
The interactive installation requires that you enter the password, the default tablespace as well as the temporary tablespace of the PERFSTAT database user.
The execution of the spcreate.sql script executes three scripts one after the other (spcusr.sql, spctab.sql, spcpkg.sql). The system creates three log files (spcusr.lis, spctab.lis, spcpkg.lis) in the current directory. You should check these for the occurrence of errors during the installation. After that, you can delete them.
After you install the statspack, we recommend that you change the password for the PERFSTAT user.
SQL>alter user perfstat identified by
Question 10. How Do I Uninstall The Statspack?
Step 1: Delete the entered statspack jobs –
Log on as the user under which the statspack jobs run (usually PERFSTAT):
SQL>select job, what from user_jobs;
This displays a list of the jobs that are currently entered under the user PERFSTAT.
You can delete these jobs using DBMS_JOB.REMOVE
Execute the following SQL statement for all jobs you want to delete that have the print job number :
Step 2: Delete the PERFSTAT objects and the PERFSTAT schema –
SQL>connect / as sysdba
As a result, the tables of the PERFSTAT user and, after that, the user PERFSTAT are deleted.
Step 3: Delete the PERFSTAT tablespace –
Since the PERFSTAT tablespace was created specifically for the PERFSTAT user and the statspack data, it should be empty once you have deleted the PERFSTAT user. You can check this using
SQL>select * from dba_segments where tablespace_name = ‘PERFSTAT’;
If the tablespace is empty, you can delete it.
Question 11. Will The Performance Of The Sap System Be Impeded If I Install The Statspack Or Generate Snapshots?
Installing the statspack in a separate tablespace using a dedicated database user means that the statspack is kept completely separate from the SAP schema. You can install, configure or uninstall the statspack during SAP operation without affecting the SAP system. The amount of statspack data should generally by small in relation to the overall size of the database. The collection and analysis of statistical data has only a minimal effect on system performance, since only those statistics that are contained in the memory (SGA) are being accessed.
The installation and use of the statspack is therefore largely independent of and transparent for the SAP System.
Question 12. Are There Any Special Issues That I Need To Be Aware Of When I Install The Statspack In The Sap Environment?
Apart from the tablespace naming convention during creation with brspace, there are no SAP specifications.
Question 13. Is The Statspack Integrated In Any Form In Sap Tools?
No, not up to now.
Question 14. Do I Have To Set Any Oracle Profile Parameters?
Yes, you must set the following parameters to the values specified to ensure that you receive useful statistics:
SQL>show parameter statistics
To automate the generation of statspack snapshots, you must set the parameter job_queue_processes > 0.
Question 15. What Is A Snapshot?
The use of the statspack to perform a once-off collection of performance data is called a snapshot, that is, a snapshot of the current system status. You can use two snapshots to create a performance report.
Question 16. How Do I Generate A Snapshot?
Question 17. Can I Generate Snapshots Automatically?
Check the files for errors during the installation.
Prerequisite: job_queue_processes > 0
This sets up an automatic job in the database that generates a snapshot every hour.
Question 18. What Are Snapshot Levels?
There are different types of snapshot levels. A snapshot level determines which performance data is collected. The higher the level, the more data is collected. The default value of 5 is generally sufficient. For RAC, you should generate snapshots with at least level 7.
Temporarily changing the snapshot level (for one snapshot only):
Changing the snapshot level and saving it as a new default:
For simultaneous generation of a snapshot:
For details regarding the individual snapshot levels, see spdoc.txt.
Question 19. How Do I Create A Performance Report?
The performance report calculates differences in the statistical numbers of two snapshots (final snapshot minus the start snapshot). To ensure that these calculated values can be usefully interpreted, the instance between the two snapshots must not have been stopped. The reason for this is that a snapshot determines its figures from the V$ tables, which are reset to 0 each time an instance starts.
Question 20. Are There Any Special Features In Oracle Real Application Clusters (rac)?
In general, we recommend that you set the snapshot level to the value 7 in the case of RAC. This means that the most heavily loaded segments are recognized at segment level. These statistics help you to localize hot spots.
To generate a snapshot in an RAC environment, you must log on to the RAC instance for which you want to generate statistics.
To set up automatic generation of snapshots in an RAC environment with the spauto.sql script for each RAC instance, you must run this script once on each instance.
To create an performance report in an RAC environment, you must log on to the RAC instance for which you want to generate a performance report.
Question 21. What Are The Typical Scenarios For Using The Statspack?
- To check whether tuning measures have the expected effect.
- To check the effects of changes in the configuration ( profile parameters, tablespace layout).
- To check whether a higher workload requires an adjustment of profile parameters.
- To obtain comparison metrics for the performance behavior before a scheduled change in the system (new platform, new storage, software upgrade, new Oracle release).
- To check system user complaints about poor response times and to determine the causes for the poor performance.
- To recognize trends, that is, slow changes over a longer period, for example, an increasing workload, an increasing I/O load or an increasing CPU workload
- To determine load peaks, bottlenecks and their causes.
- To determine the SQL statements with the highest resource consumption (top SQL).
Oracle DBA Interview Questions
Oracle DBA Tutorial
Linux Interview Questions
Windows Administration Interview Questions
SQL Interview Questions
Solaris Interview Questions
Oracle DBA Interview Questions
IBM AIX 7 Administration Interview Questions
Data modeling Interview Questions
Linux Interview Questions
Oracle Performance Tuning Interview Questions