暂无图片
暂无图片
1
暂无图片
暂无图片
暂无图片

10046跟踪分区表添加分区过程中的递归操作

原创 刘娣 2019-03-22
604

问题描述

使用10046追踪增加分区的递归操作

sys@TEST>create table test_p (id number,name varchar2(20))
  2  partition by range (id)
  3  (
  4  partition p1 values less than (10),
  5  partition p2 values less than (20),
  6  partition p3 values less than (30),
  7  partition p4 values less than (40)
  8  );
Table created.

sys@TEST>insert into test_p (id,name)
  2        select rownum,
  3               dbms_random.string('x', 2)
  4          from dual
  5        connect by rownum < 40;
39 rows created.

sys@TEST>commit;
Commit complete.

sys@TEST>select owner,table_name,PARTITION_COUNT,PARTITIONING_TYPE from dba_part_tables where owner='SYS' and table_name='TEST_P';
OWNER TABLE_NAME PARTITION_COUNT PARTITIONING_TYPE
----- ---------- --------------- -----------------
SYS   TEST_P                   4 RANGE

sys@TEST>select TABLE_OWNER,TABLE_NAME,PARTITION_NAME from dba_tab_partitions where table_owner='SYS' and table_name='TEST_P';
TABLE_OWNE TABLE_NAME PARTITION_
---------- ---------- ----------
SYS        TEST_P     P1
SYS        TEST_P     P2
SYS        TEST_P     P3
SYS        TEST_P     P4

sys@TEST>alter session set events '10046 trace name context forever,level 12';
Session altered.

sys@TEST>alter table test_p add partition p5 values less than(50) ;
Table altered.

sys@TEST>@gettrcname
TRACE_FILE_NAME
--------------------------------------------------------------------
/u01/app/oracle/product/12.1.0/dbhome_1/rdbms/log/test_ora_10238.trc

sys@TEST>select TABLE_OWNER,TABLE_NAME,PARTITION_NAME from dba_tab_partitions where table_owner='SYS' and table_name='TEST_P';
TABLE_OWNE TABLE_NAME PARTITION_
---------- ---------- ----------
SYS        TEST_P     P1
SYS        TEST_P     P2
SYS        TEST_P     P3
SYS        TEST_P     P4
SYS        TEST_P     P5

[oracle@bogon trace]$ tkprof test_ora_10238.trc test_p.txt

专家解答

查看格式化后的10046内容,其中有很多对数据字典表访问的递归操作

[oracle@bogon trace]$ more test_p.txt

TKPROF: Release 12.1.0.2.0 - Development on Fri Sep 7 17:37:46 2018

Copyright (c) 1982, 2014, Oracle and/or its affiliates.  All rights reserved.

Trace file: test_ora_10238.trc
Sort options: default

********************************************************************************
count    = number of times OCI procedure was executed
cpu      = cpu time in seconds executing 
elapsed  = elapsed time in seconds executing
disk     = number of physical reads of buffers from disk
query    = number of buffers gotten for consistent read
current  = number of buffers gotten in current mode (usually for update)
rows     = number of rows processed by the fetch or execute call
********************************************************************************

SQL ID: 9babjv8yq8ru3 Plan Hash: 0

BEGIN DBMS_OUTPUT.GET_LINES(:LINES, :NUMLINES); END;

********************************************************************************

SQL ID: 9gws3pq9m9nhf Plan Hash: 3600061239

select count(FA#) 
from
 SYS_FBA_TRACKEDTABLES where OBJ# = 95246 and bitand(FLAGS, 128)=0

********************************************************************************

SQL ID: 9hby63aa5z7mq Plan Hash: 0

alter table test_p add pa

********************************************************************************

SQL ID: 622ufbrgvxdc7 Plan Hash: 381121033

select decode(u.type#, 2, u.ext_username, u.name), o.name,        t.update$, 
  t.insert$, t.delete$, t.enabled,        decode(bitand(t.property, 8192),
  8192, 1, 0),        decode(bitand(t.property, 65536), 65536, 1, 0),       
  decode(bitand(t.property, 131072), 131072, 1, 0),       (select o.name 
from
 obj$ o          where o.obj# = u.spare2 and o.type# =57),        
  decode(bitand(t.property, 524288), 524288, 1, 0)  from sys.obj$ o, 
  sys.user$ u, sys.trigger$ t, sys.obj$ bo where t.baseobject=bo.obj# and 
  bo.name = :1 and bo.spare3 = :2  and bo.namespace = 1  and t.obj#=o.obj# 
  and o.owner#=u.user#  and o.type# = 12 and bitand(property,16)=0 and 
  bitand(property,8)=0  order by o.obj#

********************************************************************************

SQL ID: a7kvcmgaru84g Plan Hash: 813480514

select obj#,type#,ctime,mtime,stime, status, dataobj#, flags, oid$, spare1, 
  spare2, spare3, signature, spare7, spare8, spare9 
from
 obj$ where owner#=:1 and name=:2 and namespace=:3 and remoteowner is null 
  and linkname is null and subname = :4

********************************************************************************

SQL ID: 87gaftwrm2h68 Plan Hash: 1072382624

select o.owner#,o.name,o.namespace,o.remoteowner,o.linkname,o.subname 
from
 obj$ o where o.obj#=:1

********************************************************************************

SQL ID: 0kcbwucxmazcp Plan Hash: 0

insert into obj$(owner#,name,namespace,obj#,type#,ctime,mtime,stime,status,
  remoteowner,linkname,subname,dataobj#,flags,oid$,spare1,spare2,spare3, 
  signature, spare7, spare8, spare9) 
values
(:1,:2,:3,:4,:5,:6,:7,:8,:9,:10,:11,:12,:13,:14,:15,:16,:17,:18, :19,:20,:21,
  :22)

********************************************************************************

SQL ID: 74anujtt8zw4h Plan Hash: 3949148835

select o.owner#, o.name,            o.namespace,    o.obj#,   d.d_timestamp, 
  nvl(d.property,0), o.type#, o.subname, d.d_attrs  
from
 dependency$ d, obj$ o   where d.p_obj#=:1  and   (d.p_timestamp=nvl(:2,
  d.p_timestamp) or d.property=2)  and   o.owner#=nvl(:3,o.owner#)  and   
  d.d_obj#=o.obj#  order by o.obj#

********************************************************************************

SQL ID: 02646wc3r1nwf Plan Hash: 3852616796

SELECT 1  
FROM
 sys.snap_reftime$ r, sys.snap$ s, sys.obj$ o, sys.user$ u  WHERE r.vname=
  s.vname AND r.sowner=s.sowner AND o.type#=42 AND        o.name=s.vname AND 
  o.owner#= u.user# AND s.sowner=u.name AND        r.masobj# = :1

********************************************************************************

SQL ID: 8gbvzamxwpdw1 Plan Hash: 1175689384

DELETE FROM sys.snap_refop$  
WHERE
 operation# = 21 AND(sowner, vname) in  (SELECT u.name, o.name   FROM 
  sys.snap_reftime$ r, sys.obj$ o, sys.user$ u   WHERE r.vname=o.name AND 
  r.sowner=u.name AND o.owner#= u.user# AND        o.type#=42 AND r.masobj# = 
  :1)

