Database Monitoring   «Prev  Next»
Lesson 9Checking for objects that will not extend
Objective Find objects that will fail to extend.

Check for Database Objects which will not extend in Oracle 19c

To identify "database objects that will not extend" in Oracle 19c, you need to examine the storage settings and tablespace configurations that might prevent automatic or manual space allocation. Here are the steps you can follow:
  1. Check for Tablespace Space Issues

    Database objects typically won't extend if their underlying tablespace has run out of space or does not have auto-extension enabled.

    Query to check tablespace usage:

    SELECT
        tablespace_name,
        file_name,
        bytes / 1024 / 1024 AS size_in_mb,
        maxbytes / 1024 / 1024 AS max_size_in_mb,
        autoextensible
    FROM
        dba_data_files
    WHERE
        tablespace_name NOT IN ('SYSTEM', 'SYSAUX', 'TEMP');
        
    • Key points to check:
      • AUTOEXTENSIBLE = NO: The file will not grow automatically.
      • SIZE_IN_MB close to MAX_SIZE_IN_MB: The file is near its maximum allowed size.
      • Tablespaces with no free space will block object growth.
  2. Check Free Space in Tablespaces

    To confirm if there is available space in the tablespace:

    SELECT
        tablespace_name,
        SUM(bytes) / 1024 / 1024 AS free_space_mb
    FROM
        dba_free_space
    GROUP BY
        tablespace_name;
        
  3. Identify Objects Near or At Maximum Extents

    Objects in Oracle 19c may fail to extend if they reach the maximum number of extents allowed by their storage clause.

    Query to check objects near maximum extents:

    SELECT
        segment_name,
        segment_type,
        owner,
        tablespace_name,
        extents,
        max_extents
    FROM
        dba_segments
    WHERE
        max_extents IS NOT NULL
      AND extents >= max_extents;
        
    • Key points:
      • EXTENTS: The current number of extents allocated to the object.
      • MAX_EXTENTS: The maximum allowed extents (can be UNLIMITED for modern configurations).
  4. Check for Space Allocation Settings of Objects

    Certain storage parameters (like PCTINCREASE or INITIAL) might prevent an object from allocating more extents.

    Query to check storage parameters for objects:

    SELECT
        segment_name,
        segment_type,
        owner,
        tablespace_name,
        initial_extent,
        next_extent,
        pct_increase
    FROM
        dba_segments
    WHERE
        tablespace_name = 'YOUR_TABLESPACE_NAME';
        
    • Key points:
      • NEXT_EXTENT: The size of the next extent to be allocated.
      • If NEXT_EXTENT exceeds the available free space in the tablespace, the object will not extend.
      • PCT_INCREASE: Ensure it is reasonable (a value of 0 is typical for modern databases).
  5. Check for Quota Issues

    Users with limited quota on a tablespace might also cause objects not to extend.

    Query to check user quotas:

    SELECT
        tablespace_name,
        username,
        bytes / 1024 / 1024 AS allocated_mb,
        max_bytes / 1024 / 1024 AS max_allocated_mb
    FROM
        dba_ts_quotas
    WHERE
        max_bytes > 0 -- Only users with quotas
      AND bytes >= max_bytes;
        
  6. Identify Objects in READ-ONLY Tablespaces

    Objects in READ-ONLY tablespaces cannot extend.

    Query to find tablespaces in READ-ONLY mode:

    SELECT
        tablespace_name,
        status
    FROM
        dba_tablespaces
    WHERE
        status = 'READ ONLY';
        
  7. Review Alert Logs for Space-Related Errors

    If there are persistent issues with object extensions, the Oracle alert log often provides clues about which objects are failing and why.

Common Fixes
  1. Enable Auto-extend for Tablespace Files:
    ALTER DATABASE DATAFILE '/path/to/datafile.dbf'
    AUTOEXTEND ON NEXT 50M MAXSIZE UNLIMITED;
        
  2. Increase Tablespace Size:
    ALTER DATABASE DATAFILE '/path/to/datafile.dbf' RESIZE 1G;
        
  3. Move the Object to a Bigger Tablespace:
    ALTER TABLE schema.table_name MOVE TABLESPACE larger_tablespace;
        
  4. Adjust Storage Parameters:
    ALTER TABLE schema.table_name STORAGE (NEXT 128K MAXEXTENTS UNLIMITED);
        
  5. Increase User Quota:
    ALTER USER username QUOTA UNLIMITED ON tablespace_name;
        

