oracle_lath free - contention on dc_rollback_segments
(2014-11-01 23:19:17)
标签:
latchfreeundoora-1628it |
分类: oracleops |
SQL>SELECT name
row cache objects;
SQL>SELECT sql_text
大量DML操作可以看到。
查询row cache object对应的对象:
SQL> SELECT name, 'Child '||child#, gets, misses,
sleeps
NAME
'CHILD'||CHILD#
GETS
MISSES
SLEEPS
----------------------------------------------------------------
-----------------------------------
row cache objects
Child 8
row cache 对应latch号
set pages 1000
------- ------ --------------------------------- -----------
------------
As you know, with automatic
undo, you have no control over the extent sizes,
10 and above
Find which cache is being waited for:
SQL> select p1text,p1,p2text,p2,p3text,p3 from v$session
where event='row cache lock';
P1TEXT P1 P2TEXT P2 P3TEXT P3
cache id 8 mode 0 request 3
SQL> select parameter,count,gets,getmisses,modifications
from v$rowcache where cache#=8;
PARAMETER COUNT GETS GETMISSES MODIFICATIONS
DC_SEQUENCES 869
76843 508432
4500
For DC_SEQUENCES, consider caching sequences using the cache
option.
Other dictionary locks:
DC_OBJECTS
Look for any object compilation activity which might require
an exclusive lock, blocking other activities
DC_SEGMENTS
This is most likely due to segment
allocation.
DC_USERS
This may occur if a session issues a GRANT to a user, and that
user is in the process of logging on to the database.
DC_TABLESPACES
Probably the most likely cause is the allocation of new
extents. If extent sizes are set low then the application may
constantly be requesting new extents and causing contention. Do you
have objects with small extent sizes that are rapidly growing? (You
may be able to spot these by looking for objects with large numbers
of extents). Check the trace for insert/update activity, check the
objects inserted into for number of extents.
PS: 如果处理UNDO碎片以及收缩空间大小
a) select a.inst_id, a.ksppinm "Parameter",
b.ksppstvl "Session Value",
c.ksppstvl "Instance Value"
from x$ksppi a, x$ksppcv b, x$ksppsv c
where a.indx = b.indx and a.indx = c.indx
and a.inst_id=b.inst_id and b.inst_id=c.inst_id
and a.ksppinm in ('_smu_debug_mode')
order by 2;
select segment_name,
round(nvl(sum(act),0)/(1024*1024*1024),3 ) "ACT GB
BYTES",
round(nvl(sum(unexp),0)/(1024*1024*1024),3) "UNEXP GB
BYTES",
round(nvl(sum(exp),0)/(1024*1024*1024),3) "EXP GB
BYTES",
NO_OF_EXTENTS
from ( select segment_name, nvl(sum(bytes),0) act,00 unexp, 00
exp, count(*) NO_OF_EXTENTS
from DBA_UNDO_EXTENTS
where status='ACTIVE' and tablespace_name = 'UNDOTBS1'
group by segment_name
union
select segment_name,00 act, nvl(sum(bytes),0) unexp, 00 exp ,
count(*) NO_OF_EXTENTS
from DBA_UNDO_EXTENTS
where status='UNEXPIRED' and tablespace_name =
'UNDOTBS1'
group by segment_name
union
select segment_name, 00 act, 00 unexp, nvl(sum(bytes),0) exp,
count(*) NO_OF_EXTENTS
from DBA_UNDO_EXTENTS
where status='EXPIRED' and tablespace_name = 'UNDOTBS1'
group by segment_name
) group by segment_name, NO_OF_EXTENTS order by 5 desc;
select sum(blocks),count(*) extents,segment_name from
DBA_EXTENTS
where tablespace_name = 'UNDOTBS1' group by segment_name order
by 2 desc;
b) alter system set "_smu_debug_mode" = 4 scope=memory;
c) alter rollback segment "_SYSSMU$" shrink;
d) alter system set "_smu_debug_mode" = scope=memory;
Then you can check the result of this measure by running the
query in step a again before and after the above three steps.
4) Drop and recreate undo tablespace (due to it's
fragmentation)
The steps for recreating an undo tablespace are in Note
268870.1 Ext/Pub How to Shrink the datafile of Undo
Tablespace.
5) Minimize the generated undo as much as possible :
Example:
- split large transactions into smaller one
- commit more often
- use direct path load rather than conventional path load to
significantly reduce the amount of undo and thus also avoid a too
high fragmentation of undo tablespace.