STEP 1: Create required tablespaces for statspack utility.
Statspack utility requires two tablespaces to run:
(a) PERFSTAT tablespace
(b) TEMP tablespace
Command to get list of available tablespaces:
SQL> SELECT *
2> FROM DBA_TABLESPACES;
Other "less preferred" commands to get tablespaces list:
SELECT * FROM DBA_DATA_FILES;
SELECT * FROM DBA_TEMP_FILES;
SELECT * FROM v$datafile;
SELECT * FROM v$tempfile;
Command to create PERFSTAT tablespace (login as User:SYS to execute):
SQL> CREATE TABLESPACE PERFSTAT
2 DATAFILE 'd:\oracle\oradata\oracle\perf01.dbf' SIZE 100M
3 /
or,
SQL> CREATE TABLESPACE PERFSTAT
2 DATAFILE 'd:\oracle\oradata\oracle\perfstat.dbf' SIZE 100M AUTOEXTEND OFF
3 EXTENT MANAGEMENT LOCAL AUTOALLOCATE
4 LOGGING
5 ONLINE
6 SEGMENT SPACE MANAGEMENT AUTO
7 /
STEP 2: Locate and Execute script spcreate.sql as user:SYS
Standard Location of script: $ORACLE_HOME/RDBMS/admin/spcreate.sql
Example: D:\oracle\ora92\rdbms\admin\spcreate.sql
While being executed, script will ask following questions:
a) Password for newly created user perfstat
b) Tablespace name
c) Temporary tablespace name
STEP 3: Login as user:perfstat now and generate diagnosis data by executing "statspack.snap" twice
Details:
Execute the following command twice with a few minutes of interval in between(lets say at 9 am and then at 9:10 am)
SQL> exec statspack.snap;
STEP 4: Note down SNAP_IDs of the snapshots created above
In our case, since we have just generated statspack package, IDs will be 1 and 2.
You can confirm snapshot IDs using following command:
SQL> SELECT SNAP_ID, SNAP_TIME
2> FROM STATS$SNAPSHOT;
3> /
STEP 5: Generate statspack report by executing "spreport.sql"
STANDARD location of script to run report : $ORACLE_HOME/RDBMS/admin/spreport.sql
Example: D:\oracle\ora92\rdbms\admin\spreport.sql
While executing, script will ask you to specify
a) Name of the new report being created.
b) Two snapshot IDs to compare
STEP 6:
The report thus created can be opened in any text editor and viewed (In our example, since the two SNAP_IDs were for snapshots taken at 9 am and 9 :15 am, the report will show compare performance data generated at 9 am with that generated at 9:15 am.
-Param
=====================
Want to know more? Visit:
http://www.akadia.com/services/ora_statspack_survival_guide.html
http://ist.uwaterloo.ca/~baumbach/ORACLEnotes/ST_statspack.html
http://www.troygeek.com/articles/Statspack101-Installing/
http://www.coderanch.com/t/79947/Oracle-OAS/why-datafile-TEMP-tablespace-not