Database Reference
In-Depth Information
Both SecureFiles and BasicFiles have a full storage clause you can employ to control the physical storage
characteristics. It should be noted that this storage clause applies to the LOBSEGMENT
and
the LOBINDEX
equally—a setting for one is used for the other.
The management of the storage with SecureFiles is less complicated than that of a BasicFiles. Recall that a
SecureFiles LOB must be created within an ASSM-managed tablespace, and therefore the following attributes no
longer apply:
FREELISTS
,
FREELIST GROUPS
, and
FREEPOOLS
.
For a BasicFiles LOB, the relevant settings for a LOB would be the
FREELISTS
,
FREELIST GROUPS
(when not using
ASSM, as discussed in Chapter 10). The same rules apply to the LOBINDEX segment, as the LOBINDEX is managed
the same as any other index segment. If you have highly concurrent modifications of LOBs, multiple
FREELISTS
on the
index segment might be recommended.
As mentioned in the previous section, using the Keep or Recycle pools for LOB segments can be a useful
technique to allow you to cache LOB data, without damaging your existing default buffer cache. Rather than having
the LOBs age out block buffers from normal tables, you can set aside a dedicated piece of memory in the SGA just for
these objects. The
BUFFER_POOL
clause could be used to achieve that.
BFILEs
The last of the LOB types to talk about is the
BFILE
type. A
BFILE
type is simply a pointer to a file in the operating
system. It is used to provide
read-only
access to these operating system files.
■
the built-in package
UTL_FILE
provides read and write access to operating system files, too. It does not use
the
BFILE
type, however.
Note
When you use
BFILE
s, you will also be using an Oracle
DIRECTORY
object. The
DIRECTORY
object simply maps an
operating system directory to a string or a name in the database (providing for portability; you refer to a string in your
BFILE
s, not an operating system-specific file-naming convention). So, as a quick example, let's create a table with a
BFILE
column, create a
DIRECTORY
object, and insert a row referencing a file in the file system:
EODA@ORA12CR1> create table t
2 ( id int primary key,
3 os_file bfile
4 )
5 /
Table created.
EODA@ORA12CR1> create or replace directory my_dir as '/tmp/';
Directory created.
EODA@ORA12CR1> insert into t values ( 1, bfilename( 'MY_DIR', 'test.dmp' ) );
1 row created.
For this example, I'll create a test.dmp file in the
/tmp
directory using the UNIX/Linux
dd
command:
dd if=/dev/zero of=/tmp/test.dmp bs=1056768 count=1