Commit 2cedd024 authored by bnachtw's avatar bnachtw
Browse files

initial coding

parent 0fd36882
#! /bin/bash
##############################################################################
#
# reorg-tables.sh
#
# doing all reorgs in one script call
#
# (C) 2020 -- 2020 GWDG Göttingen, Bjørn Nachtwey
# mailto:bjoern.nachtwey@gwdg.de
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
##############################################################################
#
# changelog
# date version remark
# 2020-08-XX 0.0.1 initial coding using bash
# 2020-08-12 0.1.0 first version put to gitlab
db2 connect to tsmdb1 && \
db2 "reorg table tsmdb1.ACTIVITY_LOG allow no access use REORG16K" && \
db2 "reorg table tsmdb1.AF_BITFILES allow no access use REORG16K" && \
db2 "reorg table tsmdb1.AF_SEGMENTS allow no access use REORG16K" && \
db2 "reorg table tsmdb1.AS_SEGMENTS allow no access use REORG16K" && \
db2 "reorg table tsmdb1.ARCHIVE_OBJECTS allow no access use REORG32K" && \
db2 "reorg table tsmdb1.BACKUP_OBJECTS allow no access use REORG32K" && \
db2 "reorg table tsmdb1.BF_AGGREGATE_ATTRIBUTES allow no access use REORG16K" && \
db2 "reorg table tsmdb1.BF_AGGREGATED_BITFILES allow no access use REORG16K" && \
db2 "reorg table tsmdb1.GROUP_LEADERS allow no access use REORG16K" && \
db2 "reorg table tsmdb1.EXPORT_OBJECTS allow no access use REORG16K" && \
db2 "reorg table tsmdb1.TSMMON_STATUS allow no access use REORG16K"
#! /usr/bin/perl
##############################################################################
#
# tsm-group-nodes.pl
#
# script for group former nongroup nodes
# to collocgroupr due to their policy domain
#
#
#
# (C) 2015,2019 GWD Göttingen, Bjørn Nachtwey
# mailto:bjoern.nachtwey@gwdg.de
#
##############################################################################
#
# changelog
# date version remark
# 2015-01-16 0.8 initial coding
# 2015-04-22 0.9 fixes for mon1.tsm.gwdg.de
# 2019-07-31 1.0 switched to common style with account and password given by call
#
##############################################################################
use warnings;
use strict;
use Time::Piece;
##############################################################################
##############################################################################
# F I L L I N Y O U R S E T T I N G S H E R E
##############################################################################
##############################################################################
##############################################################################
# C R E D E N T I A L S
##############################################################################
my $admuser = $ARGV[0]; # or replace by expicit ID
my $admpwd = $ARGV[1]; # or replace by expicit PW
##############################################################################
# # some loop iterators
my $server; # actual server name
my $server_name;
my $node_name;
my $domain_name;
# # some lists to be processed
my @serverlist = qw /tsm110 tsm112 tsm130 tsm131 tsm180 tsm182 tsm230 tsm231 tsm232 tsm233 tsm234 tsm235 tsm236 tsm237 tsm285/; # list of new servers
my @domainlist; # list of domains
my @nodelist; # list of all non-collocated nodes
my $dsmadmc = "/usr/bin/dsmadmc "; # linux servers
my $dsmargs = " -tab -dataonly=yes -id=$admuser -pa=$admpwd -outfile";
my $date = localtime->strftime ('%F');
my $outputpath = "/TSM/log/";
my $outlog = $outputpath . $date . "-grouped-nodes.log";
#
# # new variables
my $command;
my $selectstatement;
open LOGFILE, ">" . $outlog or die "$0: cannot open log file: " . $outlog;
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
# main loop over all servers
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
foreach $server (@serverlist)
{
$server_name = $server;
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
# get list of domains
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
undef @domainlist;
if ( $server =~ m/-admin$/ )
{
$server_name = $server;
$server_name =~ s/-admin$//;
}
else
{
$server_name = $server;
}
printf LOGFILE "\n ==>\t SERVER: $server_name\n\n";
printf LOGFILE " ====>\t COLLOCGROUPS \n\n";
$selectstatement = "select domain_name from domains minus (select collocgroup_name from collocgroup)";
$command = "$dsmadmc $dsmargs -se=$server \"$selectstatement\" 2>/dev/null";
@domainlist = split '\n' , `$command`;
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
# define collocgroup for each domain without default-group
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
foreach my $domain (@domainlist)
{
next if ( $domain eq "TPL" );
next if ( $domain =~ m/^GWDG-FS/ );
printf LOGFILE "DEF COLLOCGR $domain\n";
$command = "$dsmadmc $dsmargs -se=$server \"DEF COLLOCGR $domain\" 2>/dev/null";
`$command`;
} # EO foreach domain
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
# get all non-collocated nodes
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
$selectstatement = "SELECT domain_name, node_name from nodes where (collocgroup_name IS NULL)";
$command = "$dsmadmc $dsmargs -se=$server \"$selectstatement\" 2>/dev/null";
@nodelist = split '\n' , `$command`;
printf LOGFILE "\n ====>\t NODES \n\n";
foreach my $node (@nodelist)
{
if ( ( $node =~ m/^ANR/ ) or ($node =~ m/^ANS/) )
{
last
}
($domain_name, $node_name) = split '\t' , $node;
next if ( $domain_name eq "TPL" );
next if ( $domain_name =~ m/^GWDG-FS/ );
printf LOGFILE "def collocmem $domain_name $node_name\n";
$command = "$dsmadmc $dsmargs -se=$server \"def collocmem $domain_name $node_name\" 2>/dev/null";
`$command`;
}
printf LOGFILE "======================================================================\n";
}
close LOGFILE;
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment