- 最后登录
- 2013-10-23
- 在线时间
- 1 小时
- 威望
- 0
- 金钱
- 17
- 注册时间
- 2013-9-16
- 阅读权限
- 10
- 帖子
- 4
- 精华
- 0
- 积分
- 0
- UID
- 1223
|
1#
发表于 2013-10-12 11:16:44
|
查看: 3215 |
回复: 3
(1)查看我当前的oracle版本
SQL> select * from v$version;
BANNER
----------------------------------------------------------------
Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Prod
PL/SQL Release 10.2.0.1.0 - Production
CORE 10.2.0.1.0 Production
TNS for Linux: Version 10.2.0.1.0 - Production
NLSRTL Version 10.2.0.1.0 - Production
(2) 首先,我以scott用户建了一个表,并插入一行数据:
create table t
(c1 int)
/
insert into t
values
(1)
/
(3) 然后,重启oracle,再用scott用户进入SQL*PLUS。
(4)然后依次执行下面的语句(我将下面的语句做成一个批处理一次执行)。
col trace new_val T
exec dbms_monitor.session_trace_enable
select * from t;
update t t1 set c1=c1+1;
update t t2 set c1=c1+1;
exec dbms_monitor.session_trace_disable
select * from t;
select c.value || '/' || d.instance_name ||
'_ora_' || a.spid || '.trc' trace
from v$process a, v$session b, v$parameter c, v$instance d
where a.addr = b.paddr
and b.audsid = userenv('sessionid')
and c.name = 'user_dump_dest';
!tkprof &T myprof
!vi myprof.prf
(5)
select * from t
call count cpu elapsed disk query current rows
------- ------ -------- ---------- ---------- ---------- ---------- ----------
Parse 2 0.00 0.00 0 0 0 0
Execute 2 0.00 0.00 0 0 0 0
Fetch 4 0.00 0.16 1 2 0 2
------- ------ -------- ---------- ---------- ---------- ---------- ----------
total 8 0.00 0.16 1 2 0 2
update t t1 set c1=c1+1
call count cpu elapsed disk query current rows
------- ------ -------- ---------- ---------- ---------- ---------- ----------
Parse 1 0.00 0.00 0 0 0 0
Execute 1 0.00 0.00 1 1 7 1
Fetch 0 0.00 0.00 0 0 0 0
------- ------ -------- ---------- ---------- ---------- ---------- ----------
total 2 0.00 0.00 1 1 7 1
update t t2 set c1=c1+1
call count cpu elapsed disk query current rows
------- ------ -------- ---------- ---------- ---------- ---------- ----------
Parse 1 0.00 0.00 0 0 0 0
Execute 1 0.00 0.00 0 1 5 1
Fetch 0 0.00 0.00 0 0 0 0
------- ------ -------- ---------- ---------- ---------- ---------- ----------
total 2 0.00 0.00 0 1 5 1
(6)我的问题是:
(1)select 语句中的parse,Execute,fetch对应的count为什么分别是2,2,4?
(2)select 语句中的fetch对应的query为什么是2呢?我觉得oracle只从磁盘上读了一个数据块,再从缓存中访问一次这个数据块即可,因此,应该是1才对呀。
(3)第一个update语句的current为什么是7,而query是1呢?
(4)第二个update语句的current为什么是5?
|
|