Describing LOB Types- Large Objects
Since earlier versions of Oracle, the ability to store large files in the database vastly improved with the CLOB, NCLOB, BLOB, and BFILE data types. These additional LOB data types let you store much more data, with greater functionality. Table 11-1 summarized the types of Oracle LOBs available and their descriptions.
Table11-1.Oracle Large Object Data Types
* NCLOB along with the other national character sets are not needed to store multibyte characters. I normally use CLOB and VARCHAR2 with just making sure the sizing is large enough to handle multibyte character.
As you can see from Table 11-1, the maximum size of a LOB can range from 8 TB to 128 TB depending on how the database is configured.
A CLOB such as text or XML, as well as JSON, can also be stored as a CLOB or JSON data type. Also, as we saw in a previous chapter, you can just use the relational data to create a JSON duality view.
BLOBs are not human readable. Typical uses for a BLOB are spreadsheets, documents, images, and audio and video data.
CLOBs, NCLOBs, and BLOBs are known as internal LOBs. This is because these data types are stored inside the Oracle database in data files. Internal LOBs participate in transactions and are covered by Oracle’s database security as well as its backup and recovery features.
BFILEs are known as external LOBs. BFILE columns store a pointer to a file on the OS that is outside the database.
You can think of a BFILE as a mechanism for providing read-only access to large binary files outside the database on the OS file system.
Sometimes, the question arises as to whether you should use a BLOB or a BFILE. BLOBs participate in database transactions and can be backed up, restored, and recovered by Oracle.
BFILEs do not participate in the database transactions, are read-only, and are not covered by backup and recovery of the database.
BFILEs are more appropriate for large binary files that are read-only and that do not change while an application is running.
For instance, you may have large binary video files that are referenced by a database application. In this scenario, the business determines that you do not need to create and maintain a 500TB database when all the application really needs is a pointer (stored in the database) to the locations of the large files on disk.