5. “We’re just ordinary people who apply the scientific
method to the things we can observe and measure”
Author: Jonathan Lewis
Technical reviewer: Tanel Poder
出典:Oracle Core: Essential Internals for DBAs and Developers
8. $ sqlplus neo/follow_the_white_rabbit
SQL*Plus: Release 11.2.0.2.0 Production on Tue Oct 16 09:56:00 2012
Copyright (c) 1982, 2010, Oracle. All rights reserved.
Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.2.0 - Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
SQL>
9. SQL> create table agent(id number(10),name char(10));
Table created.
SQL> begin
for i in 1..10000000 loop
insert into agent(id, name) values(i, 'smith');
end loop;
end;
/ 2 3 4 5 6
PL/SQL procedure successfully completed.
SQL> commit;
Commit complete.
SQL>
10. SQL> set autotrace on
SQL> alter session set events '10046 trace name context forever, level 12';
Session altered.
SQL> select count(1) from agent;
COUNT(1)
----------
1000000
Execution Plan
----------------------------------------------------------
Plan hash value: 2571700340
--------------------------------------------------------------------
| Id | Operation | Name | Rows | Cost (%CPU)| Time |
--------------------------------------------------------------------
| 0 | SELECT STATEMENT | | 1 | 789 (1)| 00:00:10 |
| 1 | SORT AGGREGATE | | 1| | |
| 2 | TABLE ACCESS FULL| AGENT | 873K| 789 (1)| 00:00:10 |
--------------------------------------------------------------------
11. $ tkprof orcl_ora_3331.trc orcl_ora_3331_tkprof.txt
$ less orcl_ora_3331_tkprof.txt
…
SQL ID: guxtdnm3w68gr Plan Hash: 2571700340
select count(1)
from
agent
…
Elapsed times include waiting on following events:
Event waited on Times Max. Wait Total Waited
---------------------------------------- Waited ---------- ------------
SQL*Net message to client 2 0.00 0.00
Disk file operations I/O 1 0.00 0.00
asynch descriptor resize 2 0.00 0.00
direct path read 97 0.00 0.03
SQL*Net message from client 2 0.00 0.00