Best Practices to avoid ORA-01555 - Oracle · PDF fileBest Practices to avoid ORA-01555...

49
Best Practices to avoid ORA-01555 Prepared by: Deiby Gómez Oracle Certified Master 11g Pythian Oracle Consultant

Transcript of Best Practices to avoid ORA-01555 - Oracle · PDF fileBest Practices to avoid ORA-01555...

Page 1: Best Practices to avoid ORA-01555 - Oracle · PDF fileBest Practices to avoid ORA-01555 Prepared by: Deiby Gómez Oracle Certified Master 11g Pythian Oracle Consultant

Best Practices to avoid ORA-01555 Prepared by: Deiby Gómez Oracle Certified Master 11g Pythian Oracle Consultant

Page 2: Best Practices to avoid ORA-01555 - Oracle · PDF fileBest Practices to avoid ORA-01555 Prepared by: Deiby Gómez Oracle Certified Master 11g Pythian Oracle Consultant

© 2014 Pythian Confidential 2

Page 3: Best Practices to avoid ORA-01555 - Oracle · PDF fileBest Practices to avoid ORA-01555 Prepared by: Deiby Gómez Oracle Certified Master 11g Pythian Oracle Consultant

© 2014 Pythian Confidential 3

WHAT IS UNDO DATA •  Rollback an active transaction •  Recover a terminated transaction •  Provide read consistency •  Recovery from logical corruptions •  Perform some logical flashback operations

Page 4: Best Practices to avoid ORA-01555 - Oracle · PDF fileBest Practices to avoid ORA-01555 Prepared by: Deiby Gómez Oracle Certified Master 11g Pythian Oracle Consultant

© 2014 Pythian Confidential 4

FLASHBACK AND UNDO

Page 5: Best Practices to avoid ORA-01555 - Oracle · PDF fileBest Practices to avoid ORA-01555 Prepared by: Deiby Gómez Oracle Certified Master 11g Pythian Oracle Consultant

© 2014 Pythian Confidential 5

UPDATE PROCESS

Update…

Undo

Redo Log Buffer

Redo Record •  Undo Change Vector •  Data Change Vector

Table’s Data Blocks

Page 6: Best Practices to avoid ORA-01555 - Oracle · PDF fileBest Practices to avoid ORA-01555 Prepared by: Deiby Gómez Oracle Certified Master 11g Pythian Oracle Consultant

© 2014 Pythian Confidential 6

CONSISTENT READ

Trans#3 – C - ! - SCN

Trans#4 – A - ! - SCN

1 ‘D’ ‘D’

2 ‘A’ ‘A’

3 ‘A’ ‘A’

4 ‘A’ ‘A’

Target SCN Current SCN

Trans#1 – C - ! - SCN

1 ‘A’ ‘A’

2 ‘A’ ‘A’

3 ‘A’ ‘A’

4 ‘A’ ‘A’

Page 7: Best Practices to avoid ORA-01555 - Oracle · PDF fileBest Practices to avoid ORA-01555 Prepared by: Deiby Gómez Oracle Certified Master 11g Pythian Oracle Consultant

© 2014 Pythian Confidential 7

CONSISTENT READ

Trans#3 – C - ! - SCN

Trans#4 – A - ! - SCN

1 ‘D’ ‘D’

2 ‘A’ ‘A’

3 ‘A’ ‘A’

4 ‘A’ ‘A’

Trans#3 – C - ! - SCN

Trans#4 – A - ! - SCN

1 ‘D’ ‘D’

2 ‘A’ ‘A’

3 ‘A’ ‘A’

4 ‘A’ ‘A’

Trans#4 SCN > SCN we are looking for?

Page 8: Best Practices to avoid ORA-01555 - Oracle · PDF fileBest Practices to avoid ORA-01555 Prepared by: Deiby Gómez Oracle Certified Master 11g Pythian Oracle Consultant

© 2014 Pythian Confidential 8

CONSISTENT READ

Trans#3 – C - ! - SCN

Trans#4 – A - ! - SCN

1 ‘D’ ‘D’

2 ‘A’ ‘A’

3 ‘A’ ‘A’

4 ‘A’ ‘A’

Extent

Segment

Trans#3 – C - ! - SCN

Trans#4 – A - ! - SCN

1 ‘D’ ‘D’

