Thanks to Gary Ison and Lhing (Chintawongvanich) for your suggestions
regarding this problem. I have got round to concocting a bit of perl
to basically get the volumes for a particular storage pool and for each of
these search for non '1/1' segments - and from this I can derive a list
of pairs of tapes over which a backup is split. So before performing
a MOVE DATA for a particular tape I can look in this list and determine
whether another tape will be needed.
It takes a little while to run scanning through the contents of each volume
but is OK for the 100 odd tapes I have. There may be a quicker way to do
this assuming the split segments are always the first or last entry but
I'll save that for another day.
For those interested, the perl script is included at the end of this mail.
>-----Original Message-----
>Sent: Thursday, March 02, 2000 6:39 AM
>
>I am reclaiming space from tape volumes using the MOVE DATA command.
>More often than not, after starting the command , you see that it
>requires an associated tape volume as well as the one you are trying
>to empty.
>
>Is there any way I can determine, before giving the command,
>what other tapes will be needed for successful completion of the
>MOVE DATA command ? When many of the tapes in question are outside of
>the tape library, it will obviously be helpful to be able to load up
>all the tapes that might be required at once.
>
#! /usr/local/rbin/perl5
# Script to find tape volumes containing 'partial segments',
# ie. backups split over 2 tapes, for specified storage pool.
# Takes one argument : name of storage pool
# Writes results to standard out
# Written by S.Bridge March 2000
sub issuesql {
# Takes one argument, the SQL command
# Returns only the header and detail lines resulting from the command
# and places in array @info
local($sql) = @_;
local(@info) = ();
local($pa,$printnext,$prevline);
chop($pa=`cat /etc/secretplace/adminq`);
open(SQLC,"dsmadmc -id=adminq -pa=$pa -out \"$sql\"|");
$printnext = 0;
while (<SQLC>) {
if (/----/) {
push(@info,$prevline);
$printnext = 1;
}
elsif ( $printnext != 0 ) {
if ( length > 1 ) {
push(@info,$_);
}
else {
last;
}
}
$prevline = $_;
}
close(SQLC);
return @info;
}
# End of subroutine issuesql
sub issuetabsql {
# Takes one argument, the SQL command
# This is issued with the -tab flag and therefore returns detail
# lines and no header lines.
# I make the assumption that details appear only after the 2nd blank
# line ( possibly only true for this admin client 3.1.0.7 )
# Returns only the detail lines resulting from the command
# and places in array @info
local($sql) = @_;
local(@info) = ();
local($pa,$printnext,$prevline);
chop($pa=`cat /etc/secretplace/adminq`);
open(SQLC,"dsmadmc -id=adminq -pa=$pa -tab -out \"$sql\" |");
$blanks = 0;
while (<SQLC>) {
if (/^$/) {
$blanks ++;
}
else {
if ( $blanks == 2 ) {
push(@info,$_);
}
}
}
close(SQLC);
@info = () if $?;
return @info;
}
# End of subroutine issuetabsql
$stgpool=$ARGV[0];
@vols = &issuesql("select volume_name from volumes where
stgpool_name=upper('$stgpool')");
$headers = shift(@vols);
foreach $volume (@vols) {
$volume =~ s/ *\n//;
@result = &issuetabsql("select file_name from contents where
volume_name='$volume' and segment<>'1/1'");
foreach $filename (@result) {
chop $filename;
$filetab{$filename} .= "$volume ";
}
}
foreach (keys %filetab) {
print "$filetab{$_}\n";
}
+----------------------------------------------------------------------+
Steven Bridge Systems Group, Information Systems, EISD
University College London
email: s.bridge AT ucl.ac DOT uk tel: +44 (0)20 7679 2794
|