Skip to Main Content

Oracle Database Discussions

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

alter data file size

don123Dec 21 2018 — edited Dec 23 2018

I got following query after google search to find tablespace utilization.

select fs.tablespace_name "Tablespace", (df.totalspace - fs.freespace) "Used MB", fs.freespace "Free MB", df.totalspace "Total MB", round(100 * (fs.freespace / df.totalspace)) "Pct. Free" from

(select tablespace_name, round(sum(bytes) / 1048576) TotalSpace from dba_data_files group by tablespace_name) df, (select tablespace_name, round(sum(bytes) / 1048576) FreeSpace from dba_free_space

group by tablespace_name) fs where df.tablespace_name = fs.tablespace_name and df.tablespace_name='AUDSYS';

Tablespace     used MB     free MB     total MB          pct. Free

AUDSYS          3169          29539          32708                90

Based on the above query, i tried to resize data file as there is 29GB is free, I got error. How to resize this ?

alter database datafile '/data/PMS/audsys01.dbf' resize 10G;

Error report -

SQL Error: ORA-03297: file contains used data beyond requested RESIZE value

03297. 00000 -  "file contains used data beyond requested RESIZE value"

*Cause:    Some portion of the file in the region to be trimmed is

           currently in use by a database object

*Action:   Drop or move segments containing extents in this region prior to

           resizing the file, or choose a resize value such that only free

           space is in the trimmed.

This post has been answered by AndrewSayer on Dec 21 2018
Jump to Answer
Comments
Post Details
Added on Dec 21 2018
6 comments
524 views