User Tools

Site Tools


database:oracle:adjust-tablespace-size

Adjust tablespace size to free up space

Check existing size

 SELECT a.file_name,round(a.bytes/1024/1024) totalsize,b.freesize
                FROM dba_data_files a, (SELECT file_id,round(SUM(bytes/1024/1024)) freesize
                                                               FROM dba_free_space
                                                             GROUP BY file_id
                                                           ) b
WHERE a.file_id=b.file_id(+)
FILENAME                                                        TOTALSIZE   FREESIZE
/home/user/app/user/oradata/userorcl/pdborcl/USER_DATA_WORK.DBF	128	    103
/home/user/app/user/oradata/userorcl/pdborcl/USER_LOB_WORK.DBF	256	    247
...

Free up space

ALTER DATABASE DATAFILE '/home/user/app/user/oradata/userorcl/pdborcl/USER_DATA_WORK.DBF' RESIZE 50K
database/oracle/adjust-tablespace-size.txt · Last modified: 2019/04/23 18:21 by odefta