SecureFiles: The New LOBs

There are usually two approaches to store none stuctured or semi-structured form Examples include pictures, word processing documents, spreadsheets, XML files, and so on.: The data is stored in the database as LOB fields (BLOB for binary and CLOB for character data), or in OS files with the references to the files stored in the database.

Let see the SecureFiles: The New LOBs in 11G.

CREATE TABLE Account(
id number(20) NOT NULL,
field3 clob,
field4 varchar2(255) NOT NULL,
field2 varchar2(255) NOT NULL,
field1 varchar2(255) NOT NULL,
field5 number(20) NOT NULL,
field6 date NOT NULL,
field7 number(20) NOT NULL,
field8 number(1) NOT NULL,
constraint PK_ACCOUNT PRIMARY KEY (id)
)
tablespace users
lob (field3)
store as securefile
(
tablespace users
enable storage in row
chunk 4096
pctversion 20
nocache
nologging
)
;

use the sqlldr load some data into table.

then select clob column:

SQL> select FIELD3 from account;

FIELD3
--------------------------------------------------------------------------------
DZcLHm6H2iDNnvjU7TafFA==
5nBoqMWLF+w=
bbv+dzukljA=
/I67FDRQc7o=

You can compress the values stored in the LOBs using the following SQL:

SQL> alter table account
2 modify lob(field3)
3 (compress high);

Table altered.
there is a third compression option in addition to HIGH and MEDIUM: LOW.

SQL> alter table account
2 modify lob(field3)
3 (nocompress);

Table altered.

One of the advantages of storing unstructured data in OS files instead of database resident objects is the facility of caching. Files can be cached in the operating system's file buffers.

SQL> alter table account
2 modify lob(field3)
3 (cache);

Table altered.

你可能感兴趣的:(File)