[Oracle] LOB introduces a relational database like Oracle and is better at dealing with structured data, so how does Oracle handle and store unstructured data? Lob (Large object) is used by Oracle to handle semi-structured and unstructured data, a large object data type that can store more than 4000 bytes of string, binary data. The LOB type has two types of lobs, very internal lob and external lob. The so-called internal lob refers to the LOB data stored in an Oracle data file, External LOB refers to the LOB data stored in the operating system outside the database. Internale LOB includes: 1) CLOB (Character LOB): LOB for storing string types, such as text and XML files, string database character set encoding, 2) BLOB (binary LOB): LOB for storing binary types ; 3) NCLOB (National Character Lob): Similar to Clob, but the string is encoded in the country character set. External LOB includes: 1) BFILE (Binary file LOB): The database stores a pointer to execute an external file, so it is a read-only LOB store when we build a table that contains LOB fields, Oracle automatically creates two separate segment for LOB fields, one for storing data, the other for indexing, and they are stored in the table space specified by the corresponding table. Look at the following example:?
1234567891011 |
[sql]
[email protected]>
create table test.lobtest(b blob,c clob);
Table created.
[email protected]>
select OWNER,TABLE_NAME,COLUMN_NAME,SEGMENT_NAME,INDEX_NAME
from dba_lobs
where table_name=
‘LOBTEST‘
;
OWNER TABLE_NAME COLUMN_NAME SEGMENT_NAME INDEX_NAME
------------------------------ ------------------------------ ------------------------------ ------------------------------ ------------------------------
test lobtest b sys_lob0000101291c00001$$ sys_il0000101291c00001$$
TEST LOBTEST C SYS_LOB0000101291C00002$$ SYS_IL0000101291C00002$$
|
As shown in the example above, each LOB field corresponds to two segment, where the LOB data begins with Sys_lob and the index starts with Sys_il. LOB and other types of conversions through To_clob can convert the Char,nchar,varchar2,nvarchar2,nclob type to CLOB, and the TO_LOB can convert long raw to blob,long; _nclob can convert Char,nchar,varchar2,nvarchar2,clob to NCLOB.
[Oracle] LOB Introduction