In previuos post we disscused how to find tablespace frgmantation.Here we will disscus how to avoide table fragmentation in oracle.
Once we identify tablespace fragmentation , what do you do about it? Honeycomb fragmentation is easy to fix. All that needs to be done is to combine adjacent free segments into one by issuing a coalesce statement:
alter tablespace USERS coalesce;
Bubble fragmentation is more difficult to handle. Of course, the best course of action is to prevent it in the first place. The best weapon for this is to use locally-managed tablespaces.If you are using Oracle 8.1.6 or higher you can convert any current dictionary-managed tablespaces to locally-managed tablespaces.
sys.dbms_space_admin .tablespace_migrate_to_local(‘USERS’)
If you are afraid of how long this procedure might take on large tablespaces, do not be. It actually runs very fast. If, for some reason, you would like to take a tablespace that is locally-managed back to dictionary management, you can issue this command:
sys.dbms_space_admin .tablespace_migrate_from_local(‘USERS’)
Expert are always welcome for their valuable comment or suggestion for the above post.