• Share
  • Email
  • Embed
  • Like
  • Save
  • Private Content
Undo Management
 

Undo Management

on

  • 355 views

 

Statistics

Views

Total Views
355
Views on SlideShare
348
Embed Views
7

Actions

Likes
0
Downloads
6
Comments
0

2 Embeds 7

http://anargodjaev.wordpress.com 6
http://webcache.googleusercontent.com 1

Accessibility

Categories

Upload Details

Uploaded via as Microsoft Word

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment

    Undo Management Undo Management Document Transcript

    • Anar Godjaev Undo Management optimal undo_retention parameter = actual undo size / (db_block_size/undo_block_per_sec) -- ********************** -- manual undo management -- ********************** create rollback segment r01 tablespacerbs; create public rollback_segment r01 tablespacerbs; alter rollback segment r01 offline; drop rollback segment r01; -- ************************* -- automatic undo management -- ************************* alter system set undo_management = auto; alter system set undo_tablespace = <ts_name>; alter system set undo_suppress_errors = true|false ; alter system set undo_retention = 900; --seconds select name, value from v$parameter where name like 'undo_management' select name, value from v$parameter where name like 'undo_tablespace' select name, value from v$parameter where name like 'undo_retention' -- creating undo tablespace create undo tablespacets_undodatafile 'C:ts_undo_01.dbf' size 20m; alter tablespacets_undo add datafile 'C:ts_undo_02.dbf' size 40m; alter system set undo_tablespace = ts_undo; drop tablespacets_undo; alter tablespacets_undo retention guarantee; select retention, tablespace_name from dba_tablespaces;
    • Anar Godjaev select begin_time, end_time, tuned_undoretention from v$undostat; -- calculating undo space select ceil(((UR * (UPS * DBS)) + (DBS * 24))/1024/1024) as MB from (select value as UR from v$parameter where name='undo_retention'), (select (sum(undoblks)/sum(((end_time - begin_time) * 84600))) as UPS from v$undostat), (select value as DBS from v$parameter where name = 'db_block_size'); set transaction read only; set transaction isolation level serializable; -- possible negative impact on performance -- Actual Undo Size SELECT SUM(a.bytes) "UNDO_SIZE" FROM v$datafile a, v$tablespace b, dba_tablespaces c WHERE c.contents = 'UNDO' AND c.status = 'ONLINE' AND b.name = c.tablespace_name AND a.ts# = b.ts#; -- Undo Blocks per Second SELECT MAX(undoblks/((end_time-begin_time)*3600*24)) "UNDO_BLOCK_PER_SEC" FROM v$undostat; -- DB Block Size SELECT TO_NUMBER(value) "DB_BLOCK_SIZE [KByte]" FROM v$parameter WHERE name = 'db_block_size';
    • Anar Godjaev -- optimal undo retention SELECT d.undo_size/(1024*1024) "ACTUAL UNDO SIZE [MByte]", SUBSTR(e.value,1,25) "UNDO RETENTION [Sec]", ROUND((d.undo_size / (to_number(f.value) * g.undo_block_per_sec))) "OPTIMAL UNDO RETENTION [Sec]" FROM ( SELECT SUM(a.bytes) undo_size FROM v$datafile a, v$tablespace b, dba_tablespaces c WHERE c.contents = 'UNDO' AND c.status = 'ONLINE' AND b.name = c.tablespace_name AND a.ts# = b.ts# ) d, v$parameter e, v$parameter f, ( SELECT MAX(undoblks/((end_time-begin_time)*3600*24)) undo_block_per_sec FROM v$undostat ) g WHERE e.name = 'undo_retention' AND f.name = 'db_block_size'; -- optimal undo size SELECT d.undo_size/(1024*1024) "ACTUAL UNDO SIZE [MByte]", SUBSTR(e.value,1,25) "UNDO RETENTION [Sec]", (TO_NUMBER(e.value) * TO_NUMBER(f.value) * g.undo_block_per_sec) / (1024*1024) "NEEDED UNDO SIZE [MByte]" FROM ( SELECT SUM(a.bytes) undo_size FROM v$datafile a, v$tablespace b, dba_tablespaces c WHERE c.contents = 'UNDO' AND c.status = 'ONLINE' AND b.name = c.tablespace_name AND a.ts# = b.ts#
    • Anar Godjaev ) d, v$parameter e, v$parameter f, ( SELECT MAX(undoblks/((end_time-begin_time)*3600*24)) undo_block_per_sec FROM v$undostat ) g WHERE e.name = 'undo_retention' AND f.name = 'db_block_size'; -- undo consumer sessions SELECT TO_CHAR (s.SID) || ',' || TO_CHAR (s.serial#) sid_serial, NVL (s.username, 'None') orauser, s.program, r.NAME undoseg, t.used_ublk * TO_NUMBER (x.VALUE) / 1024 || 'K' "Undo", t1.tablespace_name FROM SYS.v_$rollname r, SYS.v_$session s, SYS.v_$transaction t, SYS.v_$parameter x, dba_rollback_segs t1 WHERE s.taddr = t.addr AND r.usn = t.xidusn(+) AND x.NAME = 'db_block_size' AND t1.segment_id = r.usn AND t1.tablespace_name = 'UNDOTBS1';