Database

ORA-01653 Tablespace Full: Diagnosis and Resolution (Oracle)

ORA-01653 Tablespace Full: Diagnosis and Resolution (Oracle)

This is not a simple warning but an operational block, with direct impacts on application availability. This error indicates that the database failed to allocate a new extent for a segment within a tablespace, either due to a lack of physical space or configuration constraints.

ORA-01653 Tablespace Full in 60 seconds

When an Oracle tablespace becomes full, operations requiring new space fail with ORA-01653. The solution requires an analysis of datafile configuration and available space, followed by targeted interventions. Here are the essential commands:

# 1. Identify tablespaces with low free space
sqlplus / as sysdba <<EOF
SELECT tablespace_name, ROUND(SUM(bytes)/1024/1024) mb_free
FROM dba_free_space
GROUP BY tablespace_name;
EOF

# 2. Check autoextend and maxsize for a specific tablespace (e.g., USERS)
sqlplus / as sysdba <<EOF
SELECT file_name, bytes/1024/1024 mb, autoextensible, maxbytes/1024/1024 max_mb
FROM dba_data_files
WHERE tablespace_name='USERS';
EOF

# 3. Enlarge an existing datafile (e.g., users01.dbf to 20GB)
sqlplus / as sysdba <<EOF
ALTER DATABASE DATAFILE '/path/users01.dbf' RESIZE 20G;
EOF

# 4. Add a new datafile with autoextend (e.g., users02.dbf to USERS)
sqlplus / as sysdba <<EOF
ALTER TABLESPACE USERS ADD DATAFILE '/u02/oradata/ORCL/users02.dbf' SIZE 10G AUTOEXTEND ON NEXT 1G MAXSIZE 30G;
EOF

# 5. Run Segment Advisor to identify segments to shrink (e.g., for USERS tablespace)
# Example of starting via PL/SQL:
# DECLARE
#   l_task_id   NUMBER;
#   l_task_name VARCHAR(128);
# BEGIN
#   DBMS_ADVISOR.SET_TASK_PARAMETER(l_task_name, 'SCOPE', 'SEGMENT');
#   DBMS_ADVISOR.SET_TASK_PARAMETER(l_task_name, 'TARGET_OBJECT', 'TABLESPACE:USERS');
#   DBMS_ADVISOR.EXECUTE_TASK(l_task_name);
# END;
# /

# 6. Shrink a table (e.g., MY_LARGE_TABLE) after identifying wasted space
sqlplus / as sysdba <<EOF
ALTER TABLE MY_LARGE_TABLE SHRINK SPACE CASCADE;
EOF

Proactive space management in Oracle tablespaces is a critical topic for any database administrator. An error like ORA-01653 is often the final symptom of a chain of suboptimal sizing and monitoring choices. Official Oracle documentation describes ORA-01653 as a condition where the database, during an INSERT or UPDATE operation, fails to allocate the next extent for the affected segment because the tablespace cannot grow further with the configured storage strategy. Suggested countermeasures include increasing the size of one or more datafiles, adding new datafiles, enabling or adjusting AUTOEXTEND, and ultimately, reorganizing segments to reclaim unused space. Correct diagnosis requires the combined use of system views (DBA_DATA_FILES, DBA_FREE_SPACE, DBA_SEGMENTS) and, in more complex contexts, the DBMS_SPACE packages and automatic advisors like the Segment Advisor. This article outlines a complete path for diagnosing and resolving ORA-01653, integrating real command examples, known operational pitfalls, and guidelines updated to currently supported database versions.

Reference versions: Oracle Database 19c, 21c

Prerequisites

To diagnose and resolve ORA-01653, you need appropriate system privileges, typically SYSDBA or a role that includes SELECT privileges on DBA_* views and ALTER TABLESPACE, ALTER DATABASE for datafile modifications. Access to the host operating system is also essential to verify the underlying filesystem status (available space, permissions) and, in ASM environments, to ASMCMD commands for disk group management. Before any intervention, it is always good practice to perform a full database backup or at least of the affected tablespace, to ensure the possibility of a rollback in case of unexpected issues.

What the ORA-01653 error means