2 ‘A’ ‘A’

3 ‘A’ ‘A’

4 ‘A’ ‘A’

Trans#3 – C - ! - SCN

Trans#4 – A - ! - SCN

1 ‘C’ ‘C’

2 ‘A’ ‘A’

3 ‘A’ ‘A’

4 ‘A’ ‘A’

Page 9: Best Practices to avoid ORA-01555 - Oracle · PDF fileBest Practices to avoid ORA-01555 Prepared by: Deiby Gómez Oracle Certified Master 11g Pythian Oracle Consultant

© 2014 Pythian Confidential 9

CONSISTENT READ

Trans#3 – C - ! - SCN

Trans#4 – A - ! - SCN

1 ‘D’ ‘D’

2 ‘A’ ‘A’

3 ‘A’ ‘A’

4 ‘A’ ‘A’

Trans#3 – C - ! - SCN

1 ‘C’ ‘C’

2 ‘A’ ‘A’

3 ‘A’ ‘A’

4 ‘A’ ‘A’

Extent

Segment

Trans#3 – C - ! - SCN

Trans#4 – A - ! - SCN

1 ‘D’ ‘D’

2 ‘A’ ‘A’

3 ‘A’ ‘A’

4 ‘A’ ‘A’

Page 10: Best Practices to avoid ORA-01555 - Oracle · PDF fileBest Practices to avoid ORA-01555 Prepared by: Deiby Gómez Oracle Certified Master 11g Pythian Oracle Consultant

© 2014 Pythian Confidential 10

CONSISTENT READ

Trans#3 – C - ! - SCN

1 ‘C ‘C’

2 ‘D’ ‘D’

3 ‘D’ ‘D’

4 ‘D’ ‘D’

Extent

Segment

Trans#3 SCN > SCN we are looking for? >

Trans#3 – C - ! - SCN

Trans#4 – A - ! - SCN

1 ‘D’ ‘D’

2 ‘A’ ‘A’

3 ‘A’ ‘A’

4 ‘A’ ‘A’

Page 11: Best Practices to avoid ORA-01555 - Oracle · PDF fileBest Practices to avoid ORA-01555 Prepared by: Deiby Gómez Oracle Certified Master 11g Pythian Oracle Consultant

© 2014 Pythian Confidential 11

CONSISTENT READ Extent

Segment

Trans#3 – C - ! - SCN

Trans#4 – A - ! - SCN

1 ‘D’ ‘D’

2 ‘A’ ‘A’

3 ‘A’ ‘A’

4 ‘A’ ‘A’

Trans#3 – C - ! - SCN

1 ‘B ‘B’

2 ‘D’ ‘D’

3 ‘D’ ‘D’

4 ‘D’ ‘D’

Page 12: Best Practices to avoid ORA-01555 - Oracle · PDF fileBest Practices to avoid ORA-01555 Prepared by: Deiby Gómez Oracle Certified Master 11g Pythian Oracle Consultant

© 2014 Pythian Confidential 12

CONSISTENT READ

Trans#2 – C - ! - SCN

1 ‘B’ ‘B’

2 ‘D’ ‘D’

3 ‘D’ ‘D’

4 ‘D’ ‘D’

Extent

Segment

Trans#3 – C - ! - SCN

Trans#4 – A - ! - SCN

1 ‘D’ ‘D’

2 ‘A’ ‘A’

3 ‘A’ ‘A’

4 ‘A’ ‘A’

Page 13: Best Practices to avoid ORA-01555 - Oracle · PDF fileBest Practices to avoid ORA-01555 Prepared by: Deiby Gómez Oracle Certified Master 11g Pythian Oracle Consultant

© 2014 Pythian Confidential 13

CONSISTENT READ

Trans#2 – C - ! - SCN

1 ‘B’ ‘B’

2 ‘D’ ‘D’

3 ‘D’ ‘D’

4 ‘D’ ‘D’

Extent

Segment

Trans#2 SCN > SCN we are looking for? >

Trans#3 – C - ! - SCN

Trans#4 – A - ! - SCN

1 ‘D’ ‘D’

2 ‘A’ ‘A’

3 ‘A’ ‘A’

4 ‘A’ ‘A’

