Friday, April 29, 2011

Delete Old Filespaces

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

1 comment:

  1. Chad,

    Can 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

    ReplyDelete