Script to check the Tablespace sizes

What does this script do ?
  1. Check for the DMS(Auto Resize Enabled – No) Tablespaces ( As there is no point in checking the SMS and DMS with Auto Resize Enabled – Yes Tablespaces)
  2. Query returns the following columns (Tablespace Name , Free Pages , Container path )
  3. If less than 1000 pages throws warning message
Here’s the script

Password less SSH

In this post I would explain how to make the 2 servers( Remote and Local) password less .

Lets take a scenario

Resources : ServerA , ServerB
Requirements : To make ServerB password less (i.e., while you enter ‘sshusername@ServerB’ it should not prompt you for a password )
Explanation :To do this Generate a key pair on ServerA ( There are 2 types of keys rsa and dsa , you can use anyone of those)
ServerA@db2:~/.ssh> ssh-keygen -t rsa

Here is what you get

How do you CronJob a script to mail it to your INBOX

Many time we come across a situation where in we need to schedule a script and mail that report to our INBOX
If that is the case here is how we do it

DB2 Backup Script

After three months of my continuous hit’s i am successful in writing a backup shell script . Its really nice feeling you get when your first script is successfully executed and is ready to go to production server
So no wasting time here is what i have written
Here are the things what i have done in this script
  1. Check for the space in the file system
  2. Check if the backup is already taken
  3. Take the backup
  4. Copy the backup taken to another server
  5. Remove the 5 days old backup (According to Retention policy)
And Here Goes the script

Trigger Sql relative to Server or CPU load

Well to start with , We come across various daily needs where in which we find different paths to reach or bring the desired output , this post is one of them .

If you also came across kind of requirement in this post , this is for you ….Well Well , What is that requirement ?????…..Ya I’m coming to that !!

If you want to automate some of you db tasks depending on the server load , If your DB server load crosses 50 …..set this flag to ‘Y’ , if above 80 , set this flag to ‘N’ , if below 80 set the flag again to ‘Y’……………………………..

For doing that we need to primarily catch up the server load which we do with a familiar command top

We have 2 options

Collect Cost Of all the db2 Stored Proc's in a simple Possible Way

Before writing this post i just need to convey that the kind of approach i'm going to tell you might be done by many others by this time , I have been trying out to find the easy way to find out my need and on my way i came across this and thought of sharing with you guys .

So "What if you came across a need in your DBA life where in you need to collect all the Query Costs of all the Stored Proc's or Packages in your Database ? "

Here is one i have tried