Page 14: Best Practices to avoid ORA-01555 - Oracle · PDF fileBest Practices to avoid ORA-01555 Prepared by: Deiby Gómez Oracle Certified Master 11g Pythian Oracle Consultant

© 2014 Pythian Confidential 14

CONSISTENT READ Extent

Segment

Trans#3 – C - ! - SCN

Trans#4 – A - ! - SCN

1 ‘D’ ‘D’

2 ‘A’ ‘A’

3 ‘A’ ‘A’

4 ‘A’ ‘A’

Trans#2 – C - ! - SCN

1 ‘A’ ‘A’

2 ‘D’ ‘D’

3 ‘D’ ‘D’

4 ‘D’ ‘D’

Page 15: Best Practices to avoid ORA-01555 - Oracle · PDF fileBest Practices to avoid ORA-01555 Prepared by: Deiby Gómez Oracle Certified Master 11g Pythian Oracle Consultant

© 2014 Pythian Confidential 15

CONSISTENT READ

Trans#1 – C - ! - SCN

1 ‘A’ ‘A’

2 ‘A’ ‘A’

3 ‘A’ ‘A’

4 ‘A’ ‘A’

Extent

Segment

Trans#3 – C - ! - SCN

Trans#4 – A - ! - SCN

1 ‘D’ ‘D’

2 ‘A’ ‘A’

3 ‘A’ ‘A’

4 ‘A’ ‘A’

Page 16: Best Practices to avoid ORA-01555 - Oracle · PDF fileBest Practices to avoid ORA-01555 Prepared by: Deiby Gómez Oracle Certified Master 11g Pythian Oracle Consultant

© 2014 Pythian Confidential 16

CONSISTENT READ

Trans#1 – C - ! - SCN

1 ‘A’ ‘A’

2 ‘A’ ‘A’

3 ‘A’ ‘A’

4 ‘A’ ‘A’

Trans#1 SCN > SCN we are looking for? <

Trans#3 – C - ! - SCN

Trans#4 – A - ! - SCN

1 ‘D’ ‘D’

2 ‘A’ ‘A’

3 ‘A’ ‘A’

4 ‘A’ ‘A’

1 ‘A’ ‘A’

Page 17: Best Practices to avoid ORA-01555 - Oracle · PDF fileBest Practices to avoid ORA-01555 Prepared by: Deiby Gómez Oracle Certified Master 11g Pythian Oracle Consultant

© 2014 Pythian Confidential 17

SNAPSHOT TOO OLD

Trans#3 – C - ! - SCN

Trans#4 – A - ! - SCN

1 ‘D’ ‘D’

2 ‘A’ ‘A’

3 ‘A’ ‘A’

4 ‘A’ ‘A’

Target SCN Current SCN

Trans#1 – C - ! - SCN

1 ‘A’ ‘A’

2 ‘A’ ‘A’

3 ‘A’ ‘A’

4 ‘A’ ‘A’

Page 18: Best Practices to avoid ORA-01555 - Oracle · PDF fileBest Practices to avoid ORA-01555 Prepared by: Deiby Gómez Oracle Certified Master 11g Pythian Oracle Consultant

© 2014 Pythian Confidential 18

SNAPSHOT TOO OLD

Trans#3 – C - ! - SCN

Trans#4 – A - ! - SCN

1 ‘D’ ‘D’

2 ‘A’ ‘A’

3 ‘A’ ‘A’

4 ‘A’ ‘A’

Trans#3 – C - ! - SCN

Trans#4 – A - ! - SCN

1 ‘D’ ‘D’

2 ‘A’ ‘A’

3 ‘A’ ‘A’

4 ‘A’ ‘A’

Trans#4 SCN > SCN we are looking for?

Page 19: Best Practices to avoid ORA-01555 - Oracle · PDF fileBest Practices to avoid ORA-01555 Prepared by: Deiby Gómez Oracle Certified Master 11g Pythian Oracle Consultant

© 2014 Pythian Confidential 19

SNAPSHOT TOO OLD

Trans#3 – C - ! - SCN

Trans#4 – A - ! - SCN

1 ‘D’ ‘D’

2 ‘A’ ‘A’

3 ‘A’ ‘A’

4 ‘A’ ‘A’

Extent

Segment

Trans#3 – C - ! - SCN

Trans#4 – A - ! - SCN

1 ‘D’ ‘D’

