connect to sample
update db cfg using logarchmeth1 USEREXIT
connect reset
2. 創建user exit programs。該程序必須是一個名為db2uext2的可執行文件。DB2在各種平臺上都提供了User Exit的示例程序,用戶可以通過直接修改該樣本文件來實現自己的user exit程序?! ≡赨NIX(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目錄下?! ?. 在db2cmd中鍵入archive log for db sample user db2admin using duan1980命令強制執行log日志歸檔任務。查看c:mylogs目錄下有無日志文件歸檔,驗證是否成功。 新聞熱點
疑難解答