By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
443,369 Members | 1,147 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 443,369 IT Pros & Developers. It's quick & easy.

how to enable user exit

P: n/a
I know there are some sample user exit programs in sqllib/samples/c
directory. How do I tell DB2, which user exit program to use? I know I
have to edit and compile the c based user exit programs, but how do I
tell DB2 instance and database to use that particular user exit
program.
Thanks,
Yasaswi
Nov 12 '05 #1
Share this Question
Share on Google+
11 Replies


P: n/a
"Yasaswi Pulavarti" <ya*****@encfor.com> wrote in message
news:aa**************************@posting.google.c om...
I know there are some sample user exit programs in sqllib/samples/c
directory. How do I tell DB2, which user exit program to use? I know I
have to edit and compile the c based user exit programs, but how do I
tell DB2 instance and database to use that particular user exit
program.
Thanks,
Yasaswi


db2 get db cfg for database-name

You will see the parameter-name that specifies the exit program.

db2 update db cfg using parameter-name parameter-value
Nov 12 '05 #2

P: n/a
you compile one of the available db2uext2.c* files and place them at
sqllib/adm location. i don't know whether you can use multiple
db2uext2.c* files for the same instance. eg. either you can use
db2uext2.ctsm if you are using TSM or you can use db2uext2.cdisk if
you using a filesystem, but not both. maybe someone else can shed more
light on this.

hth,
dotyet

ya*****@encfor.com (Yasaswi Pulavarti) wrote in message news:<aa**************************@posting.google. com>...
I know there are some sample user exit programs in sqllib/samples/c
directory. How do I tell DB2, which user exit program to use? I know I
have to edit and compile the c based user exit programs, but how do I
tell DB2 instance and database to use that particular user exit
program.
Thanks,
Yasaswi

Nov 12 '05 #3

P: n/a

"Yasaswi Pulavarti" <ya*****@encfor.com> ????
news:aa**************************@posting.google.c om...
I know there are some sample user exit programs in sqllib/samples/c
directory. How do I tell DB2, which user exit program to use? I know I
have to edit and compile the c based user exit programs, but how do I
tell DB2 instance and database to use that particular user exit
program.
Thanks,
Yasaswi


After compiling a user exit program, you should put them into specific
directory(/sqllib/adm on UNIX and \SQLLIB\BIN on Windows) and DB2 will seek
them automatically.
Nov 12 '05 #4

P: n/a
> > I know there are some sample user exit programs in sqllib/samples/c
directory. How do I tell DB2, which user exit program to use? I know I
have to edit and compile the c based user exit programs, but how do I
tell DB2 instance and database to use that particular user exit
program.
Thanks,
Yasaswi
After compiling a user exit program, you should put them into specific
directory(/sqllib/adm on UNIX and \SQLLIB\BIN on Windows) and DB2 will

seek them automatically.

You have to update the db config to indicate the program name before DB2
will use it.
Nov 12 '05 #5

P: n/a
You can find a detailed explanation about setting userexit program
here.

http://www-106.ibm.com/developerwork...0307kline.html

GOODLUCK

-Visu

do****@yahoo.com (dotyet) wrote in message news:<6c**************************@posting.google. com>...
you compile one of the available db2uext2.c* files and place them at
sqllib/adm location. i don't know whether you can use multiple
db2uext2.c* files for the same instance. eg. either you can use
db2uext2.ctsm if you are using TSM or you can use db2uext2.cdisk if
you using a filesystem, but not both. maybe someone else can shed more
light on this.

hth,
dotyet

ya*****@encfor.com (Yasaswi Pulavarti) wrote in message news:<aa**************************@posting.google. com>...
I know there are some sample user exit programs in sqllib/samples/c
directory. How do I tell DB2, which user exit program to use? I know I
have to edit and compile the c based user exit programs, but how do I
tell DB2 instance and database to use that particular user exit
program.
Thanks,
Yasaswi

Nov 12 '05 #6

P: n/a
Yes this is what am interested, can I use the sample disk backup
db2uext2.cdisk in addition to a Veritas NetBackup. Also in an earlier
post Mark A. said I can update the parameter in the database
configuration file, however all of the DB2 documentation talks about
setting LOGRETAIN to ON and USEREXIT to on, but does not tell which
parameter I should look out for. Anyway does the act of putting the
compiled db2uext2.c* binary in sqllib/adm location instruct DB2 to
invoke the user exit program?
Thanks,
Yasaswi