2 ‘A’ ‘A’

3 ‘A’ ‘A’

4 ‘A’ ‘A’

Trans#3 – C - ! - SCN

Trans#4 – A - ! - SCN

1 ‘C’ ‘C’

2 ‘A’ ‘A’

3 ‘A’ ‘A’

4 ‘A’ ‘A’

Page 20: Best Practices to avoid ORA-01555 - Oracle · PDF fileBest Practices to avoid ORA-01555 Prepared by: Deiby Gómez Oracle Certified Master 11g Pythian Oracle Consultant

© 2014 Pythian Confidential 20

SNAPSHOT TOO OLD

Trans#3 – C - ! - SCN

Trans#4 – A - ! - SCN

1 ‘D’ ‘D’

2 ‘A’ ‘A’

3 ‘A’ ‘A’

4 ‘A’ ‘A’

Trans#3 – C - ! - SCN

1 ‘C’ ‘C’

2 ‘A’ ‘A’

3 ‘A’ ‘A’

4 ‘A’ ‘A’

Extent

Segment

Trans#3 – C - ! - SCN

Trans#4 – A - ! - SCN

1 ‘D’ ‘D’

2 ‘A’ ‘A’

3 ‘A’ ‘A’

4 ‘A’ ‘A’

Page 21: Best Practices to avoid ORA-01555 - Oracle · PDF fileBest Practices to avoid ORA-01555 Prepared by: Deiby Gómez Oracle Certified Master 11g Pythian Oracle Consultant

© 2014 Pythian Confidential 21

SNAPSHOT TOO OLD

Trans#3 – C - ! - SCN

1 ‘C ‘C’

2 ‘D’ ‘D’

3 ‘D’ ‘D’

4 ‘D’ ‘D’

Extent

Segment

Trans#3 SCN > SCN we are looking for? >

Trans#3 – C - ! - SCN

Trans#4 – A - ! - SCN

1 ‘D’ ‘D’

2 ‘A’ ‘A’

3 ‘A’ ‘A’

4 ‘A’ ‘A’

Page 22: Best Practices to avoid ORA-01555 - Oracle · PDF fileBest Practices to avoid ORA-01555 Prepared by: Deiby Gómez Oracle Certified Master 11g Pythian Oracle Consultant

© 2014 Pythian Confidential 22

SNAPSHOT TOO OLD Extent

Segment

Trans#3 – C - ! - SCN

Trans#4 – A - ! - SCN

1 ‘D’ ‘D’

2 ‘A’ ‘A’

3 ‘A’ ‘A’

4 ‘A’ ‘A’

Trans#3 – C - ! - SCN

1 ‘B ‘B’

2 ‘D’ ‘D’

3 ‘D’ ‘D’

4 ‘D’ ‘D’

Page 23: Best Practices to avoid ORA-01555 - Oracle · PDF fileBest Practices to avoid ORA-01555 Prepared by: Deiby Gómez Oracle Certified Master 11g Pythian Oracle Consultant

© 2014 Pythian Confidential 23

SNAPSHOT TOO OLD

Trans#2 – C - ! - SCN

1 ‘B’ ‘B’

2 ‘D’ ‘D’

3 ‘D’ ‘D’

4 ‘D’ ‘D’

Extent

Segment

Trans#3 – C - ! - SCN

Trans#4 – A - ! - SCN

1 ‘D’ ‘D’

2 ‘A’ ‘A’

3 ‘A’ ‘A’

4 ‘A’ ‘A’

Page 24: Best Practices to avoid ORA-01555 - Oracle · PDF fileBest Practices to avoid ORA-01555 Prepared by: Deiby Gómez Oracle Certified Master 11g Pythian Oracle Consultant

© 2014 Pythian Confidential 24

SNAPSHOT TOO OLD

Trans#2 – C - ! - SCN

1 ‘B’ ‘B’

2 ‘D’ ‘D’

3 ‘D’ ‘D’

4 ‘D’ ‘D’

Extent

Segment

Trans#2 SCN > SCN we are looking for? >

Trans#3 – C - ! - SCN

Trans#4 – A - ! - SCN

1 ‘D’ ‘D’

2 ‘A’ ‘A’

3 ‘A’ ‘A’

4 ‘A’ ‘A’