According to official Oracle documentation, the error ORA-01653 is issued with the text “unable to increase tablespace tablespace_name by storage_allocated storage_units during insert or update on table schema_name.table_name”. This message immediately highlights two key pieces of information: the tablespace involved and the table that was attempting to grow. In modern product versions, the message specifies storage_allocated and storage_units, which represent the amount of space (expressed in KB, MB, or GB) that the system attempted to add to the tablespace and failed to allocate. The same error family includes a more traditional variant, often seen in legacy scripts, with the text “unable to extend table string.string by string in tablespace string”, where the placeholders indicate the schema, table name, extent size, and tablespace name. The documentation clearly distinguishes the two forms as two descriptions of the same extent allocation problem and associates the same root cause: inability to allocate the requested extent for the table segment in the indicated tablespace [2].

The main technical causes, as summarized by Oracle documentation and third-party analyses, include reaching the size limit of one or more datafiles (for example, files already at the size set with MAXSIZE, or smallfiles reaching their architectural limit), the absence or disabling of AUTOEXTEND, saturation of the filesystem or ASM disk group, and, in some cases, extent fragmentation that prevents finding contiguous space of the required size. This confirms that the error’s cause is not simply the percentage of occupied space, but the combination of allocated space, maximum allowed space by datafiles, automatic extension policy, and the state of the underlying physical storage.

Measuring free space per tablespace

Correctly measuring free and used space in a tablespace is the first necessary step after ORA-01653 occurs. It relies on some fundamental dictionary views: DBA_TABLESPACES, DBA_DATA_FILES, and DBA_FREE_SPACE [8]. DBA_TABLESPACES describes all database tablespaces, while DBA_DATA_FILES lists the datafiles associated with permanent tablespaces, with columns indicating the file name, the tablespace it belongs to, its current size (BYTES), maximum size (MAXBYTES), and autoextend status (AUTOEXTENSIBLE). DBA_FREE_SPACE contains information about free extents, i.e., areas of space not allocated to any segment within the datafiles [16].

To get an overview of free space for each tablespace, it is useful to run the following query:

SELECT tablespace_name, ROUND(SUM(bytes)/1024/1024) mb_free
FROM dba_free_space
GROUP BY tablespace_name;

This command provides an aggregated estimate of free space in MB for each tablespace. However, it says nothing about fragmentation or automatic growth capability. For a more detailed analysis, it is necessary to examine individual datafiles. Read also: PostgreSQL VACUUM: Autovacuum Tuning and Wraparound Risk

To diagnose ORA-01653, it is crucial to measure the difference between the current size of the datafiles and the configured maximum size, especially when using AUTOEXTEND. The AUTOEXTENSIBLE column of DBA_DATA_FILES indicates whether each file is configured to grow automatically, while BYTES and MAXBYTES represent the current size and the maximum achievable size, respectively. For a specific tablespace, for example USERS, you can execute:

SELECT file_name, bytes/1024/1024 mb, autoextensible, maxbytes/1024/1024 max_mb
FROM dba_data_files
WHERE tablespace_name='USERS';

If AUTOEXTENSIBLE is NO, the files have a fixed size. If AUTOEXTENSIBLE is YES but BYTES = MAXBYTES, the file has reached its maximum allowed size. In both cases, the tablespace will not be able to extend further without manual intervention.

Enlarging an existing datafile

Manually enlarging an existing datafile is one of the most direct solutions to resolve ORA-01653, provided that the underlying filesystem or ASM volume has sufficient space [11]. The command ALTER DATABASE DATAFILE 'file_name' RESIZE size instructs the database to increase the datafile size to the specified absolute value, expressed in bytes or with units like M (MB) and G (GB) [13].

For example, to increase a datafile to 20 GB:

ALTER DATABASE DATAFILE '/path/users01.dbf' RESIZE 20G;

This command is immediate and synchronous. It is important to note that RESIZE sets the current size of the file, regardless of automatic AUTOEXTEND mechanisms.

For example:

ALTER TABLESPACE bigtbs RESIZE 500G;

The most common pitfall when resizing datafiles concerns reducing the size: to avoid this, it is necessary to ensure that free space is sufficient and adequately positioned, often through segment shrink operations. Another frequent error is increasing the size in environments with nearly full filesystems or ASM volumes, which leads to the command failing due to insufficient physical space, masking an underlying storage problem.

Adding a new datafile

Adding a new datafile to a tablespace is another effective solution for addressing ORA-01653, especially when you want to distribute the load across different disks or logical volumes, or if an existing datafile has reached its physical limit. The basic syntax is:

ALTER TABLESPACE tablespace_name
ADD DATAFILE 'path/file_name.dbf' SIZE 100M;

This statement creates a new datafile of 100 MB and adds it to the specified tablespace. You can enrich the ADD DATAFILE clause with options like AUTOEXTEND ON NEXT n MAXSIZE m to enable automatic growth of the new file, reducing the need for future manual interventions. Read also: mysqldump Backup: Consistency & MySQL/MariaDB Restore

A practical example to add a datafile to the USERS tablespace with autoextend configured:

ALTER TABLESPACE USERS ADD DATAFILE '/u02/oradata/ORCL/users02.dbf' SIZE 10G AUTOEXTEND ON NEXT 1G MAXSIZE 30G;

This command creates a users02.dbf datafile with an initial size of 10 GB, enabled for autoextend with increments of 1 GB up to a maximum of 30 GB.

Autoextend: useful but with a limit

The AUTOEXTEND feature is a valuable ally for dynamic space management, allowing datafiles to grow automatically when needed. It is configured using clauses like AUTOEXTEND ON NEXT n MAXSIZE m at the time of datafile creation or alteration. When AUTOEXTEND is enabled, Oracle automatically extends the datafile by incrementing it by a value equal to the NEXT size or the current size (up to a maximum of 100 MB) in the case of Oracle Managed Files.

However, automatic growth is limited by MAXSIZE, which represents the maximum allowed size. If MAXSIZE is omitted and the configuration allows it, the datafile can be autoextensible with an unlimited maximum size (UNLIMITED), but it remains constrained by the capacity of the underlying physical storage.

A common mistake is to set MAXSIZE UNLIMITED without monitoring space at the filesystem or ASM disk group level. This can lead to disk saturation, causing the database or other instances sharing the same storage to crash. It is crucial to balance the convenience of autoextend with careful capacity planning, defining MAXSIZE realistically and proactively monitoring disk usage.

Reclaiming space before adding more

In some scenarios, ORA-01653 is not due to an absolute lack of space, but to inefficient management or fragmentation. UPDATE and DELETE operations can free blocks within a segment but leave them below the High Water Mark (HWM), making the space unusable for new allocations. In these cases, the solution is not to add space, but to reclaim existing space.

Oracle offers tools like the Segment Advisor and the SHRINK SPACE operation to compact segments and move the HWM, freeing up contiguous reusable space. The Segment Advisor can be run to identify objects that would benefit from a shrink operation. Once identified, you can shrink a table or an index:

ALTER TABLE MY_LARGE_TABLE SHRINK SPACE CASCADE;

The CASCADE clause propagates the operation to indexes dependent on the table. Reclaiming internal space is often preferable to adding new datafiles, especially in environments with stringent capacity planning policies. Read also: Active Directory Account Locked Out: Event 4740 Origin

Preventing with periodic checks

The best strategy for managing ORA-01653 is prevention. Proactive monitoring of tablespace space can identify growth trends and alert DBAs before an emergency occurs. Oracle Enterprise Manager (OEM) and third-party monitoring tools (such as Zabbix, Prometheus, Netdata) can be configured to generate alerts when tablespaces reach certain usage thresholds (e.g., a significant occupancy quota).

It is useful to schedule periodic queries like those seen earlier (DBA_FREE_SPACE, DBA_DATA_FILES) and analyze growth reports. For example, a query to identify tablespaces that have exceeded a critical fill threshold could be:

SELECT df.tablespace_name,
       ROUND((total_space - free_space) / total_space * 100, 2) AS used_percent
FROM   (SELECT tablespace_name, SUM(bytes) AS total_space FROM dba_data_files GROUP BY tablespace_name) df,
       (SELECT tablespace_name, SUM(bytes) AS free_space FROM dba_free_space GROUP BY tablespace_name) fs
WHERE  df.tablespace_name = fs.tablespace_name
AND    ROUND((total_space - free_space) / total_space * 100, 2) > 85; -- Threshold 85%

This query returns the usage percentage for each tablespace and filters those that exceed a certain threshold. Monitoring these values allows intervention with resize or adding datafiles well before an ORA-01653 occurs. Read also: NIS2 Basic Security Measures: ACN Explained (2026)

Common Errors and Troubleshooting