********************************************************************************

SQL ID: 9tgj4g8y4rwy8 Plan Hash: 3755742892

select type#,blocks,extents,minexts,maxexts,extsize,extpct,user#,iniexts,
  NVL(lists,65535),NVL(groups,65535),cachehint,hwmincr, NVL(spare1,0),
  NVL(scanhint,0),NVL(bitmapranges,0) 
from
 seg$ where ts#=:1 and file#=:2 and block#=:3

********************************************************************************

SQL ID: g7mt7ptq286u7 Plan Hash: 0

insert into seg$ (file#,block#,type#,ts#,blocks,extents,minexts,maxexts,
  extsize,extpct,user#,iniexts,lists,groups,cachehint,hwmincr, spare1, 
  scanhint, bitmapranges) 
values
 (:1,:2,:3,:4,:5,:6,:7,:8,:9,:10,:11,:12,:13,:14,:15,:16,DECODE(:17,0,NULL,
  :17),:18,:19)

********************************************************************************

SQL ID: gsfnqdfcvy33q Plan Hash: 2453887050

delete from superobj$ 
where
 subobj# = :1

********************************************************************************

SQL ID: 3kywng531fcxu Plan Hash: 2667651180

delete from tab_stats$ 
where
 obj#=:1

********************************************************************************

SQL ID: b5cr4hhndmbuf Plan Hash: 2918346288

update tab$ set ts#=:2,file#=:3,block#=:4,bobj#=decode(:5,0,null,:5),tab#=
  decode(:6,0,null,:6),intcols=:7,kernelcols=:8,clucols=decode(:9,0,null,:9),
  audit$=:10,flags=:11,pctfree$=:12,pctused$=:13,initrans=:14,maxtrans=:15,
  rowcnt=:16,blkcnt=:17,empcnt=:18,avgspc=:19,chncnt=:20,avgrln=:21,
  analyzetime=:22,samplesize=:23,cols=:24,property=:25,degree=decode(:26,1,
  null,:26),instances=decode(:27,1,null,:27),dataobj#=:28,avgspc_flb=:29,
  flbcnt=:30,trigflag=:31,spare1=:32,spare2=decode(:33,0,null,:33),spare4=:34,
  spare6=:35 
where
 obj#=:1

********************************************************************************

SQL ID: 0rbcqb9pa39d1 Plan Hash: 3761826347

update partobj$ set partcnt = :1 
where
 obj# = :2

********************************************************************************

SQL ID: 9hp6m1g7j275b Plan Hash: 0

insert into tabpart$ (obj#, dataobj#, bo#, part#, hiboundlen, hiboundval, ts#,
   file#, block#, pctfree$, pctused$, initrans, maxtrans, flags, analyzetime, 
  samplesize, rowcnt, blkcnt, empcnt, avgspc, chncnt, avgrln, bhiboundval) 
values
 (:1, :2, :3, :4, :5, :6, :7, :8, :9, :10, :11, :12, :13, :14, :15, :16, :17, 
  :18, :19, :20, :21, :22, EMPTY_BLOB()) returning bhiboundval into :23

********************************************************************************

SQL ID: 0kkhhb2w93cx0 Plan Hash: 2170058777

update seg$ set type#=:4,blocks=:5,extents=:6,minexts=:7,maxexts=:8,extsize=
  :9,extpct=:10,user#=:11,iniexts=:12,lists=decode(:13, 65535, NULL, :13),
  groups=decode(:14, 65535, NULL, :14), cachehint=:15, hwmincr=:16, spare1=
  DECODE(:17,0,NULL,:17),scanhint=:18, bitmapranges=:19 
where
 ts#=:1 and file#=:2 and block#=:3

********************************************************************************
最后修改时间:2019-04-14 10:45:51
「喜欢这篇文章,您的关注和赞赏是给作者最好的鼓励」
关注作者
【版权声明】本文为墨天轮用户原创内容,转载时必须标注文章的来源(墨天轮),文章链接,文章作者等基本信息,否则作者和墨天轮有权追究责任。如果您发现墨天轮中有涉嫌抄袭或者侵权的内容,欢迎发送邮件至:contact@modb.pro进行举报,并提供相关证据,一经查实,墨天轮将立刻删除相关内容。

评论