Results 1 to 3 of 3
  1. #1
    Join Date
    Apr 2016
    Posts
    12

    Answered: script to monitor db2mtrk -i db2mtrk -d and db2pd -dbptnmem

    As per my customer requirement, I have to collect memory utilization on DB2 instance.

    I tried db2mtrk -i db2mtrk -d and db2pd -dbptnmem and got required data.

    I was suppose to collect data for every 5 min for a week.

    I tried scheduling simple script to run from crontab as below

    ################################################## #####

    #!/usr/bin/ksh

    db2mtrk -i

    db2mtrk -d

    echo "======================"

    ################################################## ####

    I was new to scripting, tried many ways to run that.

    only "echo" was in output when i schedule in crontab

    If, when i run (sh memory.sh) directly i am getting required output


    Please help.

  2. Best Answer
    Posted by mark.b

    "Hi,

    You must source the corresponding sqllib/db2profile file.
    Moreover, you should redirect stdout and stderr to files to check what happens.
    Add the following lines at the top of your script.

    exec 2>>${1:-${0}.err}
    exec 1>>${2:-${0}.out}
    . ~/sqllib/db2profile


    Do not remove a space between . and ~
    Change the path to db2profile accordingly, if your user running the script is not the instance owner."


  3. #2
    Join Date
    Jul 2013
    Location
    Moscow, Russia
    Posts
    666
    Provided Answers: 55
    Hi,

    You must source the corresponding sqllib/db2profile file.
    Moreover, you should redirect stdout and stderr to files to check what happens.
    Add the following lines at the top of your script.

    exec 2>>${1:-${0}.err}
    exec 1>>${2:-${0}.out}
    . ~/sqllib/db2profile


    Do not remove a space between . and ~
    Change the path to db2profile accordingly, if your user running the script is not the instance owner.
    Regards,
    Mark.

  4. #3
    Join Date
    Apr 2016
    Posts
    12

    Thanks Mark

    Thanks Mark

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •