Automating log file archiving and retrieval with user exit programs

You can automate log file archiving and retrieval by creating a user exit program that the Db2® database manager calls to carry out the archiving or retrieval operation.

When the Db2 database manager invokes your user exit program, the following happens:

  • The database manager passes control to the user exit program;

  • The database manager passes parameters to the user exit program; and

  • On completion, the use exit program passes a return code back to the database manager.

Configuration

Before invoking a user exit program for log file archiving or retrieval, ensure that the logarchmeth1 database configuration parameter is set to USEREXIT. This also enables your database for rollforward recovery.

User exit program requirements

  • The executable file for your user exit program must be called db2uext2.

  • User exit programs must copy log files from the active log path to the archive log path, they must not move them. Do not remove log files from the active log path. If you remove log files from the active log path, your Db2 database might not be able to successfully recover in the event of a failure.

    Db2 database requires the log files to be in the active log path during recovery. The Db2 database server removes archived log files from the active log path when these log files are no longer needed for recovery.

  • User exit programs must handle error conditions. Your user exit program must handle errors because the Db2 database manager can handle only a limited set of return conditions.

    See User exit error handling.

  • Each Db2 database manager instance can invoke only one user exit program. Because the database manager instance can invoke only one user exit program, you must design your user exit program with a section for each operation it might have to perform.