10/03/2017

Script to Reduce the tablespace size and reduce the free pages

#!/bin/bash

# Establishing database connection
db2 "connect to itgdb"

# Gathering the tablespaces other than temporary and placing them in a file
db2 list tablespaces show detail | grep -i -A2 name | tac | sed '/Temporary/I,+2 d' | tac | grep -i name | awk '{print $3}' > /tmp/TablespaceList.out

# Using for loop to get the tablespace name one by one
for i in `cat /tmp/TablespaceList.out`
do

# Gathering free pages count for each tablespace
db2 list tablespaces show detail | grep -i -A9 $i | grep -i 'free pages' | awk '{print $4}' > /tmp/FreePages.out

FreePages=`cat /tmp/FreePages.out`

# Comparing whether the free pages are more than 1000 or not
if [ $FreePages -gt 1000 ]
then

# If the free pages are more than 1000 then reducing them
db2 "alter tablespace $i reduce max"
fi
done

3 comments:

  1. Are you experiencing bitcoin transaction issue in Binance account? Bitcoin is the leading coin for trading among all the exchanges and Binance being the highest exchange provides hassle-free bitcoin trading. If you don’t know how to deal with this error and looking for solution, call on Binance support number which is always active and users can talk to the team anytime to avail solutions related Binance Support Number to queries. The team is always there to help you so contact them to avail results. Not only transaction issues but you can fix all errors of Binance at this place by speaking to the team and avail solutions.

    ReplyDelete
  2. Are you occupied with Binance technical and non-technical issues? Is Binance account not working or are you facing login issues? If you are occupied by any of errors and need solutions to fix them, you can always call on Binance support number which is the best solution to deal with all Binance Support Number kind of issues. The team is always there to assist you and makes sure you get every solution without any problem. You can call them anytime for better solutions and fix all the puzzles by taking support from them.

    ReplyDelete
  3. Are you following by error to deal with Gemini issues? Most of the times it happens when users are unable to send digital currency to another wallet and experience trouble. If you are unable to deal with this error and you are looking for solution to deal with it, feel free to speak to the experts and avail Gemini Support Number solutions related to queries. All you have to do is call on Gemini support number which is functional all the time and the experts can speak to the team anytime for better results.

    ReplyDelete

ads