Been looking to do some cleanup and I wanted an easy way to do it. So...I wrote this script. I can take the list returned and either make it a macro or an internal TSM script. Sure I could build a shell script that processed a list with the TSM server_name, the node_name, and FSID but I thought I'd show how you can create a command out of SQL returned data.
select 'del filespace ' || node_name || ' ' || cast(FILESPACE_ID as char(3)) || ' type=backup nametype=fsid wait=yes' AS COMMAND from filespaces where cast((current_timestamp-backup_end)days as decimal)>90
Here is an example of the results from the script:
COMMAND
------------------------------------------------------------
del filespace NODE1 37 type=backup nametype=fsid wait=yes
del filespace NODE1 9 type=backup nametype=fsid wait=yes
del filespace NODE1 36 type=backup nametype=fsid wait=yes
del filespace NEO_1 32 type=backup nametype=fsid wait=yes
del filespace NEO_1 31 type=backup nametype=fsid wait=yes
del filespace NEO_1 23 type=backup nametype=fsid wait=yes
del filespace NEO_1 29 type=backup nametype=fsid wait=yes
Chad,
ReplyDeleteCan you give me a scenario where you would have a need to clean up filespaces like this? Some sort of database backups? I haven't (yet) run across a need to do something like this, so I'm curious.
Thanks!
Tom
Chad,
ReplyDeleteThanks, I have been looking for something like this. Does your script take input from command line, specifically the host/client name ?
Great! thank you. Once more question, I am actually interested in a shell script. So can I assume I can do something like this.
ReplyDelete1. script name del_fs
2. dsmadmc -id=xx -pass=xx "select 'del filespace ' || node_name || ' ' || cast(FILESPACE_ID as char(3)) || ' type=backup nametype=fsid wait=yes' AS COMMAND from filespaces where cast((current_timestamp-backup_end)days as decimal)>90 and node_name='$1'"
3. so then basically I can run ./del_fs NODE1 and it would delete ALL instances of the filespace using FSID #
I am intersted in deleting ALL instances of the filespace and the node itself.
Thank you so much.
Thank you for the script. One more question, how do you create a custom script on the server, sorry total newbie with not proper training. I did look on the TSM ISC but it looked like it wanted me to pick a specific task. Furthermore, I would prefer to use the command line. If you could show me how to create the custom script within TSM that would be fantastic.
ReplyDeleteThank you so much.