In a DB2 federated database (based on remote servers and nicknames), I need to clean up the model and recreate it from another database. I need to delete every database object except those servers and nicknames.
I know how to retrieve the list of objects from the SYSCAT schema. Now I need to run the DROP statements on each. Obviously the dependencies will get in the way.
The brute force approach would be to run the DROPs in a loop until all have succeeded, but depending on the order (lucky or not), it could take a very long time.
Would you know a way to efficiently order the DROP statement so that the total time for the deletion is the shortest possible?
A perfect solution is not expected. A reasonably clever solution is good enough.
Thank you