CHAPTER 11 Large Objects. Need for Large Objects Data type to store objects that contain large amount of text, log, image, video, or audio data. Most.

Slides:



Advertisements
Similar presentations
CHAPTER 4 Tablespaces and Datafiles. Introduction After installing the binaries, creating a database, and configuring your environment, the next logical.
Advertisements

9 Creating and Managing Tables. Objectives After completing this lesson, you should be able to do the following: Describe the main database objects Create.
Data Definition Language (DDL)
<Insert Picture Here>
5 Copyright © 2005, Oracle. All rights reserved. Managing Database Storage Structures.
Oracle Architecture. Instances and Databases (1/2)
Oracle 10g Database Administrator: Implementation and Administration Chapter 8 Advanced Table Management.
Primer on Structure& Storage Analysis Primer on Structure & Storage Analysis This presentation is supposed to give a simple and brief overview for storage.
Basic Storage Concepts and Settings
9 Copyright © Oracle Corporation, All rights reserved. Creating and Managing Tables.
1 - Oracle Server Architecture Overview
Harvard University Oracle Database Administration Session 2 System Level.
A Guide to Oracle9i1 Advanced SQL And PL/SQL Topics Chapter 9.
Harvard University Oracle Database Administration Session 5 Data Storage.
Advanced Databases Basic Database Administration Guide to Oracle 10g 1.
Oracle Database 12c is the latest version of Oracle Corporations flagship database and has added many new features. In this presentation I am capturing.
Oracle Database Administration Database files Logical database structures.
1 © 2008 Julian Dyke LOB Internals Julian Dyke Independent Consultant juliandyke.com Web Version - December 2008.
Introduction and simple using of Oracle Logistics Information System Yaxian Yao
Database Administration TableSpace & Data File Management
Chapter Oracle Server An Oracle Server consists of an Oracle database (stored data, control and log files.) The Server will support SQL to define.
Chapter 6 Additional Database Objects
Cao Tiến Đức. Outline What is TDE How TDE works Basic TDE operations Tablespace encryption HSM Reference.
1 Oracle Database 11g – Flashback Data Archive. 2 Data History and Retention Data retention and change control requirements are growing Regulatory oversight.
By Lecturer / Aisha Dawood 1.  You can control the number of dispatcher processes in the instance. Unlike the number of shared servers, the number of.
7202ICT Database Administration Lecture 7 Managing Database Storage Part 2 Orale Concept Manuel Chapter 3 & 4.
Extents, segments and blocks in detail. Database structure Database Table spaces Segment Extent Oracle block O/S block Data file logical physical.
CHAPTER 7 Tables and Constraints. Logical Progression of Steps in Creating a Database Environment 1. Install Oracle database binaries (Chapter 1) 2. Create.
Oracle Advanced Compression – Reduce Storage, Reduce Costs, Increase Performance Session: S Gregg Christman -- Senior Product Manager Vineet Marwah.
9 Storage Structure and Relationships. 9-2 Objectives Listing the different segment types and their uses Controlling the use of extents by segments Stating.
Sizing Basics  Why Size?  When to size  Sizing issues:  Bits and Bytes  Blocks (aka pages) of Data  Different Data types  Row Size  Table Sizing.
About the Presentations The presentations cover the objectives found in the opening of each chapter. All chapter objectives are listed in the beginning.
1 Chapter Overview Preparing to Upgrade Performing a Version Upgrade from Microsoft SQL Server 7.0 Performing an Online Database Upgrade from SQL Server.
9 Copyright © Oracle Corporation, All rights reserved. Creating and Managing Tables.
Database structure and space Management. Database Structure An ORACLE database has both a physical and logical structure. By separating physical and logical.
Guide to Oracle 10g ITBIS373 Database Development Lecture 4a - Chapter 4: Using SQL Queries to Insert, Update, Delete, and View Data.
Indexes / Session 2/ 1 of 36 Session 2 Module 3: Types of Indexes Module 4: Maintaining Indexes.
Database structure and space Management. Segments The level of logical database storage above an extent is called a segment. A segment is a set of extents.
Oracle 11g: SQL Chapter 4 Constraints.
Chapter 4 Constraints Oracle 10g: SQL. Oracle 10g: SQL 2 Objectives Explain the purpose of constraints in a table Distinguish among PRIMARY KEY, FOREIGN.
Week 3 Lecture 2 Basic Storage Concepts and Settings.
14 Copyright © 2006, Oracle. All rights reserved. Tuning Block Space Usage.
IT Database Administration Section 09. Backup and Recovery Backup: The available options Full Consistent (cold) Backup Database shutdown, all files.
Week 4 Lecture 2 Advanced Table Management. Learning Objectives  Create tables with large object (LOB) columns and tables that are index-organized 
Harvard University Oracle Database Administration Session 6 Object Storage.
9 Copyright © Oracle Corporation, All rights reserved. Creating and Managing Tables.
IT Database Administration SECTION 02. CREATING DATABASES Creating a Database: Overview 1. Plan the physical design and storage structures 2. Back.
6 Copyright © 2007, Oracle. All rights reserved. Managing Database Storage Structures.
9 Copyright © 2004, Oracle. All rights reserved. Manipulating Large Objects.
Physical Database Design Purpose- translate the logical description of data into the technical specifications for storing and retrieving data Goal - create.
Chapter 4 Logical & Physical Database Design
Altering Tables and Constraints Database Systems Objectives Add and modify columns. Add, enable, disable, or remove constraints. Drop a table. Remove.
Creating Indexes on Tables An index provides quick access to data in a table, based on the values in specified columns. A table can have more than one.
Relational Database Management System(RDBMS) Structured Query Language(SQL)
Stored Procedures / Session 4/ 1 of 41 Session 4 Module 7: Introducing stored procedures Module 8: More about stored procedures.
Chapter 3 Table Creation and Management Oracle 10g: SQL.
C Copyright © 2007, Oracle. All rights reserved. Security New Features.
CHAPTER 9 File Storage Shared Preferences SQLite.
8 Copyright © 2007, Oracle. All rights reserved. Implementing SecureFile LOBs.
Views / Session 3/ 1 of 40 Session 3 Module 5: Implementing Views Module 6: Managing Views.
Oracle9i Developer: PL/SQL Programming Chapter 6 PL/SQL Packages.
8 Copyright © Oracle Corporation, All rights reserved. Managing Tablespaces and Data files.
Database structure and space Management
SQL Creating and Managing Tables
Oracle 1Z0-148 Questions Answers VCE
DATABASE SQL= Structure Query Language مبادئ قواعد بيانات
Transparent Data Encryption (TDE)
SQL Creating and Managing Tables
SQL Creating and Managing Tables
Managing Tables.
Presentation transcript:

