Oracle 23.26SpaceLab-verified · 2026-12-01

ORA-01658: unable to create INITIAL extent for table in tablespace

A table is getting its first extent, and the tablespace cannot give it that many blocks.

Oracle AI Database 26ai Free 23.26.3.0.0
ORA-01658: unable to create INITIAL extent for table SALES_SUMMARY by 8 blocks in tablespace LAB_DATA

Jump to a cause

  1. 01The tablespace is already full when a new table gets its first row
  2. 02STORAGE (INITIAL 20M) in the DDL is bigger than the tablespace

Lab-verifiedReproduced and fixed on Oracle AI Database 26ai Free 23.26.3.0.0 · 2026-12-01 · container image gvenzl/oracle-free:23-slim

ORA-01658 is raised when a table's segment is created and the tablespace cannot hold its first (INITIAL) extent. With deferred segment creation, CREATE TABLE itself succeeds and the error shows up on the first INSERT, which is why it often looks like an INSERT problem.

The message tells you the table, the number of blocks it asked for, and the tablespace: unable to create INITIAL extent for table SALES_SUMMARY by 8 blocks in tablespace LAB_DATA. A small number like 8 means the tablespace is full; a large number like 2560 means the table asked for a huge first extent.

01The tablespace is already full when a new table gets its first row

LAB_DATA was one 2MB datafile with AUTOEXTEND OFF, already filled by another table (sales_hist, 3,750 rows). CREATE TABLE sales_summary worked, but the first INSERT failed with by 8 blocks in tablespace LAB_DATA — the table only needed 8 blocks and even that was not available.

After ALTER DATABASE DATAFILE '.../lab_data01.dbf' RESIZE 20M; the same INSERT succeeded and COUNT(*) returned 1.

Setup
Setuprun as system
DROP TABLESPACE IF EXISTS lab_data INCLUDING CONTENTS AND DATAFILES;
CREATE SMALLFILE TABLESPACE lab_data DATAFILE '/opt/oracle/oradata/FREE/FREEPDB1/lab_data01.dbf' SIZE 2M REUSE AUTOEXTEND OFF;
ALTER USER lab_a QUOTA UNLIMITED ON lab_data;
OUTPUT
Tablespace dropped.


Tablespace created.


User altered.
Setuprun as lab_a
CREATE TABLE sales_hist (sale_id NUMBER, note VARCHAR2(200)) TABLESPACE lab_data;
INSERT INTO sales_hist SELECT level, RPAD('x', 200, 'x') FROM dual CONNECT BY level <= 3750;
COMMIT;
CREATE TABLE sales_summary (sale_month DATE, total NUMBER) TABLESPACE lab_data;
OUTPUT
Table created.


3750 rows created.


Commit complete.


Table created.
Reproducerun as lab_a
INSERT INTO sales_summary VALUES (DATE '2026-11-01', 1500000);
✕ ERROR
INSERT INTO sales_summary VALUES (DATE '2026-11-01', 1500000)
            *
ERROR at line 1:
ORA-01658: unable to create INITIAL extent for table SALES_SUMMARY by 8 blocks in tablespace LAB_DATA
Help: https://docs.oracle.com/error-help/db/ora-01658/
Check the causerun as system
COLUMN file_name FORMAT A50
SELECT file_name, bytes/1024/1024 AS size_mb, autoextensible FROM dba_data_files WHERE tablespace_name = 'LAB_DATA';
SELECT NVL(SUM(bytes), 0) AS free_bytes FROM dba_free_space WHERE tablespace_name = 'LAB_DATA';
OUTPUT
FILE_NAME                                             SIZE_MB AUT
-------------------------------------------------- ---------- ---
/opt/oracle/oradata/FREE/FREEPDB1/lab_data01.dbf            2 NO

1 row selected.


FREE_BYTES
----------
         0

1 row selected.

dba_data_files shows SIZE_MB 2 and AUT NO, and dba_free_space returns FREE_BYTES 0: no free space and no autoextend.

Fixrun as system
ALTER DATABASE DATAFILE '/opt/oracle/oradata/FREE/FREEPDB1/lab_data01.dbf' RESIZE 20M;
OUTPUT
Database altered.

Turning on autoextend or adding a datafile also gives the tablespace room; this run used RESIZE.

After the fixrun as lab_a
INSERT INTO sales_summary VALUES (DATE '2026-11-01', 1500000);
COMMIT;
SELECT COUNT(*) FROM sales_summary;
✓ SUCCESS
1 row created.


