IBM Connections:Reorg Connections Databases: Difference between revisions

From Wiki
No edit summary
No edit summary
 
(One intermediate revision by the same user not shown)
Line 1: Line 1:
With db2admin
= Shell de Criação dos arquivos de reorg =
 
1) Conectar com um usuário com permissão de db2admin
 
2) Criar o arquivo '''db2-reorg-tables.sh'''
 
#!/bin/bash
for DBNAME in BLOGS DOGEAR FILES FORUM HOMEPAGE OPNACT PEOPLEDB SNCOMM WIKIS METRICS COGNOS PNS CCM
do
  db2 connect to $DBNAME
  db2 reorgchk update statistics on table all > resultado$DBNAME.txt
  db2 terminate
 
  echo "db2 connect to $DBNAME" > reorg$DBNAMETable.txt
  cat resultadoPEOPLEDB.txt | grep Table: | awk -F: '{ print "db2 reorg table" $2 }' >> reorg$DBNAMETable.txt
  echo "db2 terminate" >> reorg$DBNAMETable.txt
 
  echo "db2 connect to $DBNAME" > reorg$DBNAMEIndex.txt
  cat resultadoPEOPLEDB.txt | grep Table: | awk -F: '{ print "db2 reorg indexes all for table" $2 }' >> reorg$DBNAMEIndex.txt
  echo "db2 terminate" >> reorg$DBNAMEIndex.txt
 
  sh -x reorg$DBNAMETable.txt
 
  sh -x reorg$DBNAMEIndex.txt
done
 
Salvar e fechar
 
3) Executar o arquivo
 
sh -x db2-reorg-tables.sh
 
= Exemplos do resultado=


----
----
Line 19: Line 53:
  sh -x reorgPEOPLEDBIndex.txt
  sh -x reorgPEOPLEDBIndex.txt


----
db2 connect to BLOGS
db2 reorgchk update statistics on table all > resultadoBLOGS.txt
db2 terminate
echo "db2 connect to BLOGS" > reorgBLOGSTable.txt
cat resultadoBLOGS.txt | grep Table: | awk -F: '{ print "db2 reorg table" $2 }' >> reorgBLOGSTable.txt
echo "db2 terminate" >> reorgBLOGSTable.txt
echo "db2 connect to BLOGS" > reorgBLOGSIndex.txt
cat resultadoBLOGS.txt | grep Table: | awk -F: '{ print "db2 reorg indexes all for table" $2 }' >> reorgBLOGSIndex.txt
echo "db2 terminate" >> reorgBLOGSIndex.txt
sh -x reorgBLOGSTable.txt
sh -x reorgBLOGSIndex.txt
----
db2 connect to DOGEAR
db2 reorgchk update statistics on table all > resultadoDOGEAR.txt
db2 terminate
echo "db2 connect to DOGEAR" > reorgDOGEARTable.txt
cat resultadoDOGEAR.txt | grep Table: | awk -F: '{ print "db2 reorg table" $2 }' >> reorgDOGEARTable.txt
echo "db2 terminate" >> reorgDOGEARTable.txt
echo "db2 connect to DOGEAR" > reorgDOGEARIndex.txt
cat resultadoDOGEAR.txt | grep Table: | awk -F: '{ print "db2 reorg indexes all for table" $2 }' >> reorgDOGEARIndex.txt
echo "db2 terminate" >> reorgDOGEARIndex.txt
sh -x reorgDOGEARTable.txt
sh -x reorgDOGEARIndex.txt
----
db2 connect to FILES
db2 reorgchk update statistics on table all > resultadoFILES.txt
db2 terminate
echo "db2 connect to FILES" > reorgFILESTable.txt
cat resultadoFILES.txt | grep Table: | awk -F: '{ print "db2 reorg table" $2 }' >> reorgFILESTable.txt
echo "db2 terminate" >> reorgFILESTable.txt
echo "db2 connect to FILES" > reorgFILESIndex.txt
cat resultadoFILES.txt | grep Table: | awk -F: '{ print "db2 reorg indexes all for table" $2 }' >> reorgFILESIndex.txt
echo "db2 terminate" >> reorgFILESIndex.txt
sh -x reorgFILESTable.txt
sh -x reorgFILESIndex.txt
----
db2 connect to FORUM
db2 reorgchk update statistics on table all > resultadoFORUM.txt
db2 terminate
echo "db2 connect to FORUM" > reorgFORUMTable.txt
cat resultadoFORUM.txt | grep Table: | awk -F: '{ print "db2 reorg table" $2 }' >> reorgFORUMTable.txt
echo "db2 terminate" >> reorgFORUMTable.txt
echo "db2 connect to FORUM" > reorgFORUMIndex.txt
cat resultadoFORUM.txt | grep Table: | awk -F: '{ print "db2 reorg indexes all for table" $2 }' >> reorgFORUMIndex.txt
echo "db2 terminate" >> reorgFORUMIndex.txt
sh -x reorgFORUMTable.txt
sh -x reorgFORUMIndex.txt
----
db2 connect to HOMEPAGE
db2 reorgchk update statistics on table all > resultadoHOMEPAGE.txt
db2 terminate
echo "db2 connect to HOMEPAGE" > reorgHOMEPAGETable.txt
cat resultadoHOMEPAGE.txt | grep Table: | awk -F: '{ print "db2 reorg table" $2 }' >> reorgHOMEPAGETable.txt
echo "db2 terminate" >> reorgHOMEPAGETable.txt
echo "db2 connect to HOMEPAGE" > reorgHOMEPAGEIndex.txt
cat resultadoHOMEPAGE.txt | grep Table: | awk -F: '{ print "db2 reorg indexes all for table" $2 }' >> reorgHOMEPAGEIndex.txt
echo "db2 terminate" >> reorgHOMEPAGEIndex.txt
sh -x reorgHOMEPAGETable.txt
sh -x reorgHOMEPAGEIndex.txt
----
db2 connect to OPNACT
db2 reorgchk update statistics on table all > resultadoOPNACT.txt
db2 terminate
echo "db2 connect to OPNACT" > reorgOPNACTTable.txt
cat resultadoOPNACT.txt | grep Table: | awk -F: '{ print "db2 reorg table" $2 }' >> reorgOPNACTTable.txt
echo "db2 terminate" >> reorgOPNACTTable.txt
echo "db2 connect to OPNACT" > reorgOPNACTIndex.txt
cat resultadoOPNACT.txt | grep Table: | awk -F: '{ print "db2 reorg indexes all for table" $2 }' >> reorgOPNACTIndex.txt
echo "db2 terminate" >> reorgOPNACTIndex.txt
sh -x reorgOPNACTTable.txt
sh -x reorgOPNACTIndex.txt
----
db2 connect to SNCOMM
db2 reorgchk update statistics on table all > resultadoSNCOMM.txt
db2 terminate
echo "db2 connect to SNCOMM" > reorgSNCOMMTable.txt
cat resultadoSNCOMM.txt | grep Table: | awk -F: '{ print "db2 reorg table" $2 }' >> reorgSNCOMMTable.txt
echo "db2 terminate" >> reorgSNCOMMTable.txt
echo "db2 connect to SNCOMM" > reorgSNCOMMIndex.txt
cat resultadoSNCOMM.txt | grep Table: | awk -F: '{ print "db2 reorg indexes all for table" $2 }' >> reorgSNCOMMIndex.txt
echo "db2 terminate" >> reorgSNCOMMIndex.txt
sh -x reorgSNCOMMTable.txt
sh -x reorgSNCOMMIndex.txt
----
db2 connect to WIKIS
db2 reorgchk update statistics on table all > resultadoWIKIS.txt
db2 terminate
echo "db2 connect to WIKIS" > reorgWIKISTable.txt
cat resultadoWIKIS.txt | grep Table: | awk -F: '{ print "db2 reorg table" $2 }' >> reorgWIKISTable.txt
echo "db2 terminate" >> reorgWIKISTable.txt
echo "db2 connect to WIKIS" > reorgWIKISIndex.txt
cat resultadoWIKIS.txt | grep Table: | awk -F: '{ print "db2 reorg indexes all for table" $2 }' >> reorgWIKISIndex.txt
echo "db2 terminate" >> reorgWIKISIndex.txt
sh -x reorgWIKISTable.txt
sh -x reorgWIKISIndex.txt