CHAPTER 11 Large Objects

Need for Large Objects Data type to store objects that contain large amount of text, log, image, video, or audio data. Most companies have a need to store this type of data. Oracle provides the following data types: LONG and LONG RAW Character large object (CLOB) National character large object (NCLOB) Binary large object (BLOB) Binary file (BFILE)

Understanding the Lob Architecture

Understanding BFILEs

BasicFiles versus SecureFiles SecureFile is a new LOB architecture introduced in Oracle Database 11g. In Oracle Database 12c, default is to use SecureFiles The SecureFile architecture has many new enhancements that improve the manageability and performance of LOBs. If you’re not using Oracle Database 12c or 11g, then your only option is to use the BasicFile architecture. This is the default type of LOB created, and it’s been available since Oracle version 8.

SecureFile LOB Enhancements Encryption (requires Oracle Advanced Security Option) Compression (requires Oracle Advanced Compression Option) Deduplication (requires Oracle Advanced Compression Option)

Prerequisites for SecureFiles A SecureFile LOB must be stored in a tablespace using the automated segment space management feature (ASSM). The DB_SECUREFILE initialization setting must be either PERMITTED or ALWAYS.

Creating a BasicFile LOB Column Basic example: create table patchmain( patch_id number,patch_desc clob); In prior code, table and LOB stored in the same tablespace.

Default Behavior of LOBs LOBs by default are created as BasicFiles. Oracle creates a LOB segment and a LOB index for each LOB column. The LOB segment has a name of this format: SYS_LOB. The LOB index has a name of this format: SYS_IL. The is the same for each LOB segment and its associated index. The LOB segment and index are created in the same tablespace as the table unless you specify a different tablespace. By default, nearly 4000 bytes of a LOB are stored in the table row (inline). With Oracle Database 11g release 2 and higher, a LOB segment and a LOB index aren’t created until a record is inserted into the table (the so-called deferred segment creation feature). This means DBA/ALL/USER_SEGMENTS and DBA/ALL/USER_EXTENTS have no information in them until a row is inserted into the table.

Creating a LOB in a Different Tablespace from the Table Allows you to maintain and manage LOB segment separately from table segment and extents. create table patchmain (patch_id number,patch_desc clob,patch blob ) tablespace users lob (patch_desc) store as (tablespace clob_data),lob (patch) store as (tablespace blob_data);

Creating a SecureFile LOB Use the SECUREFILE clause Must be in an ASSM managed tablespace create table patchmain( patch_id number,patch_desc clob) lob(patch_desc) store as securefile (tablespace lob_data);