Commit complete.


  COUNT(*)
----------
         1

1 row selected.

02STORAGE (INITIAL 20M) in the DDL is bigger than the tablespace

The table was created with STORAGE (INITIAL 20M) (a value copied from production DDL is a typical way this happens) in a 5MB tablespace. CREATE succeeded, but the first INSERT failed with by 2560 blocks — 2,560 blocks is the whole 20MB INITIAL extent at 8KB blocks.

ALTER TABLE cust_master MOVE STORAGE (INITIAL 64K); rebuilt the table with a small first extent. The INSERT then worked and user_tables showed INITIAL_KB 64, SEGMENT_CREATED YES.

Setup
Setuprun as system
DROP TABLESPACE IF EXISTS lab_data INCLUDING CONTENTS AND DATAFILES;
CREATE SMALLFILE TABLESPACE lab_data DATAFILE '/opt/oracle/oradata/FREE/FREEPDB1/lab_data01.dbf' SIZE 5M REUSE AUTOEXTEND OFF;
ALTER USER lab_a QUOTA UNLIMITED ON lab_data;
OUTPUT
Tablespace dropped.


Tablespace created.


User altered.
Setuprun as lab_a
CREATE TABLE cust_master (
  cust_id NUMBER PRIMARY KEY,
  cust_name VARCHAR2(100)
) TABLESPACE lab_data
STORAGE (INITIAL 20M);
OUTPUT
Table created.
Reproducerun as lab_a
INSERT INTO cust_master VALUES (1, 'ACME');
✕ ERROR
INSERT INTO cust_master VALUES (1, 'ACME')
            *
ERROR at line 1:
ORA-01658: unable to create INITIAL extent for table CUST_MASTER by 2560 blocks in tablespace LAB_DATA
Help: https://docs.oracle.com/error-help/db/ora-01658/
Check the causerun as lab_a
SELECT table_name, tablespace_name, initial_extent/1024/1024 AS initial_mb, segment_created FROM user_tables WHERE table_name = 'CUST_MASTER';
OUTPUT
TABLE_NAME                     TABLESPACE_NAME                INITIAL_MB SEG
------------------------------ ------------------------------ ---------- ---
CUST_MASTER                    LAB_DATA                               20 NO

1 row selected.

user_tables shows INITIAL_MB 20 and SEGMENT_CREATED NO: the table has no segment yet and will ask for 20MB on its first row.

Fixrun as lab_a
ALTER TABLE cust_master MOVE STORAGE (INITIAL 64K);
OUTPUT
Table altered.

Adding space to the tablespace would also work, but if 20MB was never intended, shrinking INITIAL is the real fix.

After the fixrun as lab_a
INSERT INTO cust_master VALUES (1, 'ACME');
COMMIT;
SELECT table_name, initial_extent/1024 AS initial_kb, segment_created FROM user_tables WHERE table_name = 'CUST_MASTER';
✓ SUCCESS
1 row created.


Commit complete.


TABLE_NAME                     INITIAL_KB SEG
------------------------------ ---------- ---
CUST_MASTER                            64 YES

1 row selected.

FAQ

Why does ORA-01658 happen on INSERT and not on CREATE TABLE?

With deferred segment creation the table has no segment until the first row arrives. In both runs CREATE TABLE returned Table created., user_tables showed SEGMENT_CREATED NO, and the extent was requested by the first INSERT.

What does "by 8 blocks" or "by 2560 blocks" mean in ORA-01658?

It is the size of the INITIAL extent the table asked for. 8 blocks failing means the tablespace is full; 2560 blocks (20MB with 8KB blocks) came from STORAGE (INITIAL 20M).

How do I fix ORA-01658?

Check the tablespace with dba_data_files / dba_free_space and the table's initial_extent in user_tables. Then either give the tablespace space (ALTER DATABASE DATAFILE ... RESIZE 20M) or make INITIAL smaller (ALTER TABLE ... MOVE STORAGE (INITIAL 64K)).

What is the difference between ORA-01658 and ORA-01653?

ORA-01658 is about the first extent of a table that has no segment yet. ORA-01653 is raised when an existing table needs another extent and cannot get it.

How we verify

Each scenario starts from fresh database users. A script runs the setup, confirms the exact error code, applies the fix and runs the statement again. The output shown is what the database printed, saved by the script.

lab_a and lab_b are ordinary users created for the test; system is the DBA account. Oracle AI Database 26ai Free Release 23.26.3.0.0 - Develop, Learn, and Run for Free 23.26.3.0.0