如何在 Oracle 中压缩 XML(CLOB 数据)?

How to compress XML (CLOB data) in Oracle?

甲骨文 11.2.0.4

我试图通过 java class 方法 href 压缩 XML (XMLTYPE dbfield): LOB compression

class编译成功

SELECT  OBJECT_NAME,
        OBJECT_TYPE
    FROM DBA_OBJECTS
    WHERE OBJECT_NAME LIKE '%LobCompress%'
    ORDER BY 1;
-------------------

OBJECT_NAME OBJECT_TYPE
LobCompressor   JAVA CLASS
LobCompressor   JAVA SOURCE

但是调用此方法时RT出现错误:

DECLARE
dr MY_USER.ORDER_CONFIG%ROWTYPE;
bZipped BLOB;
...
SELECT * INTO dr
            FROM MY_USER.ORDER_CONFIG oc
            WHERE oc.ORDER_NO = '3751017';


bZipped := MY_USER.PKG_COMPRESSOR.CLOB_COMPRESS(dr.CONFIG_XML);

ORA-29540: class LobCompressor does not exist ORA-06512: at "MY_USER.PKG_COMPRESSOR", line 10 ORA-06512: at "MY_USER.PKG_COMPRESSOR", line 39 ORA-06512: at line 13

dr.CONFIG_XML 不为空/不为空值

我需要做什么才能正确运行脚本?

PS 这是我第一次尝试在 pl sql

中使用 java class

我认为现在压缩 XMLTYPE and/or LOB 最有用的方法是在表空间级别进行压缩。

当您创建 XMLTYPE 或任何 LOB 的列时,您必须指定 LOB_storage_clause。压缩存储此类对象的整个表空间。

另见 XMLType_storage:

In earlier releases, binary XML data is stored by default in a BasicFiles LOB. Beginning with Oracle Database 11g Release 2 (11.2.0.2), if the COMPATIBLE initialization parameter is 11.2 or higher and you do not specify BASICFILE or SECUREFILE, then binary XML data is stored in a SecureFiles LOB whenever possible. If SecureFiles LOB storage is not possible then the binary XML data is stored in a BasicFiles LOB.

SecureFiles 提供压缩、重复数据删除和加密功能。