Friday, June 6, 2008

Rebinding TSM archives so they do not expire

I have some TSM archives on an AIX host with a short expiration period of 14 days that I needed to extend for an unknown amount of time, I thought this would be an easy task but it took me a minute to figure out exactly how to quickly and efficiently get this done. To stop expiration on an archive you have to use the 'set event type=hold' command in from 'dsmc', the documentation on the command is complete but sparse with few examples so I had play with it to understand it. The most important thing I learned was that you cannot use a '*' to specify all files in an archive having a specific description - but you can specify just the base directory (in TSM terms 'filespace_name' from the archives table) and append a '/' (example: '/directory/) and it will pick up all of the files in the archive under the base directory.

First build the file list, this can be done easily a sql select statement from within dsmadmc :
select distinct(filespace_name) from archives where node_name='node name' and description='archive description here' > outfile
Then I needed to add a '/' character to the end of each line from the command line using awk:
# cat outfile | awk '{ print $1"/"}' > filelist.out

Alternately you could have selected filespace_name and hl_name and used awk to print both columns without a space between, either way the results should be the same...
Now I had a file that looked similar to this:
/aaaa/
/bbbb/
/cccc/
/db/abcd/
/db/efgh/
/db/ijkl/
/db/mnop/
/db/qrst/
/db/uvwx/
/db/yz/
/eeee/
/ffff/

each entry is a seperate mount point for a filesystem which is why /db/ would not have worked correctly.

Load this file into dsmc using the set event command:
set event -type=hold -filelist=filelist.out -description="Some unique description here"

output like:
....
ANS1899I ***** Examined 35,000 files *****
ANS1899I ***** Examined 36,000 files *****
ANS1899I ***** Examined 37,000 files *****
ANS1899I ***** Examined 38,000 files *****
ANS1899I ***** Examined 39,000 files *****
....

Total number of objects archived: 0
Total number of objects failed: 0
Total number of objects rebound: 82781
Total number of bytes transferred: 0 B
Data transfer time: 0.00 sec
Network data transfer rate: 0.00 KB/sec
Aggregate data transfer rate: 0.00 KB/sec
Objects compressed by: 0%
Elapsed processing time: 00:04:26
tsm>

After the files were rebound I jumped onto dsmadmc to make sure I had gotten every file rebound, I did this by selecting the number of objects from the archive and comparing it to the number of objects rebound:
select count(*) as "# of archived objects" from archives where description='Some unique description here' and node_name='node_name'

# of archived objects
---------------------
82781

Looks good!
This was by far the fastest way to rebind all these objects. I also tried selecting each individual object from the tsm database and loading that as the filelist into dsmc (a file with 82781 lines), after about 10 hours of processing dsmc core dumped. My other thought was to use the filelist containing every object and running it in a for loop so each object was processed individually - this would have worked but the time for completion would have been much longer.

1 comment:

Lynne said...

Hi,

I know it's been well over 2 years since you posted this, but I thought I would just drop in a note of appreciation. I just found it today, and I believe it solves a big problem which I'd been having with certain of our archives. I can keep them from expiring without having to restore them to disk and re-archiving, and that is ALL good.

Thank you so much for taking the trouble to stick this up on the web.