How To Identify LOB Segment Use PCTVERSION Or RETENTION From Data Dictionary (Doc ID 422826.1)
| Goal |
| Solution |
| References |
APPLIES TO:
Oracle Database - Enterprise Edition - Version 9.2.0.4 to 10.2.0.5.0 [Release 9.2 to 10.2]Oracle Database Cloud Schema Service - Version N/A and later
Gen 1 Exadata Cloud at Customer (Oracle Exadata Database Cloud Machine) - Version N/A and later
Oracle Cloud Infrastructure - Database Service - Version N/A and later
Oracle Database Cloud Exadata Service - Version N/A and later
Information in this document applies to any platform.
Oracle Server Enterprise Edition - Version: 9.0.1.4 to 9.2.0.8
GOAL
The Purpose of this Note Is To explain the behavior of PCTVERSION and RETENTION in LOB Segments.
The Following Example shows the issue.
Create a LOB specifying PCTVERSION = 5 and create another one specifying RETENTION.
When query DBA_LOBS, would not expect to see default PCTVERSION = 10 when RETENTION was specified.
SQL> CREATE TABLE lobpctversion
(LOBLOC blob,id NUMBER)
LOB ( lobLoc ) STORE AS
(TABLESPACE users STORAGE (INITIAL 5k NEXT 5k PCTINCREASE 0) pctversion 5);
Table created.
SQL> CREATE TABLE lobretention
(LOBLOC blob,id NUMBER)
LOB ( lobLoc ) STORE AS
(TABLESPACE users STORAGE (INITIAL 5k NEXT 5k PCTINCREASE 0) retention);
Table created.
SQL> select table_name, segment_name, pctversion, retention
from dba_lobs where table_name in ('LOBPCTVERSION', 'LOBRETENTION');
TABLE_NAME SEGMENT_NAME PCTVERSION RETENTION
----------------- --------------------------- ---------- ---------
LOBPCTVERSION SYS_LOB0000096861C00001$$ 5 10800
LOBRETENTION SYS_LOB0000096864C00001$$ 10 10800
> />see that both PCTVERSION and RETENTION columns have values
As You can see, would expect table named LOBRETENTION to clearly show 0 for PCTVERSION since RETENTION was specified. Likewise, LOBPCTVERSION should show only PCTVERSION. So when query DBA_LOBS down the road would have no indication which is truly active.
Also if You Change the Storage Parameters the Dictionary does not change.
> />
SQL> alter table lobretention modify lob(lobLoc) (pctversion 5); Table altered. SQL> select table_name, segment_name, pctversion, retention from dba_lobs where table_name = 'LOBRETENTION'; TABLE_NAME SEGMENT_NAME PCTVERSION RETENTION ----------------- --------------------------- ---------- --------- LOBRETENTION SYS_LOB0000096864C00001$$ 5 10800
see the change in value under PCTVERSION, but both PCTVERSION and RETENTION columns are populated.
SOLUTION
This Issue Identified as Bug 3844939 and its fixed in 10.2 and higher
There is Work Around to Identify Which Truly Active Value PCTVERSION OR RETENTION , by Running The Following Query :
select bitand(flags,32) from sys.lob$ where OBJ#= (select OBJECT_ID from dba_objects where OWNER=<schema> and OBJECT_NAME='<table_name>');
if the output is 0 then its PCTVERSION , if its 32 then its RETENTION
Or
(OWNER, TABLE_NAME, COLUMN_NAME, PCTVERSION, RETENTION)
as
select u.name, o.name,
decode(bitand(c.property, 1), 1, ac.name, c.name),
decode(bitand(l.flags, 32), 0, l.pctversion$, to_number(NULL)),
decode(bitand(l.flags, 32), 32, l.retention, to_number(NULL))
from sys.obj$ o, sys.col$ c, sys.attrcol$ ac, sys.lob$ l,
sys.user$ u
where o.owner# = u.user#
and o.obj# = c.obj#
and c.obj# = l.obj#
and c.intcol# = l.intcol#
and c.obj# = ac.obj#(+)
and c.intcol# = ac.intcol#(+)
and bitand(c.property,32768) != 32768 /* not unused column */
;
select * from DBA_LOB_RETENTION where TABLE_NAME='<table_name>' ;
The RETENTION parameter is designed for use with Undo features of the database, such as Flashback Versions Query. When a LOB column has the RETENTION property set, old versions of the LOB data are retained for the amount of time specified by the UNDO_RETENTION parameter.
You Cannot Specify Both PCTVERSION and RETENTION for LOBs Creation.
Also You Cannot Specify RETENTION if the Database is Running in Manual Undo Mode.
PCTVERSION :
Specify the maximum percentage of overall LOB storage space to be used for maintaining old versions of the LOB. The default value is 10, meaning that older versions of the LOB data are not overwritten until 10% of the overall LOB storage space is used.
RETENTION :
If the database is in automatic undo mode, then you can specify RETENTION instead of PCTVERSION to instruct Oracle to retain old versions of this LOB. This clause overrides any prior setting of PCTVERSION. NOTE: RETENTION will remain constant in DBA_LOBS even after subsequent changes to UNDO_RETENTION. However, LOB undo should take into affect changes to the parameter UNDO_RETENTION over time.
REFERENCES
BUG:4231990 - NOT POSSIBLE TO IDENTIFY VERSION RETENTION STRATEGY OF A LOB SEGMENTNOTE:415845.1 - Lob Segment Size Increases in Dictionary Managed Tablespace: Freelist Blocks Are Not Used
BUG:3844939 - DBA_LOBS COLUMNS RETENTION AND PCTVERSION CONTAIN WRONG VALUES
Comments
Post a Comment