天天看点

【DB2学习】由于TSM损坏导致归档失败

2010-01-29-10.19.25.544030+480 I54728390A401      LEVEL: Error

PID     : 434422               TID  : 1           PROC : db2logmgr (MYDB) 0

INSTANCE: db2inst1             NODE : 000

FUNCTION: DB2 UDB, data protection services, sqlpgArchiveLogFile, probe:3160

MESSAGE : Failed to archive log file S0002000.LOG to USEREXIT from

          /home/db2inst1/db2inst1/NODE0000/SQL00004/SQLOGDIR/ with rc = 8.

2010-01-29-10.19.25.544197+480 I54728792A380      LEVEL: Warning

FUNCTION: DB2 UDB, data protection services, sqlpgRetryFailedArchive, probe:4780

MESSAGE : Still unable to archive log file 2000 due to rc 8 for LOGARCHMETH1

          using method 4 and target .

2010-01-29-10.19.34.944387+480 I54729173A401      LEVEL: Error

MESSAGE : Failed to archive log file S0002132.LOG to USEREXIT from

2010-01-29-10.19.34.944553+480 I54729575A319      LEVEL: Error

FUNCTION: DB2 UDB, data protection services, sqlpgArchivePendingLogs, probe:1500

MESSAGE : Log archive failed with rc 8 for LOGARCHMETH1.

解决思路 :

1  从 Failed to archive log file S0002132.LOG to USEREXIT from 。。。看出归档到userexit 指定的路径失败!所以应该查看userexit 指定的归档路径是什么地方。

2  编译用户出口程序

先改成C文件,并设置权限

mv /home/db2inst/sqllib/samples/c/db2uext.cdisk /home/db2inst/db2uext.c

chmod 777 /home/db2inst/db2uext.c

然后修改该文件,主要修改以下几个关键项

vi /home/db2inst/db2uext.c

#define ARCHIVE_PATH      "/u/"           /* path must end with a slash       */

#define RETRIEVE_PATH     "/u/"           /* path must end with a slash       */

#define AUDIT_ACTIVE          1           /* enable audit trail logging        */

#define ERROR_ACTIVE          1           /* enable error trail logging        */

#define AUDIT_ERROR_PATH  "/u/"           /* path must end with a slash      */

#define AUDIT_ERROR_ATTR    "a"           /* append to text file             */

#define BUFFER_SIZE          32           /* # of 4K pages for output buffer    */

3 看出这里的归档路径,(实际上该数据库是由TSM来管理备份的),TSM 失效,导致归档失败!

解决办法:

将userexit  设置为off ,将logarchmeth1设置为本地磁盘路径,DISK:具体的路径

附上:

userexit 参数的含义:当使用该参数时,日志的归档和检索使用用户出口程序自动执行的,这个出口程序是由db2uext2 调用的。这个程序用于将在线归档日志移动到与活动日志目录不同的目录中,或者移动到另一个媒介(此案例是在TSM 指定 的目录)。当在ROLLFORARD 操作期间需要某些离线归档日志时,这个程序还可以用于将归档日志取出到活动日志目录中。在windows下,db2uext2 必须在sqllib/bin 目录下,在unix下,db2uext2 必须在sqllib/adm目录下。

v9 版本以后 就不再推荐使用该参数了!而是使用 logarchmeth1 和logarchmeth2这两个参数来管理数据库日志的归档。