Results 1 to 4 of 4
  1. #1
    Join Date
    May 2003
    Posts
    369

    Unanswered: userexit fails need help

    I setup a userexit program and cannot get it to work correctly:

    get the following errors from DB2

    Time of Error: Mon Jan 12 14:15:45 2004

    Parameter Count: 1
    Parameters Passed:
    Audit Log File:
    System Call Parms:
    Media Type: disk
    User Exit RC: 20

    > Error isolation: Action is not valid

    Steps I have taken to get this far: DB2 UDB 7.2 FP6 on AIX 5.2L

    # db2 get db cfg for acctview |egrep -i "log retain|user exit"
    Log retain for recovery status = RECOVERY
    User exit for logging status = NO
    Log retain for recovery enabled (LOGRETAIN) = RECOVERY
    User exit for logging enabled (USEREXIT) = OFF


    # db2 "update db cfg for acctview using USEREXIT ON"
    DB20000I The UPDATE DATABASE CONFIGURATION command completed successfully.

    - Copy over sample user exit program:

    cd /home/db2inst1/sqllib/samples/c

    mkdir /home/db2inst1/work/userexit/scripts

    cp HOME/sqllib/sample/c/db2uext2.cdisk /home/db2inst1/work/userexit/scripts/db2uext2.c


    - make required changes to sample user exit c program:

    #define ARCHIVE_PATH "/home/db2inst1/u/dbarch"
    #define RETRIEVE_PATH "/home/db2inst1/u/dblog/"
    #define AUDIT_ACTIVE 1 /* enable audit trail logging */
    #define ERROR_ACTIVE 1 /* enable error trail logging */
    #define AUDIT_ERROR_PATH "/home/db2inst1/u/dblog/"
    #define AUDIT_ERROR_ATTR "a" /* append to text file */
    #define BUFFER_SIZE 32 /* # of 4K pages for output buffer */



    - create additional directories for user exit

    /home/db2inst1/work/userexit/scripts >

    # ls
    db2uext2.c

    /home/db2inst1/work/userexit/scripts >

    # cd $HOME

    /home/db2inst1 >

    # mkdir u
    /home/db2inst1 >

    # cd u
    home/db2inst1/u >

    # mkdir dbarch
    /home/db2inst1/u >

    # cd dbarch
    /home/db2inst1/u/dbarch >

    # pwd
    /home/db2inst1/u/dbarch
    /home/db2inst1/u/dbarch >

    # cd ..
    /home/db2inst1/u >

    # mkdir dblog
    /home/db2inst1/u >

    # pwd
    /home/db2inst1/u
    /home/db2inst1/u >

    # cd dblog
    /home/db2inst1/u/dblog >

    /home/db2inst1/u/dblog >


    # mkdir -p /MYDB/NODE0000
    /home/db2inst1/u/dbarch >

    - compile db2uext2.c program

    cd /home/db2inst1/work >

    # cc -o db2uext2 db2uext2.c

    # chmod +s db2uext2

    /home/db2inst1/work >

    # ls
    db2uext2 db2uext2.c userexit


    - check to see if it works

    # cd /home/db2inst1/u
    /home/db2inst1/u >

    # ls
    dbarch dblog

    review and fix errors in error file:


    stop/start DB2 instance:

    # db2stop
    SQL1064N DB2STOP processing was successful.
    db2inst1@av3: /home/db2inst1/work >

    # db2start
    SQL1063N DB2START processing was successful.
    db2inst1@av3: /home/db2inst1/work >


    try running db2uext2 again

    /home/db2inst1/u/dblog >
    # ls
    USEREXIT.ERR

    ************************************************** ***************************
    Time of Error: Mon Jan 12 14:15:45 2004
    ************************************************** ***************************
    Time of Error: Mon Jan 12 14:15:45 2004

    Parameter Count: 1
    Parameters Passed:
    Audit Log File:
    System Call Parms:
    Media Type: disk
    User Exit RC: 20

    > Error isolation: Action is not valid


    ************************************************** ***************************
    Time of Error: Mon Jan 12 14:22:31 2004

    Parameter Count: 1
    Parameters Passed:
    Audit Log File:
    System Call Parms:
    Media Type: disk
    User Exit RC: 20

    > Error isolation: Action is not valid

    # cat USEREXIT.ERR
    ************************************************** ***************************
    Time of Error: Mon Jan 12 14:15:45 2004

    Parameter Count: 1
    Parameters Passed:
    Audit Log File:
    System Call Parms:
    Media Type: disk
    User Exit RC: 20

    > Error isolation: Action is not valid


    ************************************************** ***************************
    Time of Error: Mon Jan 12 14:22:31 2004

    Parameter Count: 1
    Parameters Passed:
    Audit Log File:
    System Call Parms:
    Media Type: disk
    User Exit RC: 20

    > Error isolation: Action is not valid


    /home/db2inst1/u/dblog >
    #

    did this fail because I am not compiling the db2uext2.c program under the sqllib/adm directory? Do I need to do this as the AIX root superuser? Thanks!

    Scott

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

    Re: userexit fails need help

    You will have to copy the db2uext2 executable to a location where db2 can find and sqllib/misc is the best location ...
    Visit the new-look IDUG Website , register to gain access to the excellent content.

  3. #3
    Join Date
    May 2003
    Posts
    369

    update on user exit program and archiving db2 logs

    OK figured out what i did wrong and was able to recompile the db2uext2.c file into an executable.

    # cc -o db2uext2 db2uext2.c
    /home/db2inst1/work/userexit >

    # chmod +s db2uext2
    /home/db2inst1/work/userexit >

    Archive Log testing:

    # db2 archive log for database MYDB
    DB20000I The ARCHIVE LOG command completed successfully.

    /home/db2inst1/work/userexit >

    So how do I know for sure that my logs are correctly being archived via the user exit program? Thanks!

    Scott

  4. #4
    Join Date
    Mar 2003
    Posts
    343
    You can issue an

    archive log for database <dbname>

    and that should close a log.

    Look in the diag - if it could not archive it should say so. Also look in the archive path you should see log/s moved to this directory after the command completes.

Posting Permissions

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