Exact Error or Message Cause Solution
ORA-01653: unable to extend table... Datafile has reached MAXSIZE or AUTOEXTEND is OFF. Physical space exhausted on filesystem/ASM. High fragmentation. Increase MAXSIZE with ALTER DATABASE DATAFILE ... AUTOEXTEND ON MAXSIZE .... Enable AUTOEXTEND. Increase space on filesystem/ASM. Execute SHRINK SPACE on segments.
ORA-01142: Cannot end online backup Attempt to end a backup for a file that is not in backup mode. End RMAN backup before resizing the datafile.
ORA-01142: Cannot end online backup Attempt to end a backup for a file that is not in backup mode. Execute ALTER TABLE ... SHRINK SPACE or ALTER INDEX ... REBUILD to compact segments in the datafile before attempting resize.
ORA-27054: NFS file system where the file is created or resides is not mounted or is not accessible Problems accessing the NFS filesystem where the datafile resides. Verify the NFS mount point, permissions, and network connectivity.
ORA-15041: diskgroup space exhausted The ASM disk group does not have enough space to extend the datafile. Add disks to the ASM disk group or free up space within the disk group.

Frequently Asked Questions

What exactly does “unable to extend table” mean?

It means that the database attempted to allocate a new block of space (an extent) for a table (or another segment like an index) but failed to find it. This can happen because the datafile has reached its maximum size, the tablespace can no longer grow, or the available space is too fragmented to satisfy the request for a contiguous extent. This error blocks the ongoing DML operation.

Can I enable AUTOEXTEND on an existing datafile?

Yes, you can enable or modify AUTOEXTEND settings on an existing datafile using the command ALTER DATABASE DATAFILE 'file_name' AUTOEXTEND ON NEXT ... MAXSIZE .... This allows the file to grow automatically in the future, but it is essential to define an appropriate MAXSIZE to avoid exhausting physical disk space.

What is the difference between RESIZE and ADD DATAFILE?

RESIZE modifies the size of an existing datafile, increasing or decreasing it. ADD DATAFILE creates a new data file and adds it to the tablespace. RESIZE is useful for expanding a specific file, while ADD DATAFILE is useful for adding overall capacity to the tablespace, distributing space across multiple files or volumes.

Is the Segment Advisor also useful for temporary tablespaces?

No, the Segment Advisor is designed to analyze permanent segments (tables, indexes, LOBs) and identify wasted space that can be reclaimed with shrink operations. For temporary tablespaces, which manage space for sort and hash join operations, it is not applicable. Temporary space management relies on correct sizing of tempfiles and monitoring V$TEMP_SPACE_HEADER and V$TEMPSEG_USAGE views.

Is it always safe to execute SHRINK SPACE on a production table?

In general, SHRINK SPACE can be executed online, meaning the operation does not block access to the table for DML operations. However, the operation can be I/O and CPU intensive, and it might cause a temporary increase in system load. It is always advisable to test the operation in a development or test environment before applying it in production and to schedule it during periods of lower activity.

Conclusions with Operational Takeaways

Managing the ORA-01653 error requires a methodical approach and a deep understanding of Oracle’s space architecture. It is not enough to react to the emergency, but it is fundamental to understand the underlying causes to implement lasting solutions.

The operational takeaways are:

  1. Accurate Diagnosis: The ORA-01653 error does not just indicate a tablespace that is full.

Sources

  • [2] https://docs.oracle.com/en/database/oracle/oracle-database/19/errmg/
  • [5] https://docs.oracle.com/en/database/oracle/oracle-database/19/admin/managing-tablespaces.html#GUID-32431B0D-9271-4716-8025-01584988009A
  • [8] https://docs.oracle.com/en/database/oracle/oracle-database/19/refrn/DBA_TABLESPACES.html
  • [13] https://docs.oracle.com/en/database/oracle/oracle-database/19/sqlrf/ALTER-DATABASE.html#GUID-16F9282D-670F-467C-B28B-12752101467B
  • [16] https://docs.oracle.com/en/database/oracle/oracle-database/19/refrn/DBA_FREE_SPACE.html

Share this article:

Written by

Rosario Giordano

Rosario Giordano is a system administrator and IT consultant specializing in cybersecurity and cloud, with over 20 years of experience managing enterprise Linux infrastructures. His areas of expertise include SSH hardening, Kubernetes platforms, PostgreSQL databases, VMware/ Proxmox virtualization, and compliance with NIS2 and ISO 27001 security frameworks