暂无图片
暂无图片
暂无图片
暂无图片
暂无图片

Oracle 寻找解压缩lob的另一种方法

ASKTOM 2020-11-12
779

问题描述

嗨,我正在尝试使用 “alter table” 解压缩下一个lob:

所有者表 _ 名称列 _ 名称COMPRE
-
ALTIUS_AS_OWNER调查XML_AVAIL MEDIUM

alter table ALTIUS_AS_OWNER.SURVEY MODIFY LOB (XML_AVAIL) (NOCOMPRESS KEEP_DUPLICATES) PARALLEL 4;


但是它花费了很多时间,超过8个小时,并导致表上的锁定,问题是,我可以使用DBMS_REDEFINITION包解压缩列而不会导致表上的锁定吗?

如果这样,这句话会好吗?


 'ALTIUS_AS_OWNER',
     tname                        => 'SURVEY',
     table_compression_type       => 'NULL',
     table_part_tablespace        => 'NULL',
     index_key_compression_type   => 'NULL',
     index_tablespace             => 'NULL',
     lob_compression_type         => 'COMPRESS NONE',
     lob_tablespace               => 'NULL',
     lob_store_as                 => 'NULL');
END;>

专家解答

几乎 :-)


SQL>
SQL> create table t ( x int , c clob ) lob ( c ) store as securefile (compress medium );

Table created.

SQL>
SQL> insert into t
  2  select trunc(rownum/1000), listagg(owner,' ') within group ( order by object_id )
  3  from dba_objects
  4  group by trunc(rownum/1000);

88 rows created.

SQL>
SQL> select dbms_lob.getlength(c) from t;

DBMS_LOB.GETLENGTH(C)
---------------------
                 6095
                 6327
                 6804
                 6218
                 6395
                 6338
                11031
                11999
                11983
                11999
                 9648
                 8698
                11999
                11991
                11999
                10217
                 7117
                11442
                11999
                11991
                11999
                 2317
                 4031
                 4575
                 5499
                 5499
                 5466
                 5424
                 4803
                 5232
                 4715
                 5319
                 4647
                 4872
                 5415
                 5112
                 5605
                 4968
                 4179
                 5337
                 4626
                 4386
                 6516
                 4473
                 5446
                 3999
                 3999
                 3999
                 3999
                 3999
                 3999
                 3999
                 4208
                 3999
                 3999
                 3999
                 3999
                 3999
                 3999
                 3999
                 3999
                 3999
                 3999
                 3999
                 3999
                 3999
                 3999
                 3999
                 3999
                 3999
                 3999
                 3999
                 3999
                 3999
                 3999
                 3999
                 3999
                 3999
                 3999
                 4173
                 5563
                 4443
                 6468
                 5835
                 7168
                 6632
                 6296
                 6091

88 rows selected.

SQL>
SQL> insert into t
  2  select fac+x, c
  3  from ( select level*100 fac from dual connect by level <= 100 ), t;

8800 rows created.

SQL>
SQL> alter table t add primary key ( x ) ;

Table altered.

SQL>
SQL> select bytes
  2  from dba_segments
  3  where segment_name in ( select SEGMENT_NAME
  4  from user_lobs
  5  where table_name = 'T' );

     BYTES
----------
    131072

SQL>
SQL> BEGIN
  2     DBMS_REDEFINITION.REDEF_TABLE(
  3       uname                        => user,
  4       tname                        => 'T',
  5       lob_compression_type         => 'NOCOMPRESS',
  6       lob_store_as                 => 'SECUREFILE');
  7  END;
  8  /

PL/SQL procedure successfully completed.

SQL>
SQL> select bytes
  2  from dba_segments
  3  where segment_name in ( select SEGMENT_NAME
  4  from user_lobs
  5  where table_name = 'T' );

     BYTES
----------
 151126016

SQL>
SQL>


文章转载自ASKTOM,如果涉嫌侵权,请发送邮件至:contact@modb.pro进行举报,并提供相关证据,一经查实,墨天轮将立刻删除相关内容。

评论