Page 25: Best Practices to avoid ORA-01555 - Oracle · PDF fileBest Practices to avoid ORA-01555 Prepared by: Deiby Gómez Oracle Certified Master 11g Pythian Oracle Consultant

© 2014 Pythian Confidential 25

UNDO MANAGEMENT

There are now two modes of rollback segments management and usage:

•  AUTOMATIC •  MANUAL

When undo_management=AUTO: •  RDBMS creates undo segments when you create a new undo

tablespace •  RDBMS alters undo segments ONLINE/OFFLINE when you choose a

specific undo tablespace •  RDBMS drops undo segments when you drop an undo tablespace •  DBA can not manage the undo segments

•  You can only CREATE/DROP UNDO Tablespaces

Page 26: Best Practices to avoid ORA-01555 - Oracle · PDF fileBest Practices to avoid ORA-01555 Prepared by: Deiby Gómez Oracle Certified Master 11g Pythian Oracle Consultant

© 2014 Pythian Confidential 26

UNDO MANAGEMENT

Undo tablespace uses the following schema for extents:

•  Until segment size is 1M, 64K extents are allocated (16 such) •  Until segment size reaches 64M, 1M extents are allocated (63 such) •  Until segment size reaches 1G, 8M extents are allocated (120 such) •  Beyond 1G, 64M extents are allocated.

Automatic Undo Management in RAC

•  All instances within RAC must run in the same undo mode. •  Same value of undo_management in all instance.

•  Each instance requires its own undo tablespace. •  Set UNDO_TABLESPACE for the right undo tablespace for

each instance •  If UNDO_TABLESPACE parameter is not set, each instance uses

the first available undo tablespace.

Page 27: Best Practices to avoid ORA-01555 - Oracle · PDF fileBest Practices to avoid ORA-01555 Prepared by: Deiby Gómez Oracle Certified Master 11g Pythian Oracle Consultant

© 2014 Pythian Confidential 27

Oracle strongly recommends leaving the database in automatic undo management mode.

if manual undo management: Note 69464.1 Rollback Segment Configuration & Tips

Page 28: Best Practices to avoid ORA-01555 - Oracle · PDF fileBest Practices to avoid ORA-01555 Prepared by: Deiby Gómez Oracle Certified Master 11g Pythian Oracle Consultant

© 2014 Pythian Confidential 28

UNDO_RETENTION PARAMETER

Undo retention period is the minimum amount of time that Oracle Database attempts to retain old undo information before overwriting it.

•  ACTIVE (Uncommitted transaction) •  UNEXPIRED ( current time - transaction’s commit time<=retention period) •  EXPIRED ( current time - transaction’s commit time>retention period)

u The undo data is not required after a transaction is committed u Undo data is used for consistent reads u Undo data is used for some Flashback features

DBA_UNDO_EXTENTS --->STATUS

Page 29: Best Practices to avoid ORA-01555 - Oracle · PDF fileBest Practices to avoid ORA-01555 Prepared by: Deiby Gómez Oracle Certified Master 11g Pythian Oracle Consultant

© 2014 Pythian Confidential 29

UNDO TABLESPACE AUTOEXTEND ABOUT RETENTION TIME

•  Autoextend=YES •  Undo_retention is ignored. •  RDBMS tunes the retention time based on statistics gathered.

•  Autoextend=NO •  RDBMS tunes the retention to the highest possible value •  The value could be significantly greater than the duration of the longest-

running active query. •  If the undo tablespace is so big, then the undo retention time will so

large.

Note: It is NOT recommended to have a mix of AUTOEXTENSIBLE and NON-AUTOEXTENSIBLE files within an UNDO tablespace as this can cause tuned undo retention to miscalculate

Page 30: Best Practices to avoid ORA-01555 - Oracle · PDF fileBest Practices to avoid ORA-01555 Prepared by: Deiby Gómez Oracle Certified Master 11g Pythian Oracle Consultant

© 2014 Pythian Confidential 30

UNDO TABLESPACE AUTOEXTEND ABOUT RETENTION TIME

In some cases with undo tablespace is non-autoextensible, especially with large undo tablespace, This will make it to be calculated so large. To fix this behaviour, Set the following instance parameter: Set the parameter: _smu_debug_mode=33554432 With this setting:

•  Tuned undo retention time is not calculated based on a percentage of the fixed size undo tablespace.

