Results 1 to 10 of 10

Thread: db2diag -A help

  1. #1
    Join Date
    Aug 2012
    Posts
    3

    Unanswered: db2diag -A help

    I am trying to run db2diag -A filename to archive
    db2diag.log in /db2/SID/db2dump folder. It works fine from command
    line, but does not work in crontab. I made a script that the crontab will
    call. I get a db2 command not found error. I read on forum to add
    -readfile option. I need help where to add this option.
    My command in the script is
    db2diag -A /backup/dump_xxx
    this works fine from the command but not in the script, where should I add
    the -readfile option.
    Thanks a lot for the help.

  2. #2
    Join Date
    Jun 2003
    Location
    Toronto, Canada
    Posts
    5,516
    Provided Answers: 1
    Make sure that the instance profile ($INSTANCE_HOME/sqllib/db2profile) is executed by cron prior to db2diag. The easiest approach would be to schedule a script similar to this:
    Code:
    #!/bin/sh
    . /home/db2inst1/sqllib/db2profile
    db2diag -A
    ---
    "It does not work" is not a valid problem statement.

  3. #3
    Join Date
    Jan 2003
    Posts
    4,292
    Provided Answers: 5
    My guess is that the first line of you script need to load the DB2 profile:

    Code:
    . /home/db2inst1/sqllib/db2profile
    Andy

  4. #4
    Join Date
    Aug 2012
    Posts
    3

    info

    are you suggesting I add
    /db2/db2<SID>/sqllib/db2dump
    the physical location as the first line after #!/bin/sh entry

  5. #5
    Join Date
    Jan 2003
    Posts
    4,292
    Provided Answers: 5
    The reason you are getting the command not found error is because your DB2 environment is not set up properly through cron. By loading the profile as the fist line, like we have suggested, this will fix the problem.

    Andy

  6. #6
    Join Date
    Jun 2003
    Location
    Toronto, Canada
    Posts
    5,516
    Provided Answers: 1
    Quote Originally Posted by db2_database_user View Post
    are you suggesting I add
    /db2/db2<SID>/sqllib/db2dump
    the physical location as the first line after #!/bin/sh entry
    No, this is not at all what I am suggesting. Must be a trick question...
    ---
    "It does not work" is not a valid problem statement.

  7. #7
    Join Date
    May 2003
    Location
    USA
    Posts
    5,737
    Yes, you need the -readfile option to make it work in cron. This is due to some sadistic IBM programmer who owes 2 weeks of my life back that it took me to figure this out.
    M. A. Feldman
    IBM Certified DBA on DB2 for Linux, UNIX, and Windows
    IBM Certified DBA on DB2 for z/OS and OS/390

  8. #8
    Join Date
    Aug 2012
    Posts
    3

    -readfile

    db2diag -A /directory_name_for_archive_file
    where do I put -readfile option
    db2diag -A -readfile /directory_name_for_archive_file
    because it says after -A option other options are overlooked

  9. #9
    Join Date
    May 2003
    Location
    USA
    Posts
    5,737
    The readfile option has nothing to do with a file name, which is why it is so stupid.

    db2diag -level Error,Severe,Critical -H 60m -readfile


    This returns all Error,Severe,Critical errors in the last 60 minutes. The doc on this command is pathetic.
    M. A. Feldman
    IBM Certified DBA on DB2 for Linux, UNIX, and Windows
    IBM Certified DBA on DB2 for z/OS and OS/390

  10. #10
    Join Date
    Aug 2012
    Posts
    1
    Thanks Marcus - you're absolutely right about the solution. If you're trying to use
    db2diag in a script that crontab invokes, use the -readfile parameter. I can't tell you how many variations of running sqllib/db2profile and other things within the script I've tried, but -readfile worked right away.

Posting Permissions

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