2016-10-21
Page 1/9
500340 - FAQ: LOBS
Version
20
Type
SAP Note
Language
English
Master Language
English
Priority
Recommendations / Additional Info
Category
FAQ
Release Status
Released for Customer
Released On
18.10.2014
Component
BC-DB-ORA (Oracle)
Please find the original document at [Link]
Symptom
1. What is a LOB?
2. Are there different types of LOBs?
3. When did SAP started to use LOBS?
4. Why are LOBs used?
5. Which SAP tables use LOBs?
6. How can I display LOB information?
7. Which ABAP dictionary datatypes are represented by LOBs on DB?
8. How is an example table with a LOB created on database level?
9. How is the storage clause of a LOBSEGMENT or LOBINDEX set and changed?
10. What should I consider when I get an ora-1658 during creation of a table
containing LOB columns?
11. Can BR*Tools handle LOBs?
12. How is a LOB exported?
13. Is LOB data cached in the buffer cache?
14. What are the differences between LOBs and other segments regarding undo
handling?
15. How can I identify whether PCTVERSION or RETENTION is configured for a
lob segment?
16. What do I have to take into consideration when reorganizing a lob segment
that has RETENTION set?
17. Where do temporary LOBs come from?
18. What are known problems regarding LOBs?
19. Where can I get further information about LOBs?
Other Terms
LOB BLOB CLOB NCLOB BFILE SYS_LOB...$$ SYS_LOB$$ RAWSTRING STRING
LOBSEGMENT LOBINDEX ora-1658
Solution
1. What is a LOB?
The LOB (Large OBject) datatypes enable you to store large blocks of
unstructured data up to four gigabytes in size in a table column.
The data stored in a LOB column can be stored within the table itself or
in an extra object outside of the table - a segment of type LOBSEGMENT.
To access the data efficently a segment of type LOBINDEX is created.
If during table creation the option 'enable storage in row' is used for a
lob column the lob column value is stored within the table if it is less
than approx 4000 Bytes. If above it is stored in the extra lob segment.
'enable storage in row' is the default used by SAP.
If during table creation the option 'disable storage in row' is used the
data is in any case stored in the extra lob segment.
2016 SAP SE or an SAP affiliate company. All rights reserved
2016-10-21
Page 2/9
For exporting or copying a table containing lobs consider that not only
the table size needs to be considered but also the size of all
dependendlob objects (see 6. for a statement collecting the sizes of all
these objects).
2. Are there different types of LOBs?
Yes,
BLOB: Binary LOBs
CLOB: Character LOBs
NCLOB: National Character LOBs
BFILE: Binary File
3. When did SAP started to use LOBS?
Starting with release 6.10 large amount of data can be stored in
tablecolumns of a LOB type.
4. Why are LOBs used?
LOBs have advantages compared with the LONG RAW or LONG datatype formerly
used:
a table can have many LOB columns but only one LONG column
partitioning can be used
LOBs can have a size of 4GB - LONG only 2GB
LOB data can be accessed randomly and not only sequentially
OLTP Table Compression is NOT supported for use with tables that have LONG
data types. For further information about 'Advanced Compression with Oracle
Database 11g' see SAP note 1436352.
5. Which SAP tables use LOBs?
To find out all tables and their columns using LOBS use this sql
statement:
select table_name, column_name from dba_lobs where owner = '<sapuser>';
For example the tables DYNPSOURCE, DYNPLOAD, REPOSRC, REPOLOAD are using
LOBs.
6. How can I display LOB information?
LOBs can have a nonabstract name but usually have a name like
'SYS_LOB0000003619C00002$$' in SAP environment
If you want to know to which table and which column a LOB object belongs
or vice versa you can query dba_lobs:
dba_lobs: table_name, column_name, segment_name (=lobsegment name),
index_name(=lobindex name)
If you want to find out more about the storage parameters of a LOBSEGMENT
or LOBINDEX query dba_segments.
2016 SAP SE or an SAP affiliate company. All rights reserved
2016-10-21
Page 3/9
Examples:
a) Has a table lob columns, which ones, what is the name of the
corresponding lob objects and how much space is allocated for the
table and the lob objects (replace 'SAPR3' and 'REPOLOAD')
select
l.segment_name,
l.column_name,
sl.segment_type,
[Link]
from
dba_lobs l,
dba_segments sl
where
[Link] = 'SAPR3' and
l.table_name = 'REPOLOAD' and
[Link]=[Link] and
sl.segment_name in (l.segment_name, l.index_name)
union (
select
segment_name,
null,
segment_type,
sum(bytes) bytes
from
dba_segments
where
owner = 'SAPR3' and
segment_name = 'REPOLOAD' and
segment_type in ('TABLE','TABLE PARTITION')
group by
segment_name,
segment_type
);
b) What is the table belonging to a lob object (replace
SYS_LOB0000004066C00014$$)
select owner, table_name from dba_lobs
where 'SYS_LOB0000004066C00014$$' in (segment_name, index_name);
7. Which ABAP dictionary datatypes are represented by LOBs on DB?
dictionary | database
------------------------RAWSTRING | BLOB
STRING | CLOB
8. How is an example table with a LOB created on database level?
2016 SAP SE or an SAP affiliate company. All rights reserved
2016-10-21
Page 4/9
create table lobtable (first_column varchar2(10), lob_column BLOB)
tablespace psapuser1d
storage (initial 100k next 100k pctincrease 0 maxextents 300)
lob (lob_column) store as (
enable storage in row
tablespace psapuser1d
storage (initial 3M next 3M pctincrease 0 maxextents 300));
9. How is the storage clause of a LOBSEGMENT or LOBINDEX set and changed?
LOBSEGMENT
create alter
initial as specified --next as specified as specified 2)
maxextents as specified as specified
pctincrease as specified as specified 1)
tablespace as specified ---
LOBINDEX
create alter
initial as lob segment --next default initial of TS of lob segm. see create 2)
maxextents unlimited unlimited
pctincrease as lob segment via lob segment 1)
tablespace as lob segment ---
'as specified' means as specified in the create/alter statement for the
table
1) alters pctincrease from lobindex to the same value
2) alters nextextent size of lobindex also to the default initial of TS
of lob segm.
To modify the lobsegments storage parameter use:
alter table <table> modify lob (<lobcolumn>) (storage (...));
Keep in mind that for locally managed tablespaces you dont
have to adapt the storage clause.
10. What should I consider when I get an ora-1658 during creation of a
table containing LOB columns?
On dictionary managed tablespaces:
If for the LOBSEGMENT or the LOBINDEX no storage clause is specified
during creation time of the object containing these LOB objects, the
tablespace defaults may be choosen. If the tablespace defaults are set
too high consequently an ora-1658 may be fired. Change the tablespace
defaults (initial_extent, next_extent) to a lower value then.
You can monitor the tablespace defaults with:
select tablespace_name, initial_extent, next_extent from dba_tablespaces;
2016 SAP SE or an SAP affiliate company. All rights reserved
2016-10-21
Page 5/9
You can change the tablespace defaults with:
alter tablespace <tablespace_name> default storage (initial <default
initial size> next <default next size>);
On locally managed tablespaces changing defaults is not necessary. If you
get the error anyway you have to less space available. Add or resize a
datafile.
11. Can BR*Tools handle LOBs?
Yes. All current releases of BR*Tools are able to handle lobs.
12. How is a LOB exported?
Implicitly together with the table it belongs to. Only conventional path
export - not direct path export - is possible. If you try direct path
export EXP-00067 occurs.
13. Is LOB data cached in the buffer cache?
If the data of a lob column is cached or not depends on how the value
CACHE is set in DBA_LOBS for this column. If it is set to 'NO', direct
reads bypassing the buffer cache are performed. This is the Oracle
default.
Advantage of caching is that lobdata to be accessed several times need
not to be read from disk several times. Disadvantage is that lobdata to
be accessed only once fills the buffer cache so that the overall
responsetime of DB may get worse because of buffer displacement of other
data. Frequent changes of CACHED LOB data may lead to many dirty blocks
in the buffercache and a potential risk of overloading the DBWR processes
especially during checkpoints.
Caching can be switched on/off with:
ALTER TABLE <table_name> MODIFY LOB ("<lob_column>") (CACHE/NOCACHE);
Note 893441 can be implemented, so that also the SAP Data Dictionary supports
the creation of cached LOBs.
A mass switch on/off of lob caching can be done as described in note 563359.
14. What are the differences between LOBs and other segments regarding
undo handling?
If the data stored in a lobsegment is changed, the before images are NOT
stored in undo segments but in the lobsegment itself. In addition during
an update the new data does not overwrite the old data but is placed in
other blocks to keep the before image where it is. This is done to avoid
overhead by copying a large amount of data. After the changes are
commited the before images are kept in the lobsegment depending on the
storage parameters PCTVERSION and RETENTION.
PCTVERSION can be set individually for each lobsegment and indicates how
much of the already occupied space of the lobsegment should be kept to
store before images. PCTVERSION is the default for objects created in a
DB instance using manual undo management (undo_management = manual).
2016 SAP SE or an SAP affiliate company. All rights reserved
2016-10-21
Page 6/9
The following values for PCTVERSION mean:
0: do not reserve any space in the lobsegment for read consistency
10: default; reserve 10% of the space for committed before images
100: reserve all space currently allocated for commited before images
Consequences of this storage behavior are:
an update that shrinks only values in a lob column needs to extend the
corresponding lobsegment because the new value in the lob column does not
overwrite the old value but is placed in the lobsegment additionally.
Possible errors:
ORA-01693: max # extents ... reached in lob segment ...
ORA-01691: unable to extend lob segment ... by ... in tablespace ...
Those errors can be handled in the normal way by increasing the
maxextents/nextextentsize respectively the tablespace size.
Other changes to a lobsegment may fail although there is theoretical space
available occupied by committed before images
A lobsegment is in worst case factor 100/(100-<PCTVERSION>) larger than
neccessary to store the current data
A large PCTVERSION reduces the likelihood of an ora-1555 but leads to
larger lobsegment. For PCTVERSION=100 space allocated by commited before
images is never freed.
If a read cannot be executed consistent the following errors are fired:
ORA-01555: snapshot too old: rollback segment number with name "" too
small
ORA-22924: snapshot too old
The ora-01555 neither contain a number for a rollbacksegment nor a
rollbacksegment name.
Optimize the select running into the ora-01555. If this is already optimized
increase the PCTVERSION with
alter table <table> modify lob (<lob column>) (pctversion <new value>);
In case automatic undo management is enabled, the default for newly created
database objects is RETENTION. This means that the lobsegment will keep the
before images for a period of time rather then using a fixed percentage of space
in the logsegment. By default, the storage parameter RETENTION is set to the
value of the DB parameter undo_retention.
If a consistent read is failing with the error ORA-01555 / ORA-22924 because a
required before image is no longer available, then increasing the parameter
undo_retention will NOT lead to before images being stored in the lob segment
for a longer period of time. RETENTION will change to the value of the parameter
undo_retention only if a lobsegment is (re)created or explictly altered with the
command
alter table <table> modify lob (<lob column>) (retention);
This means that in case of Oracle 10, there is no possibility to explictly set
RETENTION for a particular lobsegment. This behaviour changes with Oracle 11
when Securefile Lobs are in use.
RETENTION and PCTVERSION are mutually exclusive, only one of the two storage
parameters can be set for a lobsegment.
2016 SAP SE or an SAP affiliate company. All rights reserved
2016-10-21
Page 7/9
Further information regarding undo management can be found in Oracle Metalink
document 162345.1
15. How can I identify whether PCTVERSION or RETENTION is configured for a
lob segment?
This can be done with the following SQL statement:
select nvl(to_char(pctversion),'NULL') pctversion,
nvl(to_char(retention),'NULL') retention
from dba_lobs
where segment_name = '<LOB SEGMENT NAME>';
The storage clause that is currently not set for the segment will return a NULL
value.
16. What do I have to take into consideration when reorganizing a lob segment
that has RETENTION set?
The API that is provided via the package DBMS_METADATA which is used to generate
the DDL statements for DB objects omitts the RETENTION storage clause in order
to achieve compatibility to DB instances that are not using automatic undo
management. Instead, the generated statement will always contain the default
PCTVERSION 10. Since this functionality is used both for offline reorganizations
via exp/imp respectivly expdp/impdp and online reorganizations done via the
BR*Tools, you should consider to set RETENTION to the desired value again
afterwards.
17. Where do temporary LOBs come from?
Under some circumstances it can happen that PSAPTEMP is filled with a
significant amount of temporary LOBs. This can be verified with the
V$TEMPORARY_LOBS view.
These temporary LOBs are created in SAP J2EE due to technical reasons (guarantee
of atomicity of LOB creation) whenever a new LOB is created. In situations with
a high LOB creation rate (e.g. when tables with LOBs are imported in the
database) this behaviour can be responsible for a significant filling level or
an overflow of PSAPTEMP.
18. What are known problems regarding LOBs?
Segment shrinking on Objects with LOB columns can lead to corruptions on
release [Link]. (note 1021454). Do not use segment shrinking on this
release without having the bugfix of note 1021454 applied.
Korruptions on LOBs can be indicated by ORA-22924.
Recovery of changes to a LOB can lead to corruptions
note 983230: Oracle Release 9.2.0.n (n <= 7) or [Link]
note 567866: Oracle Release [Link] or 9.2.0.n (n <=2)
Korruptions on LOBs can be indicated by ORA-22924.
NON-Cached LOB data that is read multiple times need to be read from disk
several times. Cached LOB data that is changed can lead to performance
problems especially during checkpoints. See FAQ: "Is LOB data cached in the
buffer cache?" for details
19. Where can I get further information about LOBs?
2016 SAP SE or an SAP affiliate company. All rights reserved
2016-10-21
Page 8/9
Further information about LOBS can be found in the Oracle documentation.
This document refers to
SAP Note/KBA
Title
893441
Adjustment of SDB2FORA for the caching of LOBs
666061
FAQ: Database objects, segments, and extents
659946
FAQ: Temporary tablespaces
656374
EXP-00067: Table will be exported in conventional path.
618868
FAQ: Oracle performance
533455
Terminations due to higher number of extents
3807
Error messages regarding rollback and undo segments
3155
Termination due to tablespace overflow
1818320
Oracle 11g Advanced Compression for LONG data restriction
1436352
Oracle Database 11g Advanced Compression for SAP Systems
This document is referenced by
SAP Note/KBA
Title
1436352
Oracle Database 11g Advanced Compression for SAP Systems
666061
FAQ: Database objects, segments, and extents
618868
FAQ: Oracle performance
1818320
Oracle 11g Advanced Compression for LONG data restriction
659946
FAQ: Temporary tablespaces
3155
Termination due to tablespace overflow
3807
Error messages regarding rollback and undo segments
533455
Terminations due to higher number of extents
893441
Adjustment of SDB2FORA for the caching of LOBs
656374
EXP-00067: Table will be exported in conventional path.
2016 SAP SE or an SAP affiliate company. All rights reserved
2016-10-21
Page 9/9
Terms of use | Copyright | Trademark | Legal Disclosure | Privacy
2016 SAP SE or an SAP affiliate company. All rights reserved