You are on page 1of 12

Unit 16:

Oracle performance monitoring


lab

© Copyright IBM Corporation 2013


Agenda
• Statspack setup
• AWR report collection

© Copyright IBM Corporation 2013


StatsPack: Setup
• Make sure TIMED_STATISTICS is true.
$ sqlplus ‘/ as sysdba’
SQL> show parameter timed_statistics;
NAME TYPE VALUE
---------------------- ------------ ----------
timed_statistics boolean TRUE
• To create the package
SQL> @?/rdbms/admin/spcreate
Enter value for perfstat_password : perfstat or (whatever password you want)
Enter value for default_tablespace: (press Return for the default TS)
Enter value for temporary_tablespace: (press Return for the default temp TS)
No errors.
SPCPKG complete. Please check spcpkg.lis for any errors.

© Copyright IBM Corporation 2013


StatsPack: Snapshot
• To gather StatsPack snapshot
$ sqlplus perfstat/perfstat
SQL> execute statspack.snap;
• After taking the first snapshot, take an other one after about a
minute later
SQL> connect perfstat/perfstat
SQL> execute statspack.snap;
• Now, there should be snapshot ID #1 and #2 in the statspack
table.

© Copyright IBM Corporation 2013


StatsPack: Report
• To run the Report
$ sqlplus perfstat/perfstat
SQL> @?/rdbms/admin/spreport
Instance DB Name Snap ID Snap Started Level Comment
------------ ------------ --------- ------------------------- --------------------
DB101 RAC1 1 08 May 2005 03:04 5
2 08 May 2005 03:04 5
Specify the Begin and End Snapshot IDs
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Enter value for begin_snap: 1
Begin Snapshot Id specified: 1
Enter value for end_snap: 2
End Snapshot Id specified: 2
Specify the Report Name
~~~~~~~~~~~~~~~~~~~~~~~
The default report file name is sp_1_2. To use this name,
press <return> to continue, otherwise enter an alternative.
Enter value for report_name: <hit return>
.
End of Report (sp_1_2.lst)
SQL>

© Copyright IBM Corporation 2013


Setting up StatsPack for automatic collection

• To set up statspack to collect data hourly:


$ sqlplus ' / as sysdba '
SQL> sho parameter job_queue_processes
If job_queue_processes=0, increase it
SQL> alter system set job_queue_processes=1
SQL> @?/rdbms/admin/spauto

© Copyright IBM Corporation 2013


Introduce a workload
• Let’s introduce some loads...
• Preparation work:

• Download setup.sql and create_work.sql from class repository


in /stage/tools
$ sqlplus ‘/ as sysdba’
SQL> @setup.sql
SQL> exit

© Copyright IBM Corporation 2013


Monitor with Statspack
• Snapshot before and after the loads.
$ sqlplus perfstat/perfstat
SQL> execute statspack.snap;
SQL> @create_work.sql
SQL> connect perfstat/perfstat
SQL> execute statspack.snap;
• Generate the snapshots report for Snap ID #3 and #4 using
spreport.sql.
• Compare your results with sp_1_2.lst....
• Compare « Top 5 Timed Events » on both reports...

© Copyright IBM Corporation 2013


Create snapshots from DBCONSOLE
• Create snapshot before the
workload starts:
Performance -> snapshots->
“create”
• From the command prompt as
oracle, rerun the workload:
$sqlpus ‘/ as sysdba’
SQL> @create_work.sql
SQL> exit
• Create snapshot after the
workload ends:
Performance -> snapshots->
“create”

© Copyright IBM Corporation 2013


DBCONSOLE: Run AWR report (1 of 2)

© Copyright IBM Corporation 2013


BCONSOLE: Run AWR report (2 of 2)

© Copyright IBM Corporation 2013


DBCONSOLE: Look at ADDM

© Copyright IBM Corporation 2013