Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Oracle Tablespace Management (tablespace managment)

2025-02-27 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)06/01 Report--

one。 The official website states that Logical Storage Structures

The contents of ASSM are as follows:

Logical Space Management Oracle Database must use logical space management to track and allocate the extents in a tablespace. When a database object requires an extent, the database must have a method of finding and providing it. Similarly, when an object no longer requires an extent, the database must have a method of making the free extent available.

Oracle Database manages space within a tablespace based on the type that you create. You can create either of the following types of tablespaces:

Locally managed tablespaces (default)

The database uses bitmaps in the tablespaces themselves to manage extents. Thus, locally managed tablespaces have a part of the tablespace set aside for a bitmap. Within a tablespace, the database can manage segments with automatic segment space management (ASSM) or manual segment space management (MSSM).

Dictionary-managed tablespaces

The database uses the data dictionary to manage extents (see "Overview of the Data Dictionary")

Figure 12-3 shows the alternatives for logical space management in a tablespace.

Figure 12-3 Logical Space Management

Description of "Figure 12-3 Logical Space Management"

Locally Managed Tablespaces A locally managed tablespace maintains a bitmap in the data file header to track free and used space in the data file body. Each bit corresponds to a group of blocks. When space is allocated or freed, Oracle Database changes the bitmap values to reflect the new status of the blocks.

The following graphic is a conceptual representation of bitmap-managed storage. A 1 in the header refers to used space, whereas a 0 refers to free space.

A locally managed tablespace has the following advantages:

Avoids using the data dictionary to manage extents

Recursive operations can occur in dictionary-managed tablespaces if consuming or releasing space in an extent results in another operation that consumes or releases space in a data dictionary table or undo segment.

Tracks adjacent free space automatically

In this way, the database eliminates the need to coalesce free extents.

Determines the size of locally managed extents automatically

Alternatively, all extents can have the same size in a locally managed tablespace and override object storage options.

Note:

Oracle strongly recommends the use of locally managed tablespaces with Automatic Segment Space Management.

Segment space management is an attribute inherited from the tablespace that contains the segment. Within a locally managed tablespace, the database can manage segments automatically or manually. For example, segments in tablespace users can be managed automatically while segments in tablespace tools are managed manually.

Automatic Segment Space Management

The ASSM method uses bitmaps to manage space. Bitmaps provide the following advantages:

Simplified administration

ASSM avoids the need to manually determine correct settings for many storage parameters. Only one crucial SQL parameter controls space allocation: PCTFREE. This parameter specifies the percentage of space to be reserved in a block for future updates (see "Percentage of Free Space in Data Blocks")

ASSM management, only one parameter is required: PCTFREE

Increased concurrency

Multiple transactions can search separate lists of free data blocks, thereby reducing contention and waits. For many standard workloads, application performance with ASSM is better than the performance of a well-tuned application that uses MSSM.

Dynamic affinity of space to instances in an Oracle Real Application Clusters (Oracle RAC) environment

ASSM is more efficient and is the default for permanent, locally managed tablespaces.

Note:

This chapter assumes the use of ASSM in all of its discussions of logical storage space.

Manual Segment Space Management

The legacy MSSM method uses a linked list called a free list to manage free space in the segment. For a database object that has free space, a free list keeps track of blocks under the high water mark (HWM), which is the dividing line between segment space that is used and not yet used. As blocks are used, the database puts blocks on or removes blocks from the free list as needed.

In addition to PCTFREE, MSSM requires you to control space allocation with SQL parameters such as PCTUSED, FREELISTS, and FREELIST GROUPS.PCTUSED sets the percentage of free space that must exist in a currently used block for the database to put it on the free list. For example, if you setPCTUSED to 40 in a CREATE TABLE statement, then you cannot insert rows into a block in the segment until less than 40 of the block space is used.

As an illustration, suppose you insert a row into a table. The database checks a free list of the table for the first available block. If the row cannot fit in the block, and if the used space in the block is greater than or equal to PCTUSED, then the database takes the block off the list and searches for another block. If you delete rows from the block, then the database checks whether used space in the block is now less than PCTUSED. If so, then the database places the block at the beginning of the free list.

An object may have multiple free lists. In this way, multiple sessions performing DML on a table can use different lists, which can reduce contention. Each database session uses only one free list for the duration of its session.

As shown in Figure 12-4, you can also create an object with one or more free list groups, which are collections of free lists. Each group has a master free list that manages the individual process free lists in the group. Space overhead for free lists, especially for free list groups, can be significant.

Figure 12-4 Free List Groups

Description of "Figure 12-4 Free List Groups"

Managing segment space manually can be complex. You must adjust PCTFREE and PCTUSED to reduce row migration (see "Chained and Migrated Rows") and avoid wasting space. For example, if every used block in a segment is half full, and if PCTUSED is 40, then the database does not permit inserts into any of these blocks. Because of the difficulty of fine-tuning space allocation parameters, Oracle strongly recommends ASSM. In ASSM, PCTFREE determines whether a new row can be inserted into a block, but it does not use free lists and ignores PCTUSED.

-- ASSM ignores the PCTUSED parameter

Dictionary-Managed Tablespaces

A dictionary-managed tablespace uses the data dictionary to manage its extents. Oracle Database updates tables in the data dictionary whenever an extent is allocated or freed for reuse. For example, when a table needs an extent, the database queries the data dictionary tables, and searches for free extents. If the database finds space, then it modifies one data dictionary table and inserts a row into another. In this way, the database manages space by modifying and moving data.

The SQL that the database executes in the background to obtain space for database objects is recursive SQL. Frequent use of recursive SQL can have a negative impact on performance because updates to the data dictionary must be serialized. Locally managed tablespaces, which are the default, avoid this performance problem.

two。 ASSM description

Before Orale 9i, the management and allocation of the remaining space of the table was completed by the linked list freelist, because freelist has serial problems, so it is easy to cause paragraph header contention and space waste (in fact, this is not obvious), the most important thing is that DBA needs to spend a lot of energy to manage these contention and monitor the space utilization of the table. Automatic Segment Space Management (ASSM), which first appeared in Oracle 920. With ASSM, the linked list freelist is replaced by a bitmap, which is a binary array that can quickly and efficiently manage storage extensions and remaining blocks (free block), thus improving the nature of segmented storage. Segments created on ASSM tablespaces are also called Bitmap Managed Segments (BMB segments).

Let's look at how the bitmap freelist is implemented. Start by creating a tablespace using the section space management automatic parameters: create tablespace demo datafile'/ ora01/oem/demo01.dbf 'size 5m EXTENT MANAGEMENT LOCAL-- Turn on LMT SEGMENT SPACE MANAGEMENT AUTO-- Turn on ASSM;

Once you have defined the tablespace, tables and indexes can be easily moved to the new tablespace using a variety of methods, and the local management tablespace with ASSM omits any values specified for PCTUSED, NEXT, and FREELISTS.

When a table or index is assigned to the tablespace, the value of the PCTUSED for the independent object is ignored, and Oracle9i uses a bitmap array to automatically manage the freelist of the table and index in the tablespace. This NEXT extension clause is outdated for tables and indexes created within LMT's tablespace because the locally managed tablespace manages them. However, the INITIAL parameter is still required because it is impossible for Oracle to know in advance the size of the initial table load. For ASSM, the minimum value of INITIAL is three blocks.

The new management mechanism uses bitmaps to track or manage each block assigned to an object, and the amount of space left in each block is determined according to the state of the bitmap, such as > 75%, 50%, 50%, 75, 25, 50, and.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Database

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report