ORA-03297 on Oracle Tablespace alter I have a database with 4500GB storage on AWS RDS. My "users" tablespace has 3749700 MB allocated. Out of which 1583777.63 MB is used and 2165922.38 MB is free.

When I do:

alter tablespace users resize 3500G;


It gives me:

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.

I have tried this - http://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/Appendix.Oracle.CommonDBATasks.html#Appendix.Oracle.CommonDBATasks.CreatingTablespacesAndDatafiles


How can I fix my tablespace?
You have segments allocated across the tablespace with "gaps" of free space. 
In order to reclaim it you should first reorg the tablespace. 
See: reclaiming unused space
https://oracle-base.com/articles/misc/reclaiming-unused-space
It's a rather long process for such a large file.... 
Btw, if you have EM installed it's just a couple of mouse clicks 

Regards 
Jony