Results 1 to 3 of 3
  1. #1
    Join Date
    Mar 2002
    Posts
    4

    Unanswered: Backup via cron - Environment Errors

    Hi All,

    I am attempting to setup a cron job to backup a DB2 database on a nightly basis.

    The contents of the crontab for the db2inst1 user are:

    0 5 * * * /usr/IBMdb2/V7.1/bin/db2 backup database lpdb1 ONLINE to /mnt/db2/backup/ with 2 buffers buffer 1024

    When running the command manually as the db2inst1 user it works no worries.

    When the crontab attempts to execute the command it returns:

    X-Cron-Env: <SHELL=/bin/sh>
    X-Cron-Env: <HOME=/home/db2inst1>
    X-Cron-Env: <PATH=/usr/bin:/bin>
    X-Cron-Env: <LOGNAME=db2inst1>

    SQL10007N Message "-1390" could not be retrieved. Reason code: "1".

    This suggests to me its an environment issue.

    If anyone is able to shed some light, that would be greatly appreciated.

    Thanks,
    Sarah.

  2. #2
    Join Date
    Aug 2001
    Location
    UK
    Posts
    4,650

    Re: Backup via cron - Environment Errors

    All the environment variables required for DB2 can be set using
    <inst-home directory>/sqllib/db2profile

    Execute this script before executing the BACKUP command


    HTH

    Cheers

    Sathyaram

    Originally posted by SarahAko
    Hi All,

    I am attempting to setup a cron job to backup a DB2 database on a nightly basis.

    The contents of the crontab for the db2inst1 user are:

    0 5 * * * /usr/IBMdb2/V7.1/bin/db2 backup database lpdb1 ONLINE to /mnt/db2/backup/ with 2 buffers buffer 1024

    When running the command manually as the db2inst1 user it works no worries.

    When the crontab attempts to execute the command it returns:

    X-Cron-Env: <SHELL=/bin/sh>
    X-Cron-Env: <HOME=/home/db2inst1>
    X-Cron-Env: <PATH=/usr/bin:/bin>
    X-Cron-Env: <LOGNAME=db2inst1>

    SQL10007N Message "-1390" could not be retrieved. Reason code: "1".

    This suggests to me its an environment issue.

    If anyone is able to shed some light, that would be greatly appreciated.

    Thanks,
    Sarah.

  3. #3
    Join Date
    Oct 2001
    Posts
    68
    sathyaram_s is dead on. You should execute a script when the cron fires.

    This has numerous benefits, the most important being that you can test the script before scheduling it to remove any environment issues. It also means you can change the script later without requiring permissions to change the crontab entries.

    We have a ton of these and it takes a while but it's well worth it.

    WP.

    512/513 down... 508 coming next!!!

Posting Permissions

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