Partitioning a LOB Allows you to spread out data across several tablespaces. CREATE TABLE patchmain( patch_id NUMBER,region VARCHAR2(16),patch_desc CLOB) LOB(patch_desc) STORE AS (TABLESPACE patch1) PARTITION BY LIST (REGION) ( PARTITION p1 VALUES ('EAST') LOB(patch_desc) STORE AS SECUREFILE (TABLESPACE patch1 COMPRESS HIGH) TABLESPACE inv_data1, PARTITION p2 VALUES ('WEST') LOB(patch_desc) STORE AS SECUREFILE (TABLESPACE patch2 DEDUPLICATE NOCOMPRESS) TABLESPACE inv_data2, PARTITION p3 VALUES (DEFAULT) LOB(patch_desc) STORE AS SECUREFILE (TABLESPACE patch3 COMPRESS LOW) TABLESPACE inv_data3 );

Moving a LOB Allows you to move a LOB to a separate tablespace from the table. alter table patchmain move lob(patch_desc) store as basicfile (tablespace inv_clob);

Adding a LOB Column Business requirements frequently change. You can add a column with a LOB datatype just like other datatypes. Use ALTER TABLE... ADD SQL> alter table inv add(inv_image blob);

Removing a LOB Column Business requirements frequently change. Might want to rename the column before dropping it (to better determine if an application is using the column): SQL> alter table patchmain rename column patch_desc to patch_desc_old; SQL> alter table patchmain drop(patch_desc_old);

Caching LOBs By default, LOBs are not placed in the SGA. Use CACHE to place LOB in buffer cache for reads/writes. Use CACHE READS to place LOB in buffer cache for only reads. NOCACHE is the default, the LOB is not placed in the buffer cache. create table patchmain( patch_id number,patch_desc clob) lob(patch_desc) store as (tablespace lob_data cache);

Storing LOBs In Line By default, up to approximately 4000 characters of a LOB column are stored in line with the table row. If the LOB is over 4000 characters, then Oracle automatically stores the LOB outside of the row data. Main advantage of storing a LOB in row is that small LOBs (less than 4000 characters) require less I/O, because Oracle doesn’t have to search out of row for the LOB data. create table patchmain( patch_id number,patch_desc clob,log_file blob) lob(patch_desc, log_file) store as ( tablespace lob_data enable storage in row);

Storing LOBs Out of Line You can explicitly instruct Oracle to store the LOB outside of the row with the DISABLE STORAGE IN ROW. create table patchmain( patch_id number,patch_desc clob,log_file blob) lob(patch_desc, log_file) store as ( tablespace lob_data disable storage in row);

SecureFile Compression If you’re using SecureFile LOBs, then you can specify a degree of compression. The benefit is that the LOBs consume much less space in the database. The downside is that reading and writing the LOBs may take longer. ALTER TABLE patchmain MODIFY LOB(patch_desc) (COMPRESS HIGH);

SecureFile Deduplicating If you have an application where identical LOBs are associated with two or more rows, you should consider using the SecureFile deduplication feature. When enabled, this instructs Oracle to check when a new LOB is inserted into a table and see whether that LOB is already stored in another row (for the same LOB column). If it’s already stored, then Oracle stores a pointer to the existing identical LOB. This can dramatically reduce space for applications that tend to store the same LOB value multiple times in multiple rows.

SecureFile Deduplicating CREATE TABLE patchmain( patch_id NUMBER,patch_desc CLOB) LOB(patch_desc) STORE AS SECUREFILE (DEDUPLICATE) TABLESPACE inv_clob;

SecureFile Encryption You can transparently encrypt a SecureFile LOB column (just like any other column). Before you use encryption features, you must set up an encryption wallet. CREATE TABLE patchmain( patch_id number,patch_desc clob) LOB(patch_desc) STORE AS SECUREFILE (encrypt) tablespace inv_clob;

Migrating BasicFiles to SecureFiles Create a new table, load the data from the old table, and rename the tables. Move the table. Redefine the table online.

Viewing LOB Metadata Troubleshooting often begins by looking at LOB metadata. select table_name,column_name,index_name,tablespace_name from all_lobs order by table_name; select segment_name,segment_type,tablespace_name from user_segments where segment_name like 'SYS_LOB%' or segment_name like 'SYS_IL%';

Loading a CLOB or BLOB 1. Create directory 2. Create table 3. Load LOB into table using DBMS_LOB package

Troubleshooting LOB space related issues select a.table_name,a.column_name,a.segment_name,a.index_name,b.bytes/1024/1024 meg_bytes from user_lobs a,user_segments b where a.segment_name = b.segment_name;

Determining Blocks used by LOB DBMS_SPACE.SPACE_USAGE for blocks being used by a LOB. Overloaded procedure, one form for BasicFile the other for SecureFile

Summary LOBs are a datatype you can use to store large objects such as text files, images, video, and so on. Most companies have a need to store LOBs. Use the SecureFile feature from 11g forward. SecureFile is the new architecture and allows for advanced LOB management.