Вы находитесь на странице: 1из 14

AWR, Adviser Tunning for DBAs

Tunning AWR, Adviser


[root@dserver1 ~]# su - oracle
[oracle@dserver1 ~]$ export ORACLE_SID=mdev
[oracle@dserver1 ~]$ s
SQL*Plus: Release 10.2.0.1.0 - Production on Sat Apr 9 23:20:51 2011
Copyright (c) 1982, 2005, Oracle. All rights reserved.
Connected to an idle instance.
SQL> startup
ORACLE instance started.
Total System Global Area
Fixed Size
Variable Size
Database Buffers
Redo Buffers
Database mounted.
Database opened.

272629760
1218892
163579572
100663296
7168000

bytes
bytes
bytes
bytes
bytes

SQL> grant advisor to scott;


Grant succeeded.
SQL>
grant select_catalog_role to scott;
Grant succeeded.
SQL> grant execute on dbms_sqltune to scott;
Grant succeeded.
SQL> conn scott/tiger
Connected.
SQL> declare
2 task_name_var varchar2(30);
3 sql_text_var clob;
4 begin
5 sql_text_var :='SELECT * FROM emp where deptno!=10';
6 task_name_var := execute dbms_sqltune.create_tuning_task(
7 sql_text=>sql_text_var,
8 user_name=>'SCOTT',
9 scope=>'COMPREHENSIVE',
10 time_limit=>70,
11 task_name=>'sql_tuning_task_test1'
12 ,
13 description=>'tuning test for emp table');
14 end;
15 .
SQL> define_editor=vi
SQL> ed
Wrote file afiedt.buf
1
2
3
4
5
6
7
8
9

declare
task_name_var varchar2(30);
sql_text_var clob;
begin
sql_text_var :='SELECT * FROM emp where deptno!=10';
task_name_var :=dbms_sqltune.create_tuning_task(
sql_text=>sql_text_var,
user_name=>'SCOTT',
scope=>'COMPREHENSIVE',

AWR, Adviser Tunning for DBAs


10
11
12
13
14*
SQL>

time_limit=>70,
task_name=>'sql_tuning_task_test1'
,
description=>'tuning test for emp table');
end;
/

PL/SQL procedure successfully completed.


SQL> select task_name from dba_advisor_log where owner='SCOTT';
TASK_NAME
-----------------------------sql_tuning_task_test1
SQL> select status from

dba_advisor_log where task_name='sql_tuning_task_test1' ;

