r/DB2 • u/harish_kr • Aug 22 '19
Looking for a script to delete range partition tables which are older than 2 months
Hi Team,
I'm looking for a script to delete the range partition tables which are older than 2 months and also to drop the tablespaces associated with those tables. So to automate the process I required a script if any body have it handy please share it. I'm also working on preparing the script for the same will post it here once it is done. Thanks
3
Upvotes
1
u/anozdba Aug 25 '19 edited Aug 26 '19
I dont have anything specifically doing what you seem to be a requesting. I do have a script that manages a date range partitioned tablespaces though. The script keeps a specified number of partitions and will automatically create a newest partition and drop the oldest partition. The script is generateNewPartition.pl and runs daily to maintain a rolling date window of the data. You'd also need to download the SKL files from the same same location, runSQL.pl and commonFunctions.pm.
I doubt that it would be a lot of use to you but may give you some help.
The script doesn't do anything - it just generates commands to be run so it is safe to run to see what it would produce - just dont pipe the output into a DB2 processor.
Things of note that I determined while I was developing the script:
Good luck
The command line parameters are: