- 论坛徽章:
- 0
|
[请教]如何设置Userexit
这个应该是比较关键的吧,
但是我还是没有配置的经验,
哪位有经验给我们讲一讲~~~
谢谢!!!
/*****************************************************************************/
/* */
/* Sample Name: db2uext2.ctsm */
/* */
/* */
/* Purpose: This is a sample User Exit utilizing Tivoli Storage Manager */
/* ( TSM ) to Archive and Retrieve database log files. */
/* */
/* Options: 1. This sample provides an audit trail of calls ( stored in a */
/* separate file for each option ) including a timestamp and */
/* parameters received. This option can be disabled. */
/* */
/* 2. This sample provides an error trail of calls in error */
/* including a timestamp and an error isolation string for */
/* problem determination. This option can be disabled. */
/* */
/* */
/* Usage: 1. Copy "db2uext2.ctsm" to "db2uext2.c" and place this file */
/* into a working directory. */
/* */
/* 2. Modify the "Installation Defined Variables" to suit your */
/* environment. Two example scenarios have been provided */
/* below for illustrative purposes. */
/* */
/* 3. Modify the program logic to suit your environment. If */
/* there are situations where the user exit program fails on */
/* archive request and you want DB2 to retry the request, set */
/* the return code to RC_OPATTN. */
/* */
/* 4. Compile and link "db2uext2.c" with the following command: */
/* "cc_r -o db2uext2 db2uext2.c */
/* /usr/tivoli/tsm/client/api/bin/libApiDS.a */
/* -I/usr/tivoli/tsm/client/api/bin/sample" */
/* or a functional equivalent. */
/* Place the resultant "db2uext2" named executable into */
/* sqllib/adm or sqllib/bin. */
/* */
/* *** NOTE *** Code/command modification may be required */
/* depending on compiler options used and */
/* header file location */
/* */
/* *** NOTE *** On Solaris compile as follows: */
/* cc -o db2uext2 db2uext2.c -xarch=v9 */
/* /opt/tivoli/tsm/client/api/bin/libApiDS.so */
/* -I/opt/tivoli/tsm/client/api/bin/sample */
/* */
/* where -xarch=<a>; specifies architecture */
/* instruction set */
/* */
/* *** NOTE *** On HP compile as follows: */
/* cc -D_INCLUDE_POSIX_SOURCE -Aa db2uext2.c */
/* -o db2uext2 */
/* -I/opt/tivoli/tsm/client/api/bin/sample +e */
/* /opt/tivoli/tsm/client/api/bin/libApiDS.sl */
/* */
/* *** NOTE *** On Linux compile as follows: */
/* cc -D_INCLUDE_POSIX_SOURCE db2uext2.c */
/* -o db2uext2 */
/* -I/opt/tivoli/tsm/client/api/bin/sample */
/* /opt/tivoli/tsm/client/api/bin/libApiDS.so */
/* -lApiDS -lpthread -lcrypt -ldl */
/* */
/* 5. DB2 calls "db2uext2" in the following format - */
/* */
/* db2uext2 -OS<os>; -RL<release>; -RQ<request>; -DB<dbname>; */
/* -NN<nodenumber>; -LP<logpath>; -LN<logname>; */
/* [-LSlogsize -SPstartingpage] */
/* [-AP<tsmpasswd>;] */
/* */
/* where: os = operating system */
/* release = DB2 release */
/* request = 'ARCHIVE' or 'RETRIEVE' */
/* dbname = database name */
/* nodenumber = node number */
/* logpath = log file path */
/* logname = log file name */
/* logsize = log file size (optional) */
/* startingpage = starting offset in 4K page unit */
/* (optional) */
/* tsmpasswd = TSM password (optional) */
/* */
/* Note: logsize and startingpage are only used when */
/* logpath is a raw device. */
/* */
/* 6. The following naming convention has been used in this user */
/* exit: */
/* */
/* For the TSM register filespace call: */
/* . filespace name = "/xxxxxxxx" where "xxxxxxx" is the */
/* database name */
/* . filespace type = "DB2" */
/* */
/* For the TSM object: */
/* . object name filespace = "/xxxxxxxx" where "xxxxxxxx" */
/* is the database name */
/* . object high level name = "/NODEyyyy" where "yyyy" */
/* is the node number */
/* . object low level name = "/Szzzzzzz.LOG" where */
/* "zzzzzzz" is the log file */
/* number */
/* */
/* For example: If the database name was "SAMPLE", the node */
/* number was NODE0000 and the log file name was */
/* "S0000001.LOG", the following */
/* would result: */
/* */
/* For the TSM register filespace call: */
/* . filespace name = "/SAMPLE" */
/* . filespace type = "DB2" */
/* */
/* For the TSM object: */
/* . object name filespace = "/SAMPLE" */
/* . object high level name = "/NODE0000" */
/* . object low level name = "/S0000001.LOG" */
/* */
/* */
/* Logic Flow: 1. install signal handlers */
/* 2. verify the number of parameters passed */
/* 3. verify the action requested */
/* 4. start the audit trail ( if requested ) */
/* 5. if the requested action is to archive a file: */
/* . if the log file is not found, proceed to point 10 */
/* 6. get the TSM library version */
/* 7. setup environment variables and initialize the */
/* TSM session */
/* 8. if the requested action is to archive a file: */
/* . register the filespace */
/* . bind the application */
/* . begin the transaction */
/* . begin the sending of the object ( log file ) */
/* . send the object in BUFFER_SIZE portions to TSM */
/* . end the sending of the object */
/* . end the transaction */
/* if the requested action is to retrieve a file: */
/* . begin the query to search for the object ( log file ) */
/* . search for the object */
/* . end the search for the object */
/* . if the object is not found, proceed to point 10 */
/* . begin the transfer of data */
/* . receive the object in BUFFER_SIZE portions from TSM */
/* into a temporary file */
/* . end the transfer of data */
/* . if successful, rename the temporary file to the log file */
/* 9. terminate the TSM session */
/* 10. log errors ( if requested and required ) */
/* 11. end the audit trail ( if requested ) */
/* 12. exit with the appropriate return code */
/* */
/*****************************************************************************/ |
|