•  Tuned undo retention time is set to the maximum of (MAXQUERYLEN secs + 300) and UNDO_RETENTION.

Page 31: Best Practices to avoid ORA-01555 - Oracle · PDF fileBest Practices to avoid ORA-01555 Prepared by: Deiby Gómez Oracle Certified Master 11g Pythian Oracle Consultant

© 2014 Pythian Confidential 31

UNDO TABLESPACE AUTOEXTEND ABOUT RETENTION TIME How do I know what is the current tuned retention time ?

TUNED_UNDORETENTION column of the V$UNDOSTAT view. •  The statistics are gathered each 10 minutes. (only 4 last days.) •  Beyond 4 days, the data is available in the DBA_HIST_UNDOSTAT view. •  TUNED_UNDORETENTION is given in seconds.

select to_char(begin_time, 'DD-MON-RR HH24:MI') begin_time, to_char(end_time, 'DD-MON-RR HH24:MI') end_time, tuned_undoretention from v$undostat order by end_time; BEGIN_TIME END_TIME TUNED_UNDORETENTION --------------- --------------- ------------------- 07-FEB-05 23:31 07-FEB-05 23:41 86700 07-FEB-05 23:41 07-FEB-05 23:51 86700 07-FEB-05 23:51 07-FEB-05 23:52 86700

Page 32: Best Practices to avoid ORA-01555 - Oracle · PDF fileBest Practices to avoid ORA-01555 Prepared by: Deiby Gómez Oracle Certified Master 11g Pythian Oracle Consultant

© 2014 Pythian Confidential 32

_UNDO_AUTOTUNE PARAMETER

If _undo_autotune=true (The default) •  RDBMS will tune the retention time and it will ignore undo_retention

parameter. Oracle uses autoextensible properties and statistics of long running queries, etc.

•  undo_retention parameter is set as the minimum value but this is not always true, DML’s has higher priority in the RDBMs and if one tracsaction needs more undo data even unexpired extents will be overwriten.

If _undo_autotune=false

•  RDBMS will not tune the retention time. undo_retention parameter sets the retention time. This

Page 33: Best Practices to avoid ORA-01555 - Oracle · PDF fileBest Practices to avoid ORA-01555 Prepared by: Deiby Gómez Oracle Certified Master 11g Pythian Oracle Consultant

© 2014 Pythian Confidential 33

UNDO TABLESPACE AUTOEXTEND ABOUT UNEXPIRED OVERWRITING

A New Extent is needed: If autoextend=false

if a new extent can be created? create new extent and use it. End. else if there is Expired extents to overwrite? Overwrite Expired extents else if there is Unexpired extents to overwrite? Overwrite Unexpired Extents else Fail. Undo tablespace needs more space.

else - - autoextend=true ....next slide.

Page 34: Best Practices to avoid ORA-01555 - Oracle · PDF fileBest Practices to avoid ORA-01555 Prepared by: Deiby Gómez Oracle Certified Master 11g Pythian Oracle Consultant

© 2014 Pythian Confidential 34

UNDO TABLESPACE AUTOEXTEND ABOUT UNEXPIRED OVERWRITING A New Extent is needed: else - - autoextend=true

if a new extent can be created? create new extent and use it. End. else if undo tablespace’s size = maxsize property? if there is Expired extents to overwrite? Overwrite Expired extents else if there is Unexpired extents to overwrite? Overwrite Unexpired Extents else Fail. Undo tablespace needs more space. else Autoextend a datafile !The real difference Create a new extent and use it.

Page 35: Best Practices to avoid ORA-01555 - Oracle · PDF fileBest Practices to avoid ORA-01555 Prepared by: Deiby Gómez Oracle Certified Master 11g Pythian Oracle Consultant

© 2014 Pythian Confidential 35

Oracle recommends to have autoextensible undo tablespace.

Health Check Alert: Consider using AUTOEXTEND for UNDO tablespaces (Doc ID 957424.1)

Page 36: Best Practices to avoid ORA-01555 - Oracle · PDF fileBest Practices to avoid ORA-01555 Prepared by: Deiby Gómez Oracle Certified Master 11g Pythian Oracle Consultant

© 2014 Pythian Confidential 36

RETENTION UNDO GUARANTEE

