An administrator can control the deletion of billing environments that have a huge amount of data (e.g., with millions of customers) on Oracle-based installations in PortaBilling.
To delete the environment, run this script:
/home/porta-admin/porta-admin.pl drop <env_name>,
where <env_name> is the name of the billing environment.
The environment entities are deleted from the database tables in batches of 10,000 records. The batch size is hardcoded.
The administrator can manage environment deletion as follows:
- Monitor environment deletion progress – you can view the total number of entities to be deleted and the number of already deleted entities;
- Estimate the deletion time left – compare the total number of environment entities, the number of already deleted entities, and the time spent on deletion.For example, it took 10 mins. to delete 10,000 entities. There are 100,000 more entities left. Thus, an administrator estimates that it will take about 100 mins. to delete the remaining entities;
- Stop the deletion process and restart it later – you can stop the deletion process by using the Ctrl + C combination. To restart the environment deletion, rerun the script. The system rechecks already processed tables. If there are no new entities, the environment deletion continues from where it was stopped.
The environment deletion flow:
For example, let’s say that an administrator has planned the environment deletion for 10 a.m. They run the porta-admin.pl script at the designated time and monitor the deletion progress. In a few hours, the administrator notices that the system is overloaded. To prevent service degradation, they stop the script execution.
The administrator reschedules the environment deletion for off-peak hours instead and reruns the porta-admin.pl script. In about 3 hours the environment is completely deleted from the database.