do****@yahoo.com (dotyet) wrote in message news:<6c**************************@posting.google. com>...
you compile one of the available db2uext2.c* files and place them at
sqllib/adm location. i don't know whether you can use multiple
db2uext2.c* files for the same instance. eg. either you can use
db2uext2.ctsm if you are using TSM or you can use db2uext2.cdisk if
you using a filesystem, but not both. maybe someone else can shed more
light on this.

hth,
dotyet

ya*****@encfor.com (Yasaswi Pulavarti) wrote in message news:<aa**************************@posting.google. com>...
I know there are some sample user exit programs in sqllib/samples/c
directory. How do I tell DB2, which user exit program to use? I know I
have to edit and compile the c based user exit programs, but how do I
tell DB2 instance and database to use that particular user exit
program.
Thanks,
Yasaswi

Nov 12 '05 #7

P: n/a
"Yasaswi Pulavarti" <ya*****@encfor.com> wrote in message
news:aa*************************@posting.google.co m...
Yes this is what am interested, can I use the sample disk backup
db2uext2.cdisk in addition to a Veritas NetBackup. Also in an earlier
post Mark A. said I can update the parameter in the database
configuration file, however all of the DB2 documentation talks about
setting LOGRETAIN to ON and USEREXIT to on, but does not tell which
parameter I should look out for. Anyway does the act of putting the
compiled db2uext2.c* binary in sqllib/adm location instruct DB2 to
invoke the user exit program?
Thanks,
Yasaswi

I already answered that question. NO, the act of putting the compiled
db2uext2.c* binary in sqllib/adm location DOES NOT instruct DB2 to invoke
the user exit program. You must name the exit program in the database config
with the USEREXIT parm.

Setting LOGRETAIN ON does not invoke an exit program. It does instruct DB2
to retain log files (instead of the default circular logging). See the
manuals for an explanation of the difference between circular logging (the
default) and logretain (with or without an exit program).

When you want to retain the log files, AND ALSO move the log files no
longer needed to another directory, then you set the USEREXIT to the name of
your exit program to do the archiving (moving them to a different
directory). You do not set USEREXIT to ON (you set it to the name of the
exit program if you want one to be invoked).

If the USEREXIT is set to anything but OFF, DB2 will use logretain (instead
of circular logging) regardless of the setting for LOGRETAIN.

If you ask this question one more time, I am going to have to slap you hard.
Nov 12 '05 #8

P: n/a
Ian
Mark A wrote:
"Yasaswi Pulavarti" <ya*****@encfor.com> wrote in message
news:aa*************************@posting.google.co m...
Yes this is what am interested, can I use the sample disk backup
db2uext2.cdisk in addition to a Veritas NetBackup. Also in an earlier
post Mark A. said I can update the parameter in the database
configuration file, however all of the DB2 documentation talks about
setting LOGRETAIN to ON and USEREXIT to on, but does not tell which
parameter I should look out for. Anyway does the act of putting the
compiled db2uext2.c* binary in sqllib/adm location instruct DB2 to
invoke the user exit program?
Thanks,
Yasaswi


I already answered that question. NO, the act of putting the compiled
db2uext2.c* binary in sqllib/adm location DOES NOT instruct DB2 to invoke
the user exit program. You must name the exit program in the database config
with the USEREXIT parm.

Setting LOGRETAIN ON does not invoke an exit program. It does instruct DB2
to retain log files (instead of the default circular logging). See the
manuals for an explanation of the difference between circular logging (the
default) and logretain (with or without an exit program).

When you want to retain the log files, AND ALSO move the log files no
longer needed to another directory, then you set the USEREXIT to the name of
your exit program to do the archiving (moving them to a different
directory). You do not set USEREXIT to ON (you set it to the name of the
exit program if you want one to be invoked).


The problem is that you're wrong. USEREXIT is either Yes or No:

"userexit - User exit enable configuration parameter

Configuration Type
Database
Parameter Type
Configurable
Default [Range]
No [ Yes; No ]

