This chapter contains these topics:
The Oracle Database has been commonly used to store files closely associated with database applications including CAD, medical images, invoice images, documents, etc. The SQL standard data type, BLOB
(and CLOB
) is used by applications to store files in the database. The Oracle Database provides much better security, availability, robustness, transactions, and scalability than traditional file systems. When files are stored in the database, they are backed up, synchronized to the disaster recovery site using Data Guard, and recovered along with the relational data in the database. This has made storing files in the database an appealing option for many applications.
In Oracle Database 11g, Oracle introduced Oracle SecureFiles LOBs. SecureFiles LOBs provide high performance storage for files, comparable to the performance of traditional file systems. SecureFiles LOBs support advanced features of compression, deduplication and encryption to files. Because SecureFiles LOBs maintain backward compatibility to BLOB
(and CLOB
), applications written against BLOB
s continue to transparantly work against SecureFiles LOBs, even with the previously mentioned features.
Database File System (DBFS) leverages the features of the database to store files, and the strengths of the database in efficiently managing relational data, to implement a standard file system interface for files stored in the database. With this interface, storing files in the database is no longer limited to programs specifically written to use BLOB
and CLOB
programmatic interfaces. Files in the database can now be transparently accessed using any operating system (OS) program that acts on files. For example, ETL (Extract, Transform and Load) tools can transparently store staging files in the database.
The Oracle Database File System (DBFS) creates a standard file system interface on top of files and directories that are stored in database tables. DBFS is similar to NFS in that it provides a shared network file system that looks like a local file system. Like NFS, there is a server component and a client component.
In DBFS, the server is the Oracle Database. Files are stored as SecureFiles LOBs in a database table. A set of PL/SQL procedures implement the file system access primitives such as create, open, read, write, and list directory. The implementation of the file system in the database is called the DBFS Content Store. The DBFS Content Store allows each database user to create one or more file systems that can be mounted by clients. Each file system has its own dedicated tables that hold the file system content.
See Also:
Chapter 7, "DBFS Content API" for information about content storesFigure 5-1 Oracle Database File System (DBFS)
The DBFS Content API is the PL/SQL interface in the Oracle RDBMS that lies at the core of DBFS. It includes a programmatic interface that allows different types of storage to be supported, including user-defined storage.
The DBFS SecureFiles Store is a DBFS Content Store that utilizes a table with a SecureFiles LOB column to store the file system data. It implements POSIX-like capabilities.
The DBFS Hierarchical Store is a DBFS Content Store that allows files to be written to any tape storage units supported by Oracle Recovery Manager (RMAN) or to a cloud storage system. Currently, Amazon S3 is the only cloud storage system supported.
DBFS also has a client component that runs on each file system client machine called dbfs_client
. The dbfs_client
provides a command interface to allow files to be easily copied in and out of the database from any host on the network. It implements simple file system commands like list and copy in a manner that is similar to the shell utilities ls
and rcp
. The command interface creates a direct connection to the database without requiring an OS mount of DBFS.
On Linux, the dbfs_client
also has a mount interface that utilizes the Filesystem in User Space (FUSE
) kernel module to implement a file-system mount point that provides transparent access to the files stored in the database and requires no changes to the Linux kernel. It receives standard file system calls from the FUSE
kernel module, and translates them into OCI calls to the PL/SQL procedures in the DBFS Content Store.
The files in the DBFS store can also be directly accessed by database applications through the PL/SQL interface. The PL/SQL interface allows database transactions and read consistency to span relational and file data.
DBFS can migrate SecureFiles from existing tables to other storage using DBFS Links. See "PL/SQL Packages for SecureFiles LOBs and DBFS" for information about SecureFiles LOB DBFS Links.