We use a CMS System (which uses in the background an oracle database I guess). CMS (so the DB keeps thousands of images as blobs) problem is when we make a bulk delete in CMS with our custom deletion tool(expecting the DB size will get smaller) But Zabbix monitoring we saw the DB size mysteriosly started to increase!
Any “ideas” where the problem can be? maybe DB needs an update, or clear up command? Or its a CMS bug which tries to backups everything deleted? but it does not make sense as well.
Thanks
This may seem surprising at first, but it is not once you consider what a database is designed for. A database is an advanced method of storing data on disk, optimized especially for the following tasks:
A corollary of both these requirements is that data won’t be freed immediately when you delete something. In the case of (1), that is because data is stored in a table format on disk for fast access; for Oracle to free up disk space when you delete some of the records, everything would have to be moved around and reorganized. In the case of (2), when you delete things, Oracle expects that you may add new records in the future. Thus, it saves the space so that it can be quickly used again when you add something new.
All of this means you shouldn’t expect the disk storage to decrease simply because you have deleted some records. (As Albin Sunnanbo pointed out, if there is a slight increase, it is probably due to transaction logs).
If you need to reduce the disk space that a database is using, there are various strategies to directly tell the database to do that. I’m not an Oracle user, but this discussion seemed helpful.