If this parameter is enabled, log retention logging is performed
regardless of how the logretain parameter is set. This parameter also
indicates that a user exit program should be used to archive and
retrieve the log files. Log files are archived when the database manager
closes the log file. They are retrieved when the ROLLFORWARD utility
needs to use them to restore a database."
This looks for the 'db2uext2' executable in sqllib/adm (preferred)
or sqllib/bin. (sqllib/adm is preferred because, on unix, this is
a unique directory per instance, whereas sqllib/bin is a soft link
to the installation directory (/usr/opt/db2_08_01/bin on AIX).
V8.2 allows much more flexible archive log handling. The USEREXIT
parameter is superseded by LOGARCHMETH1 (and LOGARCHMETH2), which allow
you to specify 1 (or 2) locations for archving log files, for example:

LOGARCHMETH1 = DISK:/archivelogs
LOGARCHMETH2 = TSM:

Which would send a copy of the file to both /archivelogs and to TSM
(using the default TSM management class).

You can even specify LOGARCHMETH1 = USEREXIT, which will let you
continue to use your own custom written user exit (db2uext2).
Nov 12 '05 #9

P: n/a
referring to db2 v8 documentation:

When a user exit program is invoked, the database manager passes
control to the executable file, ****db2uext2****. The database manager
passes parameters to db2uext2 and, on completion, the program passes a
return code back to the database manager. Because the database manager
handles a limited set of return conditions, the user exit program
should be able to handle error conditions (see Error handling). And
because

**only one user exit program can be invoked within a database manager
instance**

, it must have a section for each of the operations it may be asked to
perform.

so according to the documentation, on LUW environment, the filename
has to be db2uext2 and the number of db2uext2 programs allowed to use
at a given time is just ONE.

Mark, can you tell me what would be the exact command to specify any
program name for userexit facility? I am asking this just for my
information sake and not otherwise.

hth,
dotyet
"Mark A" <no****@nowhere.com> wrote in message news:<fk***************@news.uswest.net>...

You have to update the db config to indicate the program name before DB2
will use it.

Nov 12 '05 #10

P: n/a
only possible values for userexit are: ON, OFF or YES, NO

C:\Documents and Settings\Administrator>db2 "create database test"
DB20000I The CREATE DATABASE command completed successfully.

C:\Documents and Settings\Administrator>db2 "update db cfg for test
using userexit dabba"
SQL0104N An unexpected token "dabba" was found following "USEREXIT".
Expected tokens may include: "ON". SQLSTATE=42601

C:\Documents and Settings\Administrator>db2 "update db cfg for test
using userexit yes"
DB20000I The UPDATE DATABASE CONFIGURATION command completed
successfully.

C:\Documents and Settings\Administrator>db2 "update db cfg for test
using userexit no"
DB20000I The UPDATE DATABASE CONFIGURATION command completed
successfully.

C:\Documents and Settings\Administrator>db2 "update db cfg for test
using userexit on"
DB20000I The UPDATE DATABASE CONFIGURATION command completed
successfully.

C:\Documents and Settings\Administrator>db2 "update db cfg for test
using userexit off"
DB20000I The UPDATE DATABASE CONFIGURATION command completed
successfully.

C:\Documents and Settings\Administrator>db2 "update db cfg for test
using userexit true"
SQL0104N An unexpected token "true" was found following "USEREXIT".
Expected
tokens may include: "ON". SQLSTATE=42601

C:\Documents and Settings\Administrator>db2 "update db cfg for test
using userexit false"
SQL0104N An unexpected token "false" was found following "USEREXIT".
Expected tokens may include: "ON". SQLSTATE=42601

C:\Documents and Settings\Administrator>db2 "update db cfg for test
using userexit myboy"
SQL0104N An unexpected token "myboy" was found following "USEREXIT".
Expected tokens may include: "ON". SQLSTATE=42601
C:\Documents and Settings\Administrator>

Nov 12 '05 #11

P: n/a
> When you want to retain the log files, AND ALSO move the log files no
longer needed to another directory, then you set the USEREXIT to the name of your exit program to do the archiving (moving them to a different
directory). You do not set USEREXIT to ON (you set it to the name of the
exit program if you want one to be invoked).

If the USEREXIT is set to anything but OFF, DB2 will use logretain (instead of circular logging) regardless of the setting for LOGRETAIN.

Correction,

You set USEREXIT ON or YES and DB2 will use the userexit program placed in
the path. But it will not use the program by merely placing the program in
the path unless USEREXIT is ON or YES.

If either USEREXIT or LOGRETAIN are set on, DB2 will retain the log files
and enable log forward recovery. Otherwise, the default circular logging is
used.

I have slapped myself.
Nov 12 '05 #12

This discussion thread is closed

Replies have been disabled for this discussion.