WARNING: Enabling retention guarantee can cause multiple DML operations to fail. Use with caution.

If retention guarantee is enabled •  The specified minimum undo retention is guaranteed •  The database never overwrites unexpired undo data even if it means

that transactions fail due to lack of space in the undo tablespace. •  This option is disabled by default.

If retention guarantee is not enabled: The database can overwrite unexpired undo extents when space is low Note: RDBMS never overwrites active undo extents.

Page 37: Best Practices to avoid ORA-01555 - Oracle · PDF fileBest Practices to avoid ORA-01555 Prepared by: Deiby Gómez Oracle Certified Master 11g Pythian Oracle Consultant

© 2014 Pythian Confidential 37

RETENTION UNDO GUARANTEE

If you have ( and you are really sure) enough undo space, you can use undo retention guarantee but if you use it then I recommend you to use it with _undo_autotune=false and a well tuned undo_retention parameter value.

Page 38: Best Practices to avoid ORA-01555 - Oracle · PDF fileBest Practices to avoid ORA-01555 Prepared by: Deiby Gómez Oracle Certified Master 11g Pythian Oracle Consultant

© 2014 Pythian Confidential 38

LOBS: IN-ROW & OUT-OF-ROW

u  In-row •  LOBs should be utilizing normal UNDO algorithms in the UNDO

tablespace.

u Out-of-row •  Use of PCTVERSION •  Use of RETENTION (current method for use with AUM)

Page 39: Best Practices to avoid ORA-01555 - Oracle · PDF fileBest Practices to avoid ORA-01555 Prepared by: Deiby Gómez Oracle Certified Master 11g Pythian Oracle Consultant

© 2014 Pythian Confidential 39

HOW TO IDENTIFY IF IT IS LOB?

ORA01555: snapshot too old: rollback segment number 9 with name "_SYSSMU9$" too small

ORA01555: snapshot too old: rollback segment number 9 with name “" too small

Master Note for ORA1555 Errors (Doc ID 1307334.1)

Page 40: Best Practices to avoid ORA-01555 - Oracle · PDF fileBest Practices to avoid ORA-01555 Prepared by: Deiby Gómez Oracle Certified Master 11g Pythian Oracle Consultant

© 2014 Pythian Confidential 40

LOBS: PCTVERSION & RETENTION

u Use of PCTVERSION (old method) •  Specify the maximum percentage of overall LOB storage space

used for maintaining old versions of the LOB. •  The default value is 10

o  Older versions of the LOB data are not overwritten until they consume 10% of the overall LOB storage space.

o  Frequent updates or deletes impacts tables with LOBs using pctversion

u Use of RETENTION (current method for use with AUM)

•  Oracle Database uses the value of the UNDO_RETENTION to determine the amount of committed undo data to retain in the database.

Page 41: Best Practices to avoid ORA-01555 - Oracle · PDF fileBest Practices to avoid ORA-01555 Prepared by: Deiby Gómez Oracle Certified Master 11g Pythian Oracle Consultant

© 2014 Pythian Confidential 41

LOBS: PCTVERSION & RETENTION

u Use of PCTVERSION (old method) •  Specify the maximum percentage of overall LOB storage space

used for maintaining old versions of the LOB. •  The default value is 10

o  Older versions of the LOB data are not overwritten until they consume 10% of the overall LOB storage space.

o  Frequent updates or deletes impacts tables with LOBs using pctversion

u Use of RETENTION (current method for use with AUM)

•  Oracle Database uses the value of the UNDO_RETENTION to determine the amount of committed undo data to retain in the database.

Page 42: Best Practices to avoid ORA-01555 - Oracle · PDF fileBest Practices to avoid ORA-01555 Prepared by: Deiby Gómez Oracle Certified Master 11g Pythian Oracle Consultant

© 2014 Pythian Confidential 42

Recommendation Check if your Tables with Lobs have so frequent modifications

Page 43: Best Practices to avoid ORA-01555 - Oracle · PDF fileBest Practices to avoid ORA-01555 Prepared by: Deiby Gómez Oracle Certified Master 11g Pythian Oracle Consultant

© 2014 Pythian Confidential 43

LOBS: UNDO_RETENTION NO UPDATED

