1. Trang chủ
  2. » Công Nghệ Thông Tin

Quản trị cơ sở dữ liệu Oracle 09 oracle storage

26 146 0

Đang tải... (xem toàn văn)

Tài liệu hạn chế xem trước, để xem đầy đủ mời bạn chọn Tải xuống

THÔNG TIN TÀI LIỆU

Thông tin cơ bản

Định dạng
Số trang 26
Dung lượng 165,79 KB

Các công cụ chuyển đổi và chỉnh sửa cho tài liệu này

Nội dung

• A datafile can be associated with only one tablespace and only one database • A datafile is physically made up of a number of operating system blocks... Segments, Extents, Blocks, and

Trang 1

Oracle storage

Trang 2

Tổng quan về tablespace và datafile

• Dữ liệu được lưu trữ luận lý trong segment (thông thường là table), và lưu trữ vật

lý trong datafile

• Một tablespace có thể chứa nhiều segment và được tạo thành từ nhiều datafile

Trang 3

Mô hình lưu trữ dữ liệu Oracle

Trang 4

Operating system block

• is the basic unit of I/O for file system

• is the minimum unit of data that the operating system can read or write

Trang 5

• A datafile can be associated with only one tablespace and only one database

A datafile is physically made up of a number of operating system blocks.

Trang 6

Segments, Extents, Blocks, and Rows

• A segment is a set of extents that contains all the data for a specific logical storage structure within a tablespace

• Every segment is comprised of one or more extents

• An extent consists of a set of consecutively numbered blocks

• A data block is the smallest unit of data, Oracle Database stores data in data blocks

Trang 7

The relationships among segments, extents, and data blocks

Trang 9

Create and Manage Tablespaces

• Example: Using Tablespace

create tablespace tbs_user datafile ' userdata _01.dbf' size 10M

Create table T (a NUMBER)

tablespace tbs_user ;

Trang 10

Bigfile and smallfile tablespace

• bigfile tablespace:

– Constain a single large file

– can be 1024 times larger than a smallfile tablespace

• Smallfile tablespace (default):

– can contain up to 1024 files

- CREATE BIGFILE TABLESPACE user_tbs

DATAFILE ‘oradata/grid/user_tbs01.dbf’ SIZE 1024 M;

- ALTER TABLESPACE user_tbs RESIZE 10G;

Trang 11

Space Management in Tablespaces

• Extent Management

• Segment Space Management

Trang 12

Extent Management

• Locally managed tablespaces (default)

– uses bitmaps stored in each datafile

– Each bit in the bitmap covers a range of blocks

– Bit value indicates free or used (0-free, 1 used)

• Dictionary-managed tablespaces

– Free extents recorded in data dictionary tables (SYS.UET$ and FET$)

Trang 13

Extent Management

Locally Managed Tablespaces

• Every extent allocated in this tablespace will be 160MB, the bitmap needs only

64 bits

• Oracle will allocate extents of 64KB up to 16 extents, from which it will allocate progressively larger extents

create tablespace large_tabs datafile 'large_tabs_01.dbf' size 10g extent management local uniform size 160m;

create tablespace any_tabs datafile 'any_tabs_01.dbf' size 10g

extent management local autoallocate;

Trang 14

Segment Space Management

• is set per tablespace and applies to all segments in the tablespace

There are two techniques: manual or automatic

• There are five bitmaps for each segment: for full blocks used, 75- 100 percent used; 50 - 75 percent used; 25 - 50 percent used; and 0 - 25 percent used

Trang 15

Segment Space Management

• For instance,

– if the block size is 4KB and the row to be inserted is 1500 bytes

– an appropriate block will be found by searching the 25 percent to 50 percent bitmap

– Every block on this bitmap is guaranteed to have at least 2KB of free space.

Trang 17

Taking a Tablespace Online or Offline

An online tablespace or datafile is available for use

an offline tablespace or datafile exists as a definition in the data dictionary and

the controlfile but cannot be used

• cannot take the following tablespaces offline

– SYSTEM

– The undo tablespace

– Temporary tablespaces

Trang 18

Taking a Tablespace Online or Offline

ALTER TABLESPACE tablespacename OFFLINE [NORMAL | IMMEDIATE |

TEMPORARY];

ALTER TABLESPACE users OFFLINE

• To bring a tablespace online

– ALTER TABLESPACE users ONLINE;

Trang 19

Mark a Tablespace as Read Only

• makes the flights tablespace read-only:

– ALTER TABLESPACE flights READ ONLY;

• makes the flights tablespace writable:

– ALTER TABLESPACE flights READ WRITE;

Trang 20

Rename a Tablespace and Its Datafiles

Trang 21

Resize a Tablespace

• Add a data file

• Change the size of a data file

– Automatically

– Manually

Trang 22

Add datafile to a tablespace

• alter tablespace storedata add datafile ‘STOREDATA_03.DBF' size 50m;

Trang 23

Change size of datafile Manually

• alter database datafile '/oradata/users02.dbf' resize 10m;

Trang 24

enable automatic extension of datafile

• alter database datafile ‘ \STOREDATA_03.DBF‘ autoextend on next 50m maxsize 2g;

Trang 25

Dropping Tablespaces

• Tablespace removed from data dictionary

• Optionally, contents removed from data dictionary

• OS files can be deleted with the optional AND DATAFILES clause

– DROP TABLESPACE tbs_02 INCLUDING CONTENTS AND DATAFILES;

Trang 26

Obtain Tablespace Info

Ngày đăng: 29/08/2017, 10:16

TỪ KHÓA LIÊN QUAN