These steps will help you identify and resolve any issues with objects that cannot extend in Oracle 19c.


Finding objects that will fail to extend

Related to checking the amount of free space in a tablespace, you may want to check for objects that are in imminent danger of failing to extend. To do this, you need to check for three things:
  1. Objects with next extent values greater than the largest free extent in that object'stablespace
  2. Tablespaces with minimum extent sizes greater than their largest free extent
  3. Objects that have already been allocated their maximum number of extents
You can check for these cases by querying Oracle's data dictionary views.
The following series of images show some data dictionary queries that you can use to identify objects that will not be able to extend:

SELECT s.tablespace_name,
       s.owner,
       s.segment_type,
       s.segment_name,
       s.next_extent,
       MAX(NVL(fs.bytes,0))
FROM dba_segments s,
     dba_free_space fs
WHERE s.tablespace_name 
    = fs.tablespace_name(+)
GROUP BY s.tablespace_name,
         s.owner, s.segment_type,
         s.segment_name, s.next_extent
HAVING s.next_extent > MAX(NVL(fs.bytes,0));
1) The DBA_SEGMENTS view will tell you the next extent size for all segments in the database, whether they are tables, indexes, partitions, or some other type of object. This query joins DBA_SEGMENTS to DBA_FREE_SPACE, and returns a list of segments with next extent sizes greater than the largest free extent in their tablespace.
This query identifies segments whose next extent size is larger than the largest free extent available in the tablespace, which helps in identifying potential space issues in Oracle databases.


SELECT t.tablespace_name,
       t.min_extlen,
       MAX(NVL(fs.bytes,0))
FROM dba_tablespaces t,
     dba_free_space fs
WHERE t.tablespace_name 
    = fs.tablespace_name(+)
GROUP BY t.tablespace_name, t.min_extlen
HAVING t.min_extlen > MAX(NVL(fs.bytes,0));
2) "Tablespaces may optionally have a minimum extent size set, and you have to take that into account too. The query shown here returns a list of tablespaces that do not have a free extent at least as large as their minimum extent size."
This query helps identify tablespaces where the minimum extent size is larger than the available free extent, which can cause issues when allocating space.

SELECT s.owner,
       s.segment_name,
       s.segment_type,
       s.max_extents,
       COUNT(extent_id)
FROM dba_segments s,
     dba_extents e
WHERE s.owner = e.owner
  AND s.segment_name = e.segment_name
  AND s.segment_type = e.segment_type
GROUP BY s.owner, s.segment_name,
         s.segment_type, s.max_extents
HAVING s.max_extents = COUNT(extent_id);
3) "Objects such as tables, partitions, clusters, and indexes all have maximum sizes that are specified in terms of a maximum number of extents. The DBA_EXTENTS view returns information about the extents assigned to an object. This query counts up the extents for each object and compares the results to that object’s MAX_EXTENTS value in order to identify objects that have reached the limit of their growth."
This query helps detect database objects (like tables or indexes) that have already reached their maximum number of extents, indicating they cannot grow further without intervention.


How to deal with this situation

You should consider adding space to any tablespaces identified by these queries to ensure that you have enough free space to allow objects that are stored in that tablespace to grow in size. You can add space by adding data files or by increasing the size of existing data files. If you find objects that have reached their maximum in terms of the number of extents, consider increasing that maximum.
  • Caveats If you use the autoextend option when creating the data files for a tablespace, Oracle will attempt to resize those files whenever more free space is needed. Consequently, segments in that tablespace may be able to extend even if there is currently not enough free space for them to do so. If you're using Oracle8i, be aware that Oracle8i implements a new type of tablespace known as the locally managed tablespace. There are different rules for extent allocation in locally managed tablespaces, and the queries shown here don't apply.

In the next lesson, you will compute the cache hit ratio.

Checking for Objects - Quiz

Click the Quiz link to answer a few questions about free space and extents.
Checking for Objects - Quiz

SEMrush Software 9 SEMrush Banner 9