Академический Документы
Профессиональный Документы
Культура Документы
272629760
1218892
163579572
100663296
7168000
bytes
bytes
bytes
bytes
bytes
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',
time_limit=>70,
task_name=>'sql_tuning_task_test1'
,
description=>'tuning test for emp table');
end;
/
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
STATUS
----------COMPLETED
SQL>
SQL>
SQL>
SQL>
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
| 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 |
|
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
as sysdba
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;
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
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
(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
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
11
new_value dbid
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
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 %:
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:
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
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
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
14
shutdown
sp_1_2.lst
spauto.lis
spcpkg.lis
spctab.lis
spcusr.lis
sqlnet.log
startup
Name:
dserver1
Num CPUs:
~~~~
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