6 Copyright © 2007, Oracle. All rights reserved. Managing Database Storage Structures.
-
Upload
virginia-carpenter -
Category
Documents
-
view
219 -
download
0
Transcript of 6 Copyright © 2007, Oracle. All rights reserved. Managing Database Storage Structures.
![Page 1: 6 Copyright © 2007, Oracle. All rights reserved. Managing Database Storage Structures.](https://reader036.fdocuments.in/reader036/viewer/2022062322/5697bf8c1a28abf838c8bb1c/html5/thumbnails/1.jpg)
6Copyright © 2007, Oracle. All rights reserved.
Managing Database Storage Structures
![Page 2: 6 Copyright © 2007, Oracle. All rights reserved. Managing Database Storage Structures.](https://reader036.fdocuments.in/reader036/viewer/2022062322/5697bf8c1a28abf838c8bb1c/html5/thumbnails/2.jpg)
Copyright © 2007, Oracle. All rights reserved.6 - 2
Objectives
After completing this lesson, you should be able to:
• Describe the storage of table row data in blocks
• Define the purpose of tablespaces and data files
• Create and manage tablespaces
• Obtain tablespace information
• Describe the main concepts and functionality of Automatic Storage Management (ASM)
![Page 3: 6 Copyright © 2007, Oracle. All rights reserved. Managing Database Storage Structures.](https://reader036.fdocuments.in/reader036/viewer/2022062322/5697bf8c1a28abf838c8bb1c/html5/thumbnails/3.jpg)
Copyright © 2007, Oracle. All rights reserved.6 - 3
Storage Structures
Database
Tablespace
Segment
Extent
Oracle datablock
Logical Physical
OSblock
OS file
![Page 4: 6 Copyright © 2007, Oracle. All rights reserved. Managing Database Storage Structures.](https://reader036.fdocuments.in/reader036/viewer/2022062322/5697bf8c1a28abf838c8bb1c/html5/thumbnails/4.jpg)
Copyright © 2007, Oracle. All rights reserved.6 - 4
How Table Data Is Stored
Tablespace
Table A Table B
SegmentSegment
Rows
Columns
Table
Blocks
Row piece Extent
![Page 5: 6 Copyright © 2007, Oracle. All rights reserved. Managing Database Storage Structures.](https://reader036.fdocuments.in/reader036/viewer/2022062322/5697bf8c1a28abf838c8bb1c/html5/thumbnails/5.jpg)
Copyright © 2007, Oracle. All rights reserved.6 - 5
Database Block: Contents
Block header
Free space
Row data
Growth
![Page 6: 6 Copyright © 2007, Oracle. All rights reserved. Managing Database Storage Structures.](https://reader036.fdocuments.in/reader036/viewer/2022062322/5697bf8c1a28abf838c8bb1c/html5/thumbnails/6.jpg)
Copyright © 2007, Oracle. All rights reserved.6 - 6
Tablespaces and Data Files
The Oracle database stores data logically in tablespaces and physically in data files.
• Tablespaces:– Can belong to only one database– Consist of one or more data files– Are further divided into logical units of storage
• Data files:– Can belong to only one
tablespace and one database– Are a repository for schema
object data
Database
Tablespace
Data files
![Page 7: 6 Copyright © 2007, Oracle. All rights reserved. Managing Database Storage Structures.](https://reader036.fdocuments.in/reader036/viewer/2022062322/5697bf8c1a28abf838c8bb1c/html5/thumbnails/7.jpg)
Copyright © 2007, Oracle. All rights reserved.6 - 7
Space Management in Tablespaces
• Locally managed tablespace:– Free extents are managed in the tablespace.– A bitmap is used to record free extents.– Each bit corresponds to a block or group of blocks.– The bit value indicates free or used extents.– Use of locally managed tablespaces is recommended.
• Dictionary-managed tablespace:– Free extents are managed by Oracle.– Appropriate tables are updated when extents are
allocated or unallocated.– These tablespaces are supported only for backward
compatibility.
![Page 8: 6 Copyright © 2007, Oracle. All rights reserved. Managing Database Storage Structures.](https://reader036.fdocuments.in/reader036/viewer/2022062322/5697bf8c1a28abf838c8bb1c/html5/thumbnails/8.jpg)
Copyright © 2007, Oracle. All rights reserved.6 - 8
Exploring the Storage Structure
Click the links to view detailed information.
![Page 9: 6 Copyright © 2007, Oracle. All rights reserved. Managing Database Storage Structures.](https://reader036.fdocuments.in/reader036/viewer/2022062322/5697bf8c1a28abf838c8bb1c/html5/thumbnails/9.jpg)
Copyright © 2007, Oracle. All rights reserved.6 - 9
Creating a New Tablespace
![Page 10: 6 Copyright © 2007, Oracle. All rights reserved. Managing Database Storage Structures.](https://reader036.fdocuments.in/reader036/viewer/2022062322/5697bf8c1a28abf838c8bb1c/html5/thumbnails/10.jpg)
Copyright © 2007, Oracle. All rights reserved.6 - 11
Storage for Locally Managed Tablespaces
![Page 11: 6 Copyright © 2007, Oracle. All rights reserved. Managing Database Storage Structures.](https://reader036.fdocuments.in/reader036/viewer/2022062322/5697bf8c1a28abf838c8bb1c/html5/thumbnails/11.jpg)
Copyright © 2007, Oracle. All rights reserved.6 - 13
Tablespaces in the Preconfigured Database
• UNDOTBS1
• USERS
• EXAMPLE
• SYSTEM
• SYSAUX
• TEMP
![Page 12: 6 Copyright © 2007, Oracle. All rights reserved. Managing Database Storage Structures.](https://reader036.fdocuments.in/reader036/viewer/2022062322/5697bf8c1a28abf838c8bb1c/html5/thumbnails/12.jpg)
Copyright © 2007, Oracle. All rights reserved.6 - 15
Altering a Tablespace
![Page 13: 6 Copyright © 2007, Oracle. All rights reserved. Managing Database Storage Structures.](https://reader036.fdocuments.in/reader036/viewer/2022062322/5697bf8c1a28abf838c8bb1c/html5/thumbnails/13.jpg)
Copyright © 2007, Oracle. All rights reserved.6 - 17
Actions with Tablespaces
![Page 14: 6 Copyright © 2007, Oracle. All rights reserved. Managing Database Storage Structures.](https://reader036.fdocuments.in/reader036/viewer/2022062322/5697bf8c1a28abf838c8bb1c/html5/thumbnails/14.jpg)
Copyright © 2007, Oracle. All rights reserved.6 - 19
Dropping Tablespaces
![Page 15: 6 Copyright © 2007, Oracle. All rights reserved. Managing Database Storage Structures.](https://reader036.fdocuments.in/reader036/viewer/2022062322/5697bf8c1a28abf838c8bb1c/html5/thumbnails/15.jpg)
Copyright © 2007, Oracle. All rights reserved.6 - 20
Viewing Tablespace Information
![Page 16: 6 Copyright © 2007, Oracle. All rights reserved. Managing Database Storage Structures.](https://reader036.fdocuments.in/reader036/viewer/2022062322/5697bf8c1a28abf838c8bb1c/html5/thumbnails/16.jpg)
Copyright © 2007, Oracle. All rights reserved.6 - 21
Gathering Storage Information
![Page 17: 6 Copyright © 2007, Oracle. All rights reserved. Managing Database Storage Structures.](https://reader036.fdocuments.in/reader036/viewer/2022062322/5697bf8c1a28abf838c8bb1c/html5/thumbnails/17.jpg)
Copyright © 2007, Oracle. All rights reserved.6 - 22
Viewing Tablespace Contents
12061_1_sel_ts_3
![Page 18: 6 Copyright © 2007, Oracle. All rights reserved. Managing Database Storage Structures.](https://reader036.fdocuments.in/reader036/viewer/2022062322/5697bf8c1a28abf838c8bb1c/html5/thumbnails/18.jpg)
Copyright © 2007, Oracle. All rights reserved.6 - 23
Oracle Managed Files (OMF)
Specify file operations in terms of database objects rather than file names.
Parameter Description
DB_CREATE_FILE_DEST Defines the location of the default file system directory for data files and temporary files
DB_CREATE_ONLINE_LOG_DEST_n Defines the location for redo log files and control file creation
DB_RECOVERY_FILE_DEST Default location for the flash recovery area
Example: SQL> ALTER SYSTEM SET DB_CREATE_FILE_DEST = '/u01/oradata'; SQL> CREATE TABLESPACE tbs_1;
![Page 19: 6 Copyright © 2007, Oracle. All rights reserved. Managing Database Storage Structures.](https://reader036.fdocuments.in/reader036/viewer/2022062322/5697bf8c1a28abf838c8bb1c/html5/thumbnails/19.jpg)
Copyright © 2007, Oracle. All rights reserved.6 - 24
Enlarging the Database
You can enlarge the database in the following ways:
• Creating a new tablespace
• Adding a data file to an existing tablespace
• Increasing the size of a data file
• Providing for the dynamic growth of a data file
SYSTEM tablespace
INVENTORY tablespace
Database
![Page 20: 6 Copyright © 2007, Oracle. All rights reserved. Managing Database Storage Structures.](https://reader036.fdocuments.in/reader036/viewer/2022062322/5697bf8c1a28abf838c8bb1c/html5/thumbnails/20.jpg)
Copyright © 2007, Oracle. All rights reserved.6 - 25
Automatic Storage Management
• Is a portable and high-performancecluster file system
• Manages Oracle database files
• Spreads data across disksto balance load
• Mirrors data
• Solves storage-managementchallenges ASM
Filesystem
Volumemanager
Application
Database
Operating system
![Page 21: 6 Copyright © 2007, Oracle. All rights reserved. Managing Database Storage Structures.](https://reader036.fdocuments.in/reader036/viewer/2022062322/5697bf8c1a28abf838c8bb1c/html5/thumbnails/21.jpg)
Copyright © 2007, Oracle. All rights reserved.6 - 26
ASM: Key Features and Benefits
• Stripes files but not logical volumes
• Provides online disk reconfiguration and dynamic rebalancing
• Allows for adjustable rebalancing speed
• Provides redundancy on a per-file basis
• Supports only Oracle database files
• Is cluster aware
• Is automatically installed
![Page 22: 6 Copyright © 2007, Oracle. All rights reserved. Managing Database Storage Structures.](https://reader036.fdocuments.in/reader036/viewer/2022062322/5697bf8c1a28abf838c8bb1c/html5/thumbnails/22.jpg)
Copyright © 2007, Oracle. All rights reserved.6 - 27
ASM: Concepts
Database
Tablespace
Segment
Extent
Oracleblock
Data file
Physicalblock
ASMdisk group
ASM disk
ASM file
Allocation unitFile-system
fileor
raw device
![Page 23: 6 Copyright © 2007, Oracle. All rights reserved. Managing Database Storage Structures.](https://reader036.fdocuments.in/reader036/viewer/2022062322/5697bf8c1a28abf838c8bb1c/html5/thumbnails/23.jpg)
Copyright © 2007, Oracle. All rights reserved.6 - 28
Summary
In this lesson, you should have learned how to:
• Describe the storage of table row data in blocks
• Define the purpose of tablespaces and data files
• Create and manage tablespaces
• Obtain tablespace information
• Describe the main concepts and functionality of Automatic Storage Management (ASM)
![Page 24: 6 Copyright © 2007, Oracle. All rights reserved. Managing Database Storage Structures.](https://reader036.fdocuments.in/reader036/viewer/2022062322/5697bf8c1a28abf838c8bb1c/html5/thumbnails/24.jpg)
Copyright © 2007, Oracle. All rights reserved.6 - 29
Practice 6 Overview:Managing Database Storage Structures
This practice covers the following topics:
• Creating tablespaces
• Gathering information about tablespaces