Line 175: Line 63:


[[Category:IBM Connections]]
[[Category:IBM Connections]]
[[Category:Tunning IBM Connections]]
[[Category:Tuning IBM Connections]]

Latest revision as of 11:49, 13 September 2016

Shell de Criação dos arquivos de reorg

1) Conectar com um usuário com permissão de db2admin

2) Criar o arquivo db2-reorg-tables.sh

#!/bin/bash
for DBNAME in BLOGS DOGEAR FILES FORUM HOMEPAGE OPNACT PEOPLEDB SNCOMM WIKIS METRICS COGNOS PNS CCM
do

 db2 connect to $DBNAME
 db2 reorgchk update statistics on table all > resultado$DBNAME.txt
 db2 terminate
 
 echo "db2 connect to $DBNAME" > reorg$DBNAMETable.txt
 cat resultadoPEOPLEDB.txt | grep Table: | awk -F: '{ print "db2 reorg table" $2 }' >> reorg$DBNAMETable.txt
 echo "db2 terminate" >> reorg$DBNAMETable.txt
 
 echo "db2 connect to $DBNAME" > reorg$DBNAMEIndex.txt
 cat resultadoPEOPLEDB.txt | grep Table: | awk -F: '{ print "db2 reorg indexes all for table" $2 }' >> reorg$DBNAMEIndex.txt
 echo "db2 terminate" >> reorg$DBNAMEIndex.txt
 
 sh -x reorg$DBNAMETable.txt
 
 sh -x reorg$DBNAMEIndex.txt

done

Salvar e fechar

3) Executar o arquivo

sh -x db2-reorg-tables.sh

Exemplos do resultado


db2 connect to PEOPLEDB
db2 reorgchk update statistics on table all > resultadoPEOPLEDB.txt
db2 terminate

echo "db2 connect to PEOPLEDB" > reorgPEOPLEDBTable.txt
cat resultadoPEOPLEDB.txt | grep Table: | awk -F: '{ print "db2 reorg table" $2 }' >> reorgPEOPLEDBTable.txt
echo "db2 terminate" >> reorgPEOPLEDBTable.txt

echo "db2 connect to PEOPLEDB" > reorgPEOPLEDBIndex.txt
cat resultadoPEOPLEDB.txt | grep Table: | awk -F: '{ print "db2 reorg indexes all for table" $2 }' >> reorgPEOPLEDBIndex.txt
echo "db2 terminate" >> reorgPEOPLEDBIndex.txt

sh -x reorgPEOPLEDBTable.txt

sh -x reorgPEOPLEDBIndex.txt


Ver também