STATUS
----------INITIAL
SQL> execute dbms_sqltune.execute_tuning_task(task_name => 'sql_tuning_task_test
1');
PL/SQL procedure successfully completed.
SQL> select status from

dba_advisor_log where task_name='sql_tuning_task_test1' ;

STATUS
----------COMPLETED
SQL>
SQL>
SQL>
SQL>

set linesize 100


set long 1000
set longchunksize 1000
select dbms_sqltune.report_tuning_task('sql_tuning_task_test1') from dual;

DBMS_SQLTUNE.REPORT_TUNING_TASK('SQL_TUNING_TASK_TEST1')
-------------------------------------------------------------------------------- -GENERAL INFORMATION SECTION
------------------------------------------------------------------------------Tuning Task Name
: sql_tuning_task_test1
Tuning Task Owner : SCOTT
Scope
: COMPREHENSIVE
Time Limit(seconds): 70
Completion Status : COMPLETED
Started at
: 04/09/2011 23:48:44
Completed at
: 04/09/2011 23:48:44
------------------------------------------------------------------------------DBMS_SQLTUNE.REPORT_TUNING_TASK('SQL_TUNING_TASK_TEST1')
-------------------------------------------------------------------------------- -Schema Name: SCOTT
SQL ID
: dqbbkbhkc2942
SQL Text
: SELECT * FROM emp where deptno!=10
------------------------------------------------------------------------------There are no recommendations to improve the statement.
------------------------------------------------------------------------------SQL> @?/rdbms/admin/sqltrpt.sql
15 Most expensive SQL in the cursor cache

AWR, Adviser Tunning for DBAs


~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
SQL_ID
ELAPSED SQL_TEXT_FRAGMENT
------------- ---------- ------------------------------------------------------92b382ka0qgdt
6.28 ALTER DATABASE
MOUNT
1h50ks4ncswfn
5.26 ALTER DATABASE OPEN
b7jn4mf49n569
1.09 select o.name, u.name from obj$ o, type$ t, user$ u wh
cfz686a6qp0kg
0.91 select o.obj#, u.name, o.name, t.spare1,
DECODE
8z5h7ks4vc4c2
0.78 select table_objno, primary_instance, secondary_instanc
02577v815yp77
0.72 BEGIN :success := dbms_ha_alerts_prvt.post_instance_up;
cqgv56fmuj63x
2.26 select owner#,name,namespace,remoteowner,linkname,p_tim
fyrbzparfb4gb
2.01 SELECT OWNER, SEGMENT_NAME, PARTITION_NAME, SEGMENT_TYP
db78fxqxwxt7r
2.00 select /*+ rule */ bucket, endpoint, col#, epvalue from
04xtrk7uyhknh
1.70 select obj#,type#,ctime,mtime,stime,status,dataobj#,fla
Specify the Sql id
~~~~~~~~~~~~~~~~~~
Enter value for sqlid: 5ps3p5ma94bkh
Sql Id specified: 5ps3p5ma94bkh
Tune the sql
~~~~~~~~~~~~
GENERAL INFORMATION SECTION
------------------------------------------------------------------------------Tuning Task Name
: TASK_160
Tuning Task Owner
: SCOTT
Scope
: COMPREHENSIVE
Time Limit(seconds)
: 1800
Completion Status
: COMPLETED
Started at
: 04/09/2011 23:51:43
Completed at
: 04/09/2011 23:51:54
Number of Statistic Findings
: 1
Number of SQL Profile Findings
: 1
------------------------------------------------------------------------------Schema Name: SYS
SQL ID
: 5ps3p5ma94bkh
SQL Text
: MERGE /*+ dynamic_sampling(ST 4) dynamic_sampling_est_cdn(ST) */
INTO STATS_TARGET$ ST USING (SELECT STALENESS, OSIZE, OBJ#,
TYPE#, CASE WHEN STALENESS > .5 THEN 128 ELSE 0 END + AFLAGS
AFLAGS, STATUS, SID, SERIAL#, PART#, BO# FROM ( SELECT /*+
no_expand dynamic_sampling(4) dynamic_sampling_est_cdn */
DECODE(BITAND(T.FLAGS,16), 16, ROUND( LOG(0.01, NVL( LEAST( 100,
GREATEST( 0.01, (DECODE(BITAND(M.FLAGS, 1), 1,
GREATEST(T.ROWCNT, M.INSERTS), LEAST((M.INSERTS + M.DELETES +
ST.BO# = NEW.BO#, ST.SID = NEW.SID, ST.SERIAL# = NEW.SERIAL#
WHEN NOT MATCHED THEN INSERT (ST.STALENESS, ST.OSIZE, ST.OBJ#,
ST.TYPE#, ST.FLAGS, ST.STATUS, ST.SID, ST.SERIAL#, ST.PART#,
ST.BO#) VALUES (NEW.STALENESS, NEW.OSIZE, NEW.OBJ#, NEW.TYPE#,
NEW.AFLAGS, NEW.STATUS, :B3 , :B2 , NEW.PART#, NEW.BO#)
------------------------------------------------------------------------------FINDINGS SECTION (2 findings)
------------------------------------------------------------------------------1- Statistics Finding
--------------------Optimizer statistics for table "SYS"."MON_MODS_ALL$" and its indices are
stale.
Recommendation
-------------- Consider collecting optimizer statistics for this table.

AWR, Adviser Tunning for DBAs

execute dbms_stats.gather_table_stats(ownname => 'SYS', tabname =>


'MON_MODS_ALL$', estimate_percent => DBMS_STATS.AUTO_SAMPLE_SIZE,
method_opt => 'FOR ALL COLUMNS SIZE AUTO');
Rationale
--------The optimizer requires up-to-date statistics for the table in order to
select a good execution plan.
2- SQL Profile Finding (see explain plans section below)
-------------------------------------------------------A potentially better execution plan was found for this statement.
Recommendation (estimated benefit: 31.79%)
------------------------------------------ Consider accepting the recommended SQL profile.
execute dbms_sqltune.accept_sql_profile(task_name => 'TASK_160', replace
=> TRUE);
------------------------------------------------------------------------------ADDITIONAL INFORMATION SECTION
------------------------------------------------------------------------------- The optimizer could not merge the view at line ID 5 of the execution plan.
The optimizer cannot merge a view that contains a set operator.
- The optimizer could not merge the view at line ID 2 of the execution plan.
The optimizer cannot merge a view that contains a NO_MERGE hint.
------------------------------------------------------------------------------EXPLAIN PLANS SECTION
------------------------------------------------------------------------------1- Original With Adjusted Cost
-----------------------------Plan hash value: 3205152281
| Id | Operation
st (%CPU)| Time
|
|
0 | MERGE STATEMENT
135
(1)| 00:00:24 |
|
1 | MERGE
|
2 |
VIEW

| Name | Rows
| |

1032 |

| Bytes | Co
300K|

| STATS_TARGET$ |
| |
|
|

2
|

|*200 |
INDEX UNIQUE SCAN
| I_OBJ1 |
1 |
|
0
(0)| 00:00:01 |
-------------------------------------------------------------------------------- -Predicate Information (identified by operation id):
3 - access("ST"."OBJ#"(+)="OBJ#")
5 - filter("OSIZE" IS NOT NULL)
7 - filter(:B1 IS NOT NULL)
200 - access("IND"."OBJ#"="OI"."OBJ#")
2- Original With Adjusted Cost
-----------------------------Plan hash value: 3734626149
-------------------------------------------------------------------------------- -| Id | Operation
| Name | Rows | Bytes | Co
st (%CPU)| Time
|
-------------------------------------------------------------------------------- -|
0 | MERGE STATEMENT
| | 1032 |
300K| 2
135
(1)| 00:00:24 |

AWR, Adviser Tunning for DBAs

|
1 | MERGE
| STATS_TARGET$ |
|
|
2 |
VIEW
| |
|
|
|* 3 |
HASH JOIN RIGHT OUTER
| | 1032 |
143K| 2
|*200 |
INDEX UNIQUE SCAN
| I_OBJ1 |
1 |
|
0
(0)| 00:00:01 |
-------------------------------------------------------------------------------- -Predicate Information (identified by operation id):
--------------------------------------------------3 - access("ST"."OBJ#"(+)="OBJ#")
5 - filter("OSIZE" IS NOT NULL)
7 - filter(:B1 IS NOT NULL)
198 - access("IND"."OBJ#"="PO"."OBJ#")
199 - filter(BITAND("OI"."FLAGS",128)<>128)
200 - access("IND"."OBJ#"="OI"."OBJ#")
3- Using SQL Profile
-------------------Plan hash value: 2710015133
-------------------------------------------------------------------------------- -| Id | Operation
| Name | Rows | Bytes | Co
st (%CPU)| Time
|
-------------------------------------------------------------------------------- -|
0 | MERGE STATEMENT
| |
216 | 64368 | 1
456
(1)| 00:00:17 |
|

1 |

MERGE

| STATS_TARGET$ |

|*199 |
TABLE ACCESS CLUSTER
| TAB$ |
1 |
7 |
1
(0)| 00:00:01 |
-------------------------------------------------------------------------------- -Predicate Information (identified by operation id):
--------------------------------------------------3 - access("ST"."OBJ#"(+)="OBJ#")
5 - filter("OSIZE" IS NOT NULL)
7 - filter(:B1 IS NOT NULL)
199 - filter(BITAND("T"."TRIGFLAG",67108864)<>67108864 AND "IND"."BO#"="T"."OBJ #")
------------------------------------------------------------------------------SQL> select task_name from dba_advisor_log;
TASK_NAME
-----------------------------SYS_AUTO_SPCADV_430161132011
TASK_107
ADDM:1566786210_1_54
ADDM:1566786210_1_13
ADDM:1566786210_1_26
ADDM:1566786210_1_41
ADDM:1566786210_1_43
SYS_AUTO_SPCADV_430163032011
ADDM:1566786210_1_52
ADDM:1566786210_1_56
ADDM:1566786210_1_18
ADDM:1566786210_1_21
SYS_AUTO_SPCADV_430162232011
ADDM:1566786210_1_34
ADDM:1566786210_1_35

AWR, Adviser Tunning for DBAs


sql_tuning_task_test1
TASK_160
ADDM:1566786210_1_45
SYS_AUTO_SPCADV_4043131932011
SYS_AUTO_SPCADV_3742151232011
ADDM:1566786210_1_16
ADDM:1566786210_1_30
SYS_AUTO_SPCADV_595316842011
ADDM:1566786210_1_49
ADDM:1566786210_1_50
ADDM:1566786210_1_57
ADDM:1566786210_1_37
SYS_AUTO_SPCADV_10523942011
28 rows selected.
SQL> select status from dba_advisor_log where task_name='TASK_160';
STATUS
----------COMPLETED
1 row selected.
SQL> select dbms_sqltune.report_tuning_task('TASK_160') from dual;
DBMS_SQLTUNE.REPORT_TUNING_TASK('TASK_160')
-------------------------------------------------------------------------------- -GENERAL INFORMATION SECTION
------------------------------------------------------------------------------Tuning Task Name
: TASK_160
Tuning Task Owner
: SCOTT
Scope
: COMPREHENSIVE
Time Limit(seconds)
: 1800
Completion Status
: COMPLETED
Started at
: 04/09/2011 23:51:43
Completed at
: 04/09/2011 23:51:54
Number of Statistic Findings
: 1
Number of SQL Profile Findings
: 1
Schema Name: SYS
SQL ID
: 5ps3p5ma94bkh
SQL Text
: MERGE /*+ dynamic_sampling(ST 4) dynamic_sampling_est_cdn(ST) */
INTO STATS_TARGET$ ST USING (SELECT STALENESS, OSIZE, OBJ#,
TYPE#, CASE WHEN STALENESS > .5 THEN 128 ELSE 0 END + AFLAGS
AFLAGS, STATUS, SID, SERIAL#, PART#, BO# FROM ( SELECT /*+
ST.OSIZE = NEW.OSIZE * DECODE(BITAND(ST.FLAGS,7), 0, 1, 2),
ST.FLAGS = ST.FLAGS - BITAND(ST.FLAGS, 32+64+128) + NEW.AFLAGS,
ST.STATUS = 0, ST.TYPE# = NEW.TYPE#, ST.PART# = NEW.PART#,
ST.BO# = NEW.BO#, ST.SID = NEW.SID, ST.SERIAL# = NEW.SERIAL#
WHEN NOT MATCHED THEN INSERT (ST.STALENESS, ST.OSIZE, ST.OBJ#,
ST.TYPE#, ST.FLAGS, ST.STATUS, ST.SID, ST.SERIAL#, ST.PART#,
ST.BO#) VALUES (NEW.STALENESS, NEW.OSIZE, NEW.OBJ#, NEW.TYPE#,
NEW.AFLAGS, NEW.STATUS, :B3 , :B2 , NEW.PART#, NEW.BO#)
------------------------------------------------------------------------------FINDINGS SECTION (2 findings)
$%' AND "O"
."NAME" NOT
LIKE 'DR#%' OR BITAND("O"."FLAGS",16)<>16))

AWR, Adviser Tunning for DBAs


DBMS_SQLTUNE.REPORT_TUNING_TASK('TASK_160')
1 row selected.
SQL> conn /
Connected.

as sysdba

SQL> execute dbms_stats.gather_table_stats(ownname => 'SYS', tabname =>'MON_MODS


_ALL$', estimate_percent => DBMS_STATS.AUTO_SAMPLE_SIZE,method_opt => 'FOR ALL C
OLUMNS SIZE AUTO');
PL/SQL procedure successfully completed.
SQL> conn scott/tiger
Connected.
SQL> conn / as sysdba
Connected.
SQL> select * from v$tablespace;
TS#
---------0
1
2
3
4
5
6
7
8

NAME
-----------------------------SYSTEM
UNDOTBS
SYSAUX
TEMP
USERS
TOOLS
APPL_DATA
TESTDATA1
NEWDATA

INC
--YES
YES
YES
NO
YES
YES
YES
YES
YES

BIG
--NO
NO
NO
NO
NO
NO
NO
NO
NO

FLA ENC
--- --YES
YES
YES
YES
YES
YES
YES
YES
YES

9 rows selected.
SQL> select bytes/1024/1024 from dba_data_files where tablespace_name='NEW DATA';
BYTES/1024/1024
--------------50
1 row selected.
SQL> select name from v$datafile;
NAME
-------------------------------------------------------------------------- -------/u01/oradata/mdev/system01.dbf
/u01/oradata/mdev/undotbs01.dbf
/u01/oradata/mdev/sysaux01.dbf
/u01/oradata/mdev/usr02.dbf
/u01/oradata/mdev/usr01.dbf
/u01/oradata/mdev/tool01.dbf
/u02/oradata/mdev/applicationdat01.dbf
/u01/oradata/mdev/tstdat01.dbf
/u01/oradata/mdev/newdat01.dbf
9 rows selected.
SQL> alter tablespace newdata online;

AWR, Adviser Tunning for DBAs


Tablespace altered.
SQL> alter database datafile '/u01/oradata/mdev/newdat01.dbf'
resize 200m;
Database altered.
SQL> show user
USER is "SYS"
SQL> select name from v$tempfile;
NAME
-------------------------------------------------------------------------- -------/u01/oradata/mdev/tmp01.dbf
1 row selected.
SQL> select tablespace_name,file_name from

dba_temp_files;

TABLESPACE_NAME
FILE_NAME
-----------------------------TEMP /u01/oradata/mdev/tmp01.dbf
1 row selected.
SQL> select bytes/1024/1024 from v$tempfile;
BYTES/1024/1024
--------------120
1 row selected.
SQL> @?/rdbms/admin/spcreate.sql
Choose the PERFSTAT user's password
----------------------------------Not specifying a password will result in the installation FAILING
Enter value for perfstat_password: abc
abc
SQL> connect perfstat/&&perfstat_password
Connected.
SQL>
SQL>
SQL>
SQL>
SQL>
SQL>
SQL>
SQL>
SQL>
SQL>
SQL>
SQL>
SQL>

@@spctab
Rem
Rem $Header: spctab.sql 31-may-2005.14:05:43 cdgreen Exp $
Rem
Rem spctab.sql
Rem
Rem Copyright (c) 1999, 2005, Oracle. All rights reserved.
Rem
Rem
NAME
Rem
spctab.sql
Rem
Rem
DESCRIPTION
Rem
SQL*PLUS command file to create tables to hold

AWR, Adviser Tunning for DBAs


SQL>
SQL>
SQL>
SQL>
SQL>
SQL>
SQL>
SQL>
SQL>
SQL>
SQL>
SQL>
SQL>
SQL>
SQL>
SQL>
SQL>
SQL>
SQL>
SQL>
SQL>
SQL>
SQL>
SQL>
SQL>
SQL>
SQL>
SQL>
SQL>
SQL>
SQL>
SQL>
SQL>
SQL>
SQL>
SQL>
SQL>
SQL>
SQL>
SQL>
SQL>

Rem
Rem
Rem
Rem
Rem
Rem
Rem
Rem
Rem
Rem
Rem
Rem
Rem
Rem
Rem
Rem
Rem
Rem
Rem
Rem
Rem
Rem
Rem
Rem
Rem
Rem
Rem
Rem
Rem
Rem
Rem
Rem
Rem
Rem
Rem
Rem
Rem
Rem
Rem
Rem

start and end "snapshot" statistical information


NOTES
Should be run as STATSPACK user, PERFSTAT
MODIFIED
cdgreen
cdgreen
cdgreen
vbarrier
cdgreen
cdgreen
cdialeri
vbarrier
cdialeri
cdialeri
cdialeri
cdialeri
cdialeri
vbarrier
cdialeri
cdialeri
vbarrier
vbarrier
cdialeri
cdialeri
cdialeri
cdialeri
cdialeri
cdialeri
cdialeri
cdialeri
cdialeri
cdialeri
cdialeri
cdialeri
cmlim
gwood
cellis.uk

(MM/DD/YY)
05/24/05 04/18/05 03/08/05 02/18/05 10/29/04 07/16/04 03/25/04 02/12/04 12/04/03 11/05/03 10/14/03 08/05/03 02/27/03 02/25/03 11/15/02 09/27/02 03/20/02 03/05/02 02/07/02 01/30/02 01/11/02 11/30/01 04/22/01 03/02/01 09/12/00 04/07/00 03/20/00 02/16/00 01/26/00 11/01/99 07/17/97 10/16/95 11/15/89 -

4246955
4228432
10gR2 misc
4081984
10gR2_sqlstats
10gR2
3516921
3412853
3290482
3202706
10g - streams - rvenkate
10g F3
10g F2: baseline, purge
10g RAC
10g F1
sleep4
2143634
Segment Statistics
2218573
2184717
9.2 - features 2
9.2 - features 1
Undostat changes
9.0
sp_1404195
1261813
Support for purge
1191805
1169401
Enhance, 1059172
Added STATS$SQLAREA to store top sql st mts
Version to run as sys without using man y views
Created

SQL> set showmode off echo off;


If this script is automatically called from spcreate (which is
the supported method), all STATSPACK segments will be created in
the PERFSTAT user's default tablespace.
Using newdata tablespace to store Statspack objects
... Creating STATS$SNAPSHOT_ID Sequence
Sequence created.
Synonym created.
... Creating STATS$... tables
Table created.
Synonym created.
Synonym created.
NOTE:
SPCTAB complete. Please check spctab.lis for any errors.
SQL> --

Create the statistics Package

AWR, Adviser Tunning for DBAs


SQL> @@spcpkg
SQL> Rem
SQL> Rem $Header: spcpkg.sql 31-may-2005.14:07:53 cdgreen Exp $
SQL> Rem
SQL> Rem
densor.uk
03/31/93 - Modified
SQL> Rem
cellis.uk
11/15/89 - Created
SQL> Rem
SQL> set echo off;
Creating Package STATSPACK...
Package created.
No errors.
Creating Package Body STATSPACK...
Package body created.
No errors.
NOTE:
SPCPKG complete. Please check spcpkg.lis for any errors.
SQL> conn perfstat/abc
Connected.
SQL> select * from tab;
TNAME
-----------------------------STATS$BG_EVENT_SUMMARY
STATS$BUFFERED_QUEUES

TABTYPE CLUSTERID
------- ---------TABLE
TABLE

STATS$WAITSTAT
V$DYNAMIC_REMASTER_STATS

TABLE
SYNONYM

68 rows selected.
SQL> exec statspack.snap;
PL/SQL procedure successfully completed.
SQL> @?/rdbms/admin/spauto.sql
SQL> Rem
SQL> Rem $Header: spauto.sql 16-feb-00.16:49:37 cdialeri Exp $
SQL> Rem
SQL> Rem spauto.sql
SQL> begin
2
select instance_number into :instno from v$instance;
3
dbms_job.submit(:jobno, 'statspack.snap;', trunc(sysdate+1/24,'HH') ,
'trunc(SYSDATE+1/24,''HH'')', TRUE, :instno);
4
commit;
5 end;
6 /
PL/SQL procedure successfully completed.
SQL> print jobno
JOBNO
---------1
SQL> show parameter job_queue_processes
NAME

TYPE

VALUE

10

AWR, Adviser Tunning for DBAs

11

------------------------------------ ----------- ------------------------- ----job_queue_processes


integer
0
SQL> prompt
SQL> prompt Next scheduled run
Next scheduled run
SQL> prompt
SQL> prompt The next scheduled run for this job is:
The next scheduled run for this job is:
SQL> select job, next_date, next_sec from user_jobs where job = :jobno;
JOB NEXT_DATE NEXT_SEC
---------- --------- -------1 10-APR-11 01:00:00
1 row selected.
SQL> spool off;
SQL> exec statspack.snap;
PL/SQL procedure successfully completed.
SQL> @?/rdbms/admin/spreport.sql
SQL> Rem
SQL> Rem $Header: spreport.sql 22-apr-2001.15:44:01 cdialeri Exp $
SQL> column dbid
just c;

heading "DB Id"

new_value dbid

format 99999 99999

SQL> prompt
SQL> prompt Current Instance
Current Instance
SQL> select d.dbid
2
, d.name
3
, i.instance_number
4
, i.instance_name
5
from v$database d,
6
v$instance i;

dbid
db_name
inst_num
inst_name

DB Id
DB Name
Inst Num Instance
----------- ------------ -------- -----------1566786210 MDEV
1 mdev
1 row selected.
SQL>
SQL> @@sprepins
SQL>
SQL>
SQL>
SQL>
SQL>

Rem
Rem $Header: sprepins.sql 31-may-2005.16:31:36 cdgreen Exp $
Rem
Rem sprepins.sql
Rem

AWR, Adviser Tunning for DBAs

12

SQL> set timing off veri off space 1 flush on pause off termout on numwidt h 10;
SQL> set echo off feedback off pagesize 60 newpage 1 recsep off;
Instances in this Statspack schema
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
DB Id
Inst Num DB Name
Instance
Host
----------- -------- ------------ ------------ -----------1566786210
1 MDEV
mdev
dserver1
Snapshot
Snap Id
Snap Time
Sessions Curs/Sess Comment
~~~~~~~~
---------- ------------------ -------- --------- ------------- -----Begin Snap:
1 10-Apr-11 00:17:00
18
2.7
End Snap:
2 10-Apr-11 00:22:04
18
3.9
Elapsed:
5.07 (mins)
Cache Sizes
~~~~~~~~~~~

Begin
End
---------- ---------Buffer Cache:
96M
Shared Pool Size:
120M

Load Profile
~~~~~~~~~~~~
Redo size:
Logical reads:
Block changes:
Physical reads:
Physical writes:
User calls:
Parses:
Hard parses:
Sorts:
Logons:
Executes:
Transactions:
% Blocks changed per Read:
Rollback per transaction %:

Std Block Size:


Log Buffer:

Per Second
--------------2,719.22
12.89
6.75
0.32
5.28
0.07
0.90
0.20
0.71
0.00
1.89
0.01
Recursive Call %:
Rows per Sort:

Instance Efficiency Percentages


~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Buffer Nowait %: 100.00
Buffer Hit
%:
97.78
Library Hit
%:
86.56
Execute to Parse %:
52.26
Parse CPU to Parse Elapsd %:
66.67

Redo NoWait %:
In-memory Sort %:
Soft Parse %:
Latch Hit %:
% Non-Parse CPU:

Memory Usage %:
% SQL with executions>1:
% Memory for SQL w/exec>1:
Top 5 Timed Events
~~~~~~~~~~~~~~~~~~

Begin
-----66.93
45.82
65.31

6, 892K

Per Transaction
--------------413,322.00
1,959.50
1,026.50
48.00
802.50
10.50
137.50
30.50
107.50
0.50
288.00

52.39
0.00

Shared Pool Statistics

4K

99.74
75.78

100.00
100.00
77.82
100.00
90.48

End
-----68.54
48.94
66.90
Avg %Total
wait
Call

Wait Event Histogram DB/Inst: MDEV/mdev Snaps: 1-2


-> Total Waits - units: K is 1000, M is 1000000, G is 1000000000
-> % of Waits - column heading: <=1s is truly <1024ms, >1s is truly >=1024 ms
-> % of Waits - value: .0 indicates value was <.05%, null is truly 0

AWR, Adviser Tunning for DBAs


-> Ordered by Event (idle events last)
Total ----------------- % of Waits ------------ -----Event
Waits <1ms <2ms <4ms <8ms <16ms <32ms <=1s
>1s
-------------------------- ----- ----- ----- ----- ----- ----- ----- ----- ----change tracking file synch
6 100.0
change tracking file synch
5
80.0 20.0
control file parallel writ 138
97.8
1.4
.7
control file sequential re 171 100.0
db file scattered read
1 100.0
db file sequential read
74
74.3
6.8 10.8
8.1
direct path read
9 100.0
direct path write
9 100.0
log file parallel write
8
25.0
12.5 37.5 25.0
log file sync
2
50.0
50.0
os thread startup
1
100.0
rdbms ipc reply
1 100.0
SQL*Net message from clien
13
76.9
7.7
15.4
SQL*Net message to client
13 100.0
Streams AQ: qmn coordinato
22
50.0
50.0
Streams AQ: qmn slave idle
11 100.0
dispatcher timer
10 100.0
pmon timer
106
4.7
95.3
rdbms ipc message
1087
28.5
71.5
smon timer
1 100.0
virtual circuit status
20 100.0
------------------------------------------------------------SQL ordered by CPU DB/Inst: MDEV/mdev Snaps: 1-2
% Total
Old
Parse Calls Executions
Parses Hash Value
------------ ------------ -------- ---------3
4
1.09 1980305124
select grantee#,privilege#,nvl(col#,0),max(mod(nvl(option$,0),2)
)from objauth$ where obj#=:1 group by grantee#,privilege#,nvl(co
l#,0) order by grantee#
------------------------------------------------------------Instance Activity Stats

DB/Inst: MDEV/mdev

Snaps: 1-2

Statistic
Total
per Second
per Trans
--------------------------------- ------------------ -------------- ------ -----CPU used by this session
42
0.1
21.0
CPU used when call started
53
0.2
26.5
CR blocks created
0
0.0
0.0
DB time
64
0.2
32.0
DBWR checkpoint buffers written
1,596
5.3 798.0
DBWR checkpoints
0
0.0
0.0
calls to kcmgcs
45
0.2
22.5
change write time
1
0.0
0.5
cleanout - number of ktugct calls
83
0.3
41.5
cleanouts only - consistent read
0
0.0
0.0
cluster key scan block gets
103
0.3
51.5
cluster key scans
51
0.2
25.5
commit cleanout failures: callbac
6
0.0
3.0
nd of Report ( sp_1_2.lst )
SQL> host

13

AWR, Adviser Tunning for DBAs

14

[oracle@dserver1 ~]$ pwd


/home/oracle
[oracle@dserver1 ~]$ ls
a
a.sql
oratab
a.dmp
b.dmp
recover
afiedt.buf host
script1.sql
alter
mdev.sql select

shutdown
sp_1_2.lst
spauto.lis
spcpkg.lis

spctab.lis
spcusr.lis
sqlnet.log
startup

[oracle@dserver1 ~]$ more sp_1_2.lst


STATSPACK report for
Database
DB Id
Instance
Inst Num Startup Time
Release
RAC
~~~~~~~~ ----------- ------------ -------- --------------- ----------- --1566786210 mdev
1 09-Apr-11 23:21 10.2.0.1.0 NO
Host

Name:

dserver1

Num CPUs:

Phys Memory (MB):

~~~~

Snapshot
Snap Id
Snap Time
Sessions Curs/Sess Comment
~~~~~~~~
---------- ------------------ -------- --------- -----------------Begin Snap:
1 10-Apr-11 00:17:00
18
2.7
End Snap:
2 10-Apr-11 00:22:04
18
3.9
Elapsed:
5.07 (mins)
e(type#,2,nvl(scale,-127/*MAXSB1MINAL*/),178,scale,179,scale,180
,scale,181,scale,182,scale,183,scale,231,scale,0),null$,fixedsto
rage,nvl(deflength,0),default$,rowid,col#,property, nvl(charseti
[oracle@dserver1 ~]$ exit
exit
SQL> show user
USER is "PERFSTAT"
SQL> conn / as sysdba
Connected.
SQL> @?/rdbms/admin/awrrpt.sql
Current Instance
~~~~~~~~~~~~~~~~
DB Id
DB Name
Inst Num Instance
----------- ------------ -------- -----------1566786210 MDEV
1 mdev
Specify the Report Type
~~~~~~~~~~~~~~~~~~~~~~~
Would you like an HTML report, or a plain text report?
Enter 'html' for an HTML report, or 'text' for plain text
Defaults to 'html'
Enter value for report_type:
Type Specified:

html

Вам также может понравиться