LOB 段在 DBA_SEGMENTS 中列出,但在 DBA_LOBS 中没有对应的行

a_h*_*ame 6 oracle

我正在尝试查找属于相当大的 LOB 段的列(或表):

select segment_name, segment_type, bytes 
from dba_segments 
where segment_name = 'SYS_LOB0000103936C00014$$';
Run Code Online (Sandbox Code Playgroud)

返回:

select segment_name, segment_type, bytes 
from dba_segments 
where segment_name = 'SYS_LOB0000103936C00014$$';
Run Code Online (Sandbox Code Playgroud)

但是,当我尝试查找相应的表时:

select table_name, column_name, segment_name, tablespace_name, index_name 
from dba_lobs 
where segment_name = 'SYS_LOB0000103936C00014$$';
Run Code Online (Sandbox Code Playgroud)

不返回任何行。

是否还有其他位置存储有关该 LOB 段的信息?

这是运行 RHEL 6.8 的 Oracle 11.2.0.4 (RAC)

Bal*_*app 6

一种可能的原因是将 LOB 列设置为不可用:

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$$
Run Code Online (Sandbox Code Playgroud)

要查找孤立的 LOB 列所属的表:

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$
Run Code Online (Sandbox Code Playgroud)

要删除列和 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
Run Code Online (Sandbox Code Playgroud)

基于:将 LOB 列标记为未使用后的孤立 Lobs(文档 ID 461651.1)