← Space Management
Oracle · Space Management

How to resize a datafile in Oracle

Resize an Oracle datafile with ALTER DATABASE DATAFILE RESIZE, then verify the new size.

Tested on11g12c19c21c23ai26ai

Change the size of a single datafile, up or down.

This changes a datafile's size. Shrinking fails if data sits above the new size. Review before running.

ALTER DATABASE DATAFILE '&&datafile_path' RESIZE 2G;

-- Verify (read-only)
SELECT file_name, ROUND(bytes/1024/1024) AS size_mb,
       autoextensible, ROUND(maxbytes/1024/1024) AS max_mb
FROM   dba_data_files
WHERE  file_name = '&datafile_path';
datafileresizealter-database