SQL> show parameters undo_retention NAME TYPE VALUE ----------------------- ----------- ------------------------------ undo_retention integer 60 SQL> create table LobWithRetention (col1 number, col2 blob) LOB ( col2 ) STORE AS ( retention); Table created. select table_name, segment_name, pctversion, retention from dba_lobs where owner='DGOMEZ' and retention is not null; TABLE_NAME SEGMENT_NAME PCTVERSION RETENTION -------------------------- ------------------------- ---------- ---------- LOBWITHRETENTION SYS_LOB0000087573C00002$$ 60

Page 44: Best Practices to avoid ORA-01555 - Oracle · PDF fileBest Practices to avoid ORA-01555 Prepared by: Deiby Gómez Oracle Certified Master 11g Pythian Oracle Consultant

© 2014 Pythian Confidential 44

SQL> alter system set undo_retention=120 scope=both; System altered. SQL> show parameters undo_retention NAME TYPE VALUE ---------------------- ----------- ------------------------------ undo_retention integer 120 SQL> SQL> select table_name, segment_name, pctversion, retention from dba_lobs where owner='DGOMEZ' and retention is not null; TABLE_NAME SEGMENT_NAME PCTVERSION RETENTION ------------------------ --------------------------- ---------- ---------- LOBWITHRETENTION SYS_LOB0000087573C00002$$ 60

LOBS: UNDO_RETENTION NO UPDATED

Page 45: Best Practices to avoid ORA-01555 - Oracle · PDF fileBest Practices to avoid ORA-01555 Prepared by: Deiby Gómez Oracle Certified Master 11g Pythian Oracle Consultant

© 2014 Pythian Confidential 45

LOBS: UNDO_RETENTION NO UPDATED

SQL> alter table LobWithRetention modify LOB ( col2 ) ( pctversion 5); Table altered. SQL> alter table LobWithRetention modify LOB ( col2 ) ( retention); Table altered. SQL> select table_name, segment_name, pctversion, retention from dba_lobs where owner='DGOMEZ' and retention is not null; TABLE_NAME SEGMENT_NAME PCTVERSION RETENTION ------------------------ --------------------------- ---------- ---------- LOBWITHRETENTION SYS_LOB0000087573C00002$$ 120

Page 46: Best Practices to avoid ORA-01555 - Oracle · PDF fileBest Practices to avoid ORA-01555 Prepared by: Deiby Gómez Oracle Certified Master 11g Pythian Oracle Consultant

© 2014 Pythian Confidential 46

LOBS: UNDO_RETENTION IGNORED

•  if the LOB resides in a tablespace using MANUAL space management (MSSM) the Lob Retention parameter is ignored.

•  Automatic Segment Space Managemetn (ASSM) should be used in order to honour the lob retention parameter.

select tablespace_name, extent_management, segment_space_management from dba_tablespaces where tablespace_name in (select tablespace_name from dba_segments where owner=’<owner>' and segment_name=’<segmentName>');

Page 47: Best Practices to avoid ORA-01555 - Oracle · PDF fileBest Practices to avoid ORA-01555 Prepared by: Deiby Gómez Oracle Certified Master 11g Pythian Oracle Consultant

© 2014 Pythian Confidential 47

SCRIPT - UNDO INFORMATION Script - Check Current Undo Configuration and Advise Recommended Setup (Doc ID 1579035.1)

Page 48: Best Practices to avoid ORA-01555 - Oracle · PDF fileBest Practices to avoid ORA-01555 Prepared by: Deiby Gómez Oracle Certified Master 11g Pythian Oracle Consultant

© 2014 Pythian Confidential 48

THE UNDO ADVISOR PL/SQL INTERFACE

Output: Automatic Database Diagnostic Monitor in Enterprise Manager DBA_ADVISOR_*

•  DBA_ADVISOR_TASKS •  DBA_ADVISOR_OBJECTS •  DBA_ADVISOR_FINDINGS •  DBA_ADVISOR_RECOMMENDATIONS •  ETC.

Page 49: Best Practices to avoid ORA-01555 - Oracle · PDF fileBest Practices to avoid ORA-01555 Prepared by: Deiby Gómez Oracle Certified Master 11g Pythian Oracle Consultant

© 2014 Pythian Confidential 49

Questions? Twitter: @hdeiby Facebook: /HDeiby Email: [email protected] Blog: www.oraclefromguatemala.com.gt