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

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

Đ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

Oracle storage Tổng quan tablespace datafile • Dữ liệu lưu trữ luận lý segment (thông thường table), lưu trữ vật lý datafile • Một tablespace chứa nhiều segment tạo thành từ nhiều datafile Mô hình lưu trữ liệu Oracle 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 Datafile • • 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 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 The relationships among segments, extents, and data blocks Tablespaces • • • Each tablespace in an Oracle database consists of one or more files called datafiles Tablespaces store Oracle database objects such as tables, indexes and rollback segments A tablespace can belong to only one database at a time Database Tablespace Data files Create and Manage Tablespaces create tablespace tbs_user datafile ' userdata _01.dbf' size 10M • Example: Using Tablespace Create table T (a NUMBER) tablespace tbs_user ; Bigfile and smallfile tablespace • bigfile tablespace: • Smallfile tablespace (default): – Constain a single large file – can be 1024 times larger than a smallfile tablespace - CREATE BIGFILE TABLESPACE user_tbs ‘oradata/grid/user_tbs01.dbf’ SIZE 1024 M; can contain up to 1024 files – DATAFILE - ALTER TABLESPACE user_tbs RESIZE 10G; 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, used) • Dictionary-managed tablespaces – Free extents recorded in data dictionary tables (SYS.UET$ and FET$) Extent Management Locally Managed Tablespaces create tablespace large_tabs datafile 'large_tabs_01.dbf' size 10g extent management local uniform size 160m; • Every extent allocated in this tablespace will be 160MB, the bitmap needs only 64 bits Oracle will allocate extents of 64KB upsize to 10g 16 extents, from which it will allocate tablespace any_tabs datafile 'any_tabs_01.dbf' • create progressively larger extents extent management local autoallocate; 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 - 25 percent used 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 Altering Tablespaces • • • • Taking online and offline Renaming Flagging as read-write or read only Resizing Taking a Tablespace Online or Offline • • An online tablespace or datafile is available for use • cannot take the following tablespaces offline an offline tablespace or datafile exists as a definition in the data dictionary and the controlfile but cannot be used – SYSTEM – The undo tablespace – Temporary tablespaces 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; 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; Rename a Tablespace and Its Datafiles • Rename tablespace – ALTER TABLESPACE users RENAME TO clients; • Rename datafile – ALTER TABLESPACE users RENAME DATAFILE '/u02/oracle/rbdb1/user1.dbf', '/u02/oracle/rbdb1/user2.dbf' TO '/u02/oracle/rbdb1/users01.dbf', '/u02/oracle/rbdb1/users02.dbf'; Resize a Tablespace • • Add a data file Change the size of a data file – Automatically – Manually Add datafile to a tablespace • alter tablespace storedata add datafile ‘STOREDATA_03.DBF' size 50m; Change size of datafile Manually • alter database datafile '/oradata/users02.dbf' resize 10m; enable automatic extension of datafile • alter database datafile ‘ \STOREDATA_03.DBF‘ autoextend on next 50m maxsize 2g; 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; Obtain Tablespace Info • Tablespace information • Data file information • Temp file information – DBA_TABLESPACES – V$TABLESPACE – DBA_DATA_FILES – V$DATAFILE – DBA_TEMP_FILES – V$TEMPFILE ... tablespace datafile • Dữ liệu lưu trữ luận lý segment (thông thường table), lưu trữ vật lý datafile • Một tablespace chứa nhiều segment tạo thành từ nhiều datafile Mô hình lưu trữ liệu Oracle Operating... – ALTER TABLESPACE users RENAME DATAFILE '/u02 /oracle/ rbdb1/user1.dbf', '/u02 /oracle/ rbdb1/user2.dbf' TO '/u02 /oracle/ rbdb1/users01.dbf', '/u02 /oracle/ rbdb1/users02.dbf'; Resize a Tablespace... the smallest unit of data, Oracle Database stores data in data blocks The relationships among segments, extents, and data blocks Tablespaces • • • Each tablespace in an Oracle database consists

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

Mục lục

    Tổng quan về tablespace và datafile

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

    Segments, Extents, Blocks, and Rows

    The relationships among segments, extents, and data blocks

    Create and Manage Tablespaces

    Bigfile and smallfile tablespace

    Space Management in Tablespaces

    Extent Management Locally Managed Tablespaces

    Taking a Tablespace Online or Offline

    Taking a Tablespace Online or Offline

Tài liệu cùng người dùng

  • Đang cập nhật ...

Tài liệu liên quan