IBM Support

How to run db2diag -A as a cron task in an IBM Smart Analytics System environment ?

Technote (FAQ)


Question

How to run db2diag -A as a cron task in an IBM Smart Analytics System environment ?

Answer

The db2diag -A command is used to archive an existing db2diag.log file and create a new file.

If you want to schedule this command to be run as a cron task, there are a couple of things you will need to do:

  • import the db2profile
  • specify the -readfile option in the db2diag command

Here are the steps to set up the cron task to be run as DB2 instance owner. We will use db2inst1 as an example in the following steps:

  1. Check with your system administrator to make sure that db2ist1 is listed in the cron.allow file AND is not listed in the cron.deny file.
  2. Login as DB2 instance owner.
  3. Check if there are any existing cron tasks. In the example below, there are no existing tasks.

    db2inst1@myserver:~> crontab -l
    # DO NOT EDIT THIS FILE - edit the master and reinstall.
    # (crontab.test1 installed on Thu Feb  5 09:16:14 2015)
    # (Cron version V5.0 -- $Id: crontab.c,v 1.12 2004/01/23 18:56:42 vixie Exp $)
  4. Save a copy of the crontab output and append the db2diag -A task entry.

    db2inst1@myserver:~> crontab -l >crontab.db2inst1

    Edit crontab.db2inst1 and add the db2diag -A entry to the end of the file. Here we are scheduling the task to run at midnight every day.

    # DO NOT EDIT THIS FILE - edit the master and reinstall.
    # (crontab.test1 installed on Thu Feb  5 09:16:14 2015)
    # (Cron version V5.0 -- $Id: crontab.c,v 1.12 2004/01/23 18:56:42 vixie Exp $)

    0 0 * * * . /home/db2inst1/sqllib/db2profile; db2diag -A -readfile
  5. Submit the cron task.

    db2inst1@myserver:~> crontab crontab.db2inst1
  6. Verify that crontab -l shows your task entry.

    db2inst1@myserver:~> crontab -l
    # DO NOT EDIT THIS FILE - edit the master and reinstall.
    # (crontab.test1 installed on Thu Feb  5 09:16:14 2015)
    # (Cron version V5.0 -- $Id: crontab.c,v 1.12 2004/01/23 18:56:42 vixie Exp $)
    0 0 * * * . /home/db2inst1/sqllib/db2profile; db2diag -A -readfile

You may refer to the following link for more information on the db2diag command.


http://www-01.ibm.com/support/knowledgecenter/SSEPGG_9.7.0/com.ibm.db2.luw.admin.cmd.doc/doc/r0011728.html

Document information

More support for: IBM Smart Analytics System

Software version: 9.7, 10.1

Operating system(s): AIX, Linux

Reference #: 1696663

Modified date: 26 February 2015