connect to sample
update db cfg using logarchmeth1 USEREXIT
connect reset
2. 创建user exit programs。该程序必须是一个名为db2uext2的可执行文件。DB2在各种平台上都提供了User Exit的示例程序,用户可以通过直接修改该样本文件来实现自己的user exit程序。 在UNIX(R) based的系统中,该程序存放在sqllib/samples/c目录下.There are four sample user exit programs for UNIX based systems:
• db2uext2.ctsm
This sample uses Tivoli(R) Storage Manager to archive and retrieve database log files.
• db2uext2.ctape
This sample uses tape media to archive and retrieve database log files .
• db2uext2.cdisk
This sample uses the Operating system COPY command and disk media to archive and
retrieve database log files.
• db2uxt2.cxbsa
This sample works with the XBSA Draft 0.8 published by the X/Open group.
It can be used to archive and retrieve database log files. This sample is
only supported on AIX.
•
在Windows(R) 系统中,该文件存放在sqllib/samples/c目录下。There are two sample user exit programs for Windows operating systems:
• db2uext2.ctsm
This sample uses Tivoli Storage Manager to archive and retrieve database log files.
• db2uext2.cdisk
This sample uses the operating system COPY command and disk media to archive
and retrieve database log files.
3. 配置该示例程序,指定要将日志文件Archive到哪个系统目录中(在windows平台下,程序中默认为c:mylogs)。#define ARCHIVE_PATH "c:/mylogs/"
#define RETRIEVE_PATH "c:/mylogs/"
#define AUDIT_ERROR_PATH "c:/mylogs/"
4. 编译该C文件。cl db2uext2.c
5. 拷贝db2uext2.exe到/SQLLIB/BIN目录下。 6. 在db2cmd中键入archive log for db sample user db2admin using duan1980命令强制执行log日志归档任务。查看c:mylogs目录下有无日志文件归档,验证是否成功。 新闻热点
疑难解答