J'essaie de trouver la colonne (ou la table) qui appartient à un segment LOB assez gros:
select segment_name, segment_type, bytes
from dba_segments
where segment_name = 'SYS_LOB0000103936C00014$$';
retour:
SEGMENT_NAME | SEGMENT_TYPE | BYTES
--------------------------+--------------+-------------
SYS_LOB0000103936C00014$$ | LOBSEGMENT | 422877069312
Cependant, lorsque j'essaie de trouver le tableau correspondant:
select table_name, column_name, segment_name, tablespace_name, index_name
from dba_lobs
where segment_name = 'SYS_LOB0000103936C00014$$';
Aucune ligne n'est renvoyée.
Y a-t-il un autre endroit où les informations sur ce segment LOB sont stockées?
Il s'agit d'un Oracle 11.2.0.4 (RAC) exécutant RHEL 6.8
Une raison possible est de rendre une colonne LOB inutilisable:
SQL> create table t1 (c1 number, c2 clob);
Table created.
SQL> insert into t1 values (1, 'A');
1 row created.
SQL> commit;
Commit complete.
SQL> select segment_name from dba_lobs where table_name = 'T1' and column_name = 'C2';
SEGMENT_NAME
------------------------------
SYS_LOB0000015673C00002$$
SQL> select segment_name from dba_segments where segment_name = 'SYS_LOB0000015673C00002$$';
SEGMENT_NAME
--------------------------------------------------------------------------------
SYS_LOB0000015673C00002$$
SQL> alter table t1 set unused column c2;
Table altered.
SQL> select table_name, column_name from dba_lobs where segment_name = 'SYS_LOB0000015673C00002$$';
no rows selected
SQL> select segment_name from dba_segments where segment_name = 'SYS_LOB0000015673C00002$$';
SEGMENT_NAME
--------------------------------------------------------------------------------
SYS_LOB0000015673C00002$$
Pour trouver la table à laquelle appartient la colonne LOB orpheline:
select u.name, o.name TABLENAME, decode(bitand(c.property, 1), 1, ac.name, c.name) as column_name
from sys.obj$ o, sys.col$ c, sys.attrcol$ ac,sys.lob$ l,sys.obj$ lo,sys.obj$ io,
sys.user$ u,sys.ts$ ts
where o.owner# = u.user#
and o.obj# = c.obj#
and c.obj# = l.obj# and c.intcol# = l.intcol#
and l.lobj# = lo.obj# and l.ind# = io.obj# and l.ts# = ts.ts# and c.obj# =
ac.obj#(+)
and c.intcol# = ac.intcol#(+) and lo.name ='SYS_LOB0000015673C00002$$';
NAME TABLENAME COLUMN_NAME
------------------------------ ------------------------------ --------------------------------
BP T1 SYS_C00002_16120712:10:58$
Pour supprimer la colonne et le segment LOB:
SQL> alter table t1 drop unused columns;
Table altered.
SQL> select segment_name from dba_segments where segment_name = 'SYS_LOB0000015673C00002$$';
no rows selected
Basé sur: Lobs orphelins après avoir marqué la colonne LOB non utilisée (Doc ID 461651.1)