{"id":608,"date":"2019-10-23T14:55:24","date_gmt":"2019-10-23T06:55:24","guid":{"rendered":"https:\/\/www.linuxdevops.cn\/?p=608"},"modified":"2019-10-23T14:55:25","modified_gmt":"2019-10-23T06:55:25","slug":"log-file-management-of-db2-database","status":"publish","type":"post","link":"https:\/\/www.linuxdevops.cn\/2019\/10\/log-file-management-of-db2-database\/","title":{"rendered":"DB2\u6570\u636e\u5e93\u7684\u65e5\u5fd7\u6587\u4ef6\u7ba1\u7406"},"content":{"rendered":"\n

DB2\u7684\u65e5\u5fd7\u6a21\u5f0f<\/p>\n\n\n\n

1.1\u5faa\u73af\u65e5\u5fd7<\/p>\n\n\n\n

\u3000\u3000\u5f53\u5faa\u73af\u65e5\u5fd7\u751f\u6548\u65f6\uff0c\u4e8b\u52a1\u6570\u636e\u5c06\u901a\u8fc7\u5faa\u73af\u7684\u65b9\u5f0f\u5199\u5165\u4e3b\u8981\u65e5\u5fd7\u6587\u4ef6\u3002\u5f53\u5b58\u50a8\u4e8e\u67d0\u4e2a\u65e5\u5fd7\u6587\u4ef6\u4e2d\u7684\u6240\u6709\u8bb0\u5f55\u90fd\u4e0d\u518d\u9700\u8981\u7528\u4e8e\u6062\u590d<\/strong><\/a>\u65f6\uff0c\u8be5\u65e5\u5fd7\u6587\u4ef6\u5c06\u88ab\u91cd\u7528\uff0c\u5e76\u4e14\u53ef\u4ee5\u5728\u4ee5\u540e\u518d\u6b21\u6210\u4e3a\u6d3b\u52a8\u65e5\u5fd7\u6587\u4ef6\u3002\u8fd9\u610f\u5473\u7740\u5728\u5faa\u73af\u65e5\u5fd7\u6a21\u5f0f\u4e2d\uff0c\u65e5\u5fd7\u6587\u4ef6\u7684\u5185\u5bb9\u6700\u7ec8\u5c06\u88ab\u65b0\u65e5\u5fd7\u6761\u76ee\u91cd\u5199\u3002\u7531\u4e8e\u65e5\u5fd7\u6587\u4ef6\u7684\u5185\u5bb9\u88ab\u91cd\u5199\u8986\u76d6\u4e86\uff0c\u56e0\u6b64\u6211\u4eec\u53ea\u80fd\u5c06\u6570\u636e\u5e93<\/strong><\/a>\u6062\u590d\u5230\u6700\u540e\u4e00\u6b21\u5b8c\u6574\u7684\u6570\u636e\u5e93\u5907\u4efd<\/strong><\/a>\u3002\u4e0d\u80fd\u4f7f\u7528\u5faa\u73af\u65e5\u5fd7\u6267\u884c\u65f6\u95f4\u70b9(point-in-time)\u6062\u590d\u3002<\/p>\n\n\n\n

1.2 \u5f52\u6863\u65e5\u5fd7<\/p>\n\n\n\n

\u3000\u3000\u5728\u5f52\u6863\u65e5\u5fd7\u6a21\u5f0f\u4e2d\uff0credo log\u6761\u76ee\u5c06\u5199\u5165\u4e3b\u8981\u65e5\u5fd7\u6587\u4ef6\u3002\u4f46\u662f\uff0c\u4e0e\u5faa\u73af\u65e5\u5fd7\u4e0d\u540c\uff0c\u8fd9\u4e9b\u65e5\u5fd7\u6587\u4ef6\u6c38\u8fdc\u90fd\u4e0d\u53ef\u91cd\u7528\u3002\u5f53\u5b58\u50a8\u4e8e\u67d0\u4e2a\u65e5\u5fd7\u6587\u4ef6\u4e2d\u7684\u6240\u6709\u8bb0\u5f55\u90fd\u4e0d\u518d\u9700\u8981\u7528\u4e8e\u6062\u590d\u65f6\uff0c\u8be5\u65e5\u5fd7\u6587\u4ef6\u5c06\u88ab\u6807\u8bb0\u4e3a\u975e\u6d3b\u52a8\u800c\u4e0d\u662f\u53ef\u91cd\u7528\u3002\u8fd9\u610f\u5473\u7740\u5b83\u7684\u5185\u5bb9\u6c38\u8fdc\u90fd\u4e0d\u4f1a\u88ab\u8986\u76d6\u3002\u5f53\u7b2c\u4e00\u4e2a\u4e3b\u8981\u65e5\u5fd7\u6587\u4ef6\u53d8\u6ee1\u65f6\uff0c\u7cfb\u7edf\u5c06\u5206\u914d\u4e00\u4e2a\u65b0\u7684\u65e5\u5fd7\u6587\u4ef6\uff0c\u8fd9\u6837\u4e3b\u8981\u65e5\u5fd7\u6587\u4ef6\u7684\u914d\u7f6e\u6570\u91cf(LOGPRIMARY\u6570\u636e\u5e93\u53c2\u6570)\u5c06\u4e00\u76f4\u53ef\u7528\u3002<\/p>\n\n\n\n

\u3000\u3000\u4e0e\u5355\u4e2a\u4e8b\u52a1\u76f8\u5173\u7684\u6240\u6709\u6761\u76ee\u5fc5\u987b\u5728\u6d3b\u52a8\u65e5\u5fd7\u7a7a\u95f4\u4e2d\u4fdd\u6301\u4e00\u81f4\u3002\u5982\u679c\u957f\u65f6\u95f4\u8fd0\u884c\u7684\u4e8b\u52a1\u6240\u9700\u8981\u7684\u65e5\u5fd7\u7a7a\u95f4\u5927\u4e8e\u4e3b\u8981\u65e5\u5fd7\u6587\u4ef6\u53ef\u4ee5\u63d0\u4f9b\u7684\u7a7a\u95f4\uff0c\u5219\u53ef\u80fd\u4f1a\u5206\u914d\u5e76\u4f7f\u7528\u6b21\u8981\u65e5\u5fd7\u6587\u4ef6\u3002\u5728\u5f52\u6863\u65e5\u5fd7\u6a21\u5f0f\u4e2d\uff0c\u901a\u8fc7\u7ed3\u5408\u4f7f\u7528\u6570\u636e\u5e93\u5907\u4efd\u6620\u50cf\u548c\u65e5\u5fd7\u6587\u4ef6\uff0c\u6211\u4eec\u53ef\u4ee5\u5c06\u6570\u636e\u5e93\u6062\u590d\u5230\u5177\u4f53\u7684\u65f6\u95f4\u70b9\u3002\u6709\u5173\u6b64\u6d41\u7a0b\u7684\u8be6\u7ec6\u63cf\u8ff0\u8bf7\u53c2\u89c1\u4e0b\u6587\u3002<\/p>\n\n\n\n

  \u8bbe\u7f6e\u4e86\u5f52\u6863\u6a21\u5f0f\u540e\uff0c\u6570\u636e\u5e93\u5c06\u652f\u6301\u524d\u6eda\u6062\u590d\u3002\u6b64\u65f6\uff0c\u7cfb\u7edf\u4e2d\u5c06\u4f1a\u5b58\u5728\u4e09\u79cd\u7c7b\u578b\u7684\u65e5\u5fd7\u6587\u4ef6:<\/p>\n\n\n\n

\u3000\u3000\u6d3b\u52a8\u65e5\u5fd7:\u8be5\u65e5\u5fd7\u5305\u542b\u5c1a\u672a\u63d0\u4ea4\u6216\u56de\u6eda\u7684\u4e8b\u52a1\u5355\u5143\u7684\u76f8\u5173\u4fe1\u606f\uff0c\u4ee5\u53ca\u5df2\u63d0\u4ea4\u4f46\u5c1a\u672a\u5199\u5165\u6570\u636e\u5e93\u6587\u4ef6\u7684\u4e8b\u52a1\u7684\u4fe1\u606f\u3002<\/p>\n\n\n\n

\u3000\u3000\u8054\u673a\u5b58\u6863\u65e5\u5fd7:\u6d3b\u52a8\u65e5\u5fd7\u4e2d\u6240\u6709\u6539\u52a8\u5bf9\u6b63\u5e38\u5904\u7406\u5df2\u4e0d\u9700\u8981\uff0c\u5373\u8be5\u65e5\u5fd7\u4e2d\u6240\u8bb0\u5f55\u7684\u4e8b\u52a1\u90fd\u5df2\u63d0\u4ea4\u5e76\u5199\u5165\u6570\u636e\u5e93\u6587\u4ef6\u65f6\uff0c\u8be5\u6d3b\u52a8\u65e5\u5fd7\u8f6c\u6362\u4e3a\u8054\u673a\u5b58\u6863\u65e5\u5fd7\u3002\u79f0\u4e4b\u4e3a\u8054\u673a\uff0c\u662f\u7531\u4e8e\u5b83\u4eec\u4e0e\u6d3b\u52a8\u65e5\u5fd7\u5b58\u653e\u5728\u540c\u4e00\u4e2a\u76ee\u5f55\u4e0b\u3002<\/p>\n\n\n\n

\u3000\u3000\u8131\u673a\u5b58\u6863\u65e5\u5fd7:\u5c06\u8054\u673a\u5b58\u6863\u65e5\u5fd7\u4ece\u6d3b\u52a8\u65e5\u5fd7\u76ee\u5f55\u4e0bCopy\u5230\u53e6\u5916\u7684\u5730\u65b9\u5b58\u6863\uff0c\u5c31\u79f0\u4e3a\u8131\u673a\u5b58\u6863\u65e5\u5fd7\u3002\u8fd9\u4e9b\u65e5\u5fd7\u53ef\u80fd\u5728\u6570\u636e\u5e93\u524d\u6eda\u6062\u590d\u7684\u65f6\u5019\u4ecd\u7136\u9700\u8981\u3002<\/p>\n\n\n\n

\u3000\u3000(\u6240\u8c13\u8054\u673a\u5f52\u6863\u65e5\u5fd7\uff0c\u5c31\u662f\u5f52\u6863\u65e5\u5fd7\u6587\u4ef6\u548c\u6d3b\u52a8\u65e5\u5fd7\u6587\u4ef6\u540c\u5728\u4e00\u4e2a\u76ee\u5f55\u4e0b\uff1b\u800c\u79bb\u7ebf\u5f52\u6863\u65e5\u5fd7\uff0c\u5219\u662f\u5f52\u6863\u65e5\u5fd7\u4e0e\u6d3b\u52a8\u65e5\u5fd7\u5206\u5f00\u5b58\u653e)<\/p>\n\n\n\n

\u65e5\u5fd7\u6a21\u5f0f\u4fee\u6539\uff1ahttps:\/\/www.cnblogs.com\/net2012\/archive\/2013\/02\/04\/2891502.html<\/p>\n\n\n\n

\u7ba1\u7406\u6570\u636e\u5e93\u65e5\u5fd7\u7684\u5de5\u4f5c\u53ef\u4ee5\u624b\u5de5\u5b8c\u6210\uff08\u5373\u5c06\u8054\u673a\u5b58\u6863\u65e5\u5fd7\u624b\u5de5\u62f7\u8d1d\u5230\u67d0\u4e2aarchive\u76ee\u5f55\uff09\uff0c\u4e5f\u53ef\u7531\u7f16\u5199USEREXIT\u7a0b\u5e8f\u81ea\u52a8\u7ef4\u62a4\u3002 \u624b\u5de5\u7ba1\u7406\u6570\u636e\u5e93LOG<\/strong><\/p>\n\n\n\n

\u65e2\u7136 DB2 UDB \u4e2d\u7528\u6237\u51fa\u53e3\u7a0b\u5e8f\u7684\u76ee\u7684\u662f\u5c06\u6570\u636e\u5e93\u65e5\u5fd7\u590d\u5236\u5230\u5f52\u6863\u76ee\u5f55\u4e2d\uff0c\u60a8\u6700\u7ec8\u5c06\u5728\u6d3b\u52a8\u65e5\u5fd7\u76ee\u5f55\uff08\u7f3a\u7701\u662f SQLOGDIR\uff09\u4e2d\u5f97\u5230\u91cd\u590d\u7684\u65e5\u5fd7\u6587\u4ef6\u3002\u60a8\u53ef\u80fd\u8003\u8651\u9664\u53bb\u8fd9\u4e9b\u91cd\u590d\u7684\u8054\u673a\u5f52\u6863\u65e5\u5fd7\u4ee5\u91ca\u653e\u6587\u4ef6\u7cfb\u7edf\u7a7a\u95f4\u3002\u5728\u4ece\u6570\u636e\u5e93\u76ee\u5f55\u4e2d\u9664\u53bb\u8fd9\u4e9b\u65e5\u5fd7\u4e4b\u524d\uff0c\u8981\u5341\u5206\u7ec6\u5fc3\u5730\u9a8c\u8bc1\u662f\u5426\u5df2\u7ecf\u5c06\u5b83\u4eec\u6210\u529f\u5730\u590d\u5236\u5230\u5f52\u6863\u76ee\u5f55\u4e2d\u3002\u8fd8\u5fc5\u987b\u786e\u4fdd\u6570\u636e\u5e93\u7ba1\u7406\u5668\u8fdb\u884c\u5d29\u6e83\u6062\u590d\u65f6\u4e0d\u518d\u9700\u8981\u5b83\u4eec\u3002\u8981\u786e\u5b9a\u6d3b\u52a8\u65e5\u5fd7\u76ee\u5f55\u4e2d\u54ea\u4e9b\u65e5\u5fd7\u6587\u4ef6\u4e0d\u4e3a\u6b63\u5e38\u5904\u7406\u6240\u9700\uff0c\u53ef\u7528\u4ee5\u4e0b\u547d\u4ee4\u68c0\u67e5\u6570\u636e\u5e93\u914d\u7f6e\uff1a<\/p>\n\n\n\n

db2 \"get db cfg for sample\"<\/code><\/p>\n\n\n\n

\u8be5\u547d\u4ee4\u7684\u6570\u636e\u5e93\u914d\u7f6e\u8f93\u51fa\u5c06\u5305\u62ec\u7b2c\u4e00\u4e2a\u6d3b\u52a8\u65e5\u5fd7\u6587\u4ef6\uff0c\u4f8b\u5982\uff1a<\/p>\n\n\n\n

First active log file = S000009.LOG<\/code><\/p>\n\n\n\n

\u4e0a\u9762\u8f93\u51fa\u4e2d\u6240\u793a\u7684\u65e5\u5fd7\u6587\u4ef6 S000009.LOG<\/code>\u662f\u6570\u636e\u5e93\u7684\u5f53\u524d\u6d3b\u52a8\u65e5\u5fd7\u3002\u4efb\u4f55\u5c0f\u4e8e\u8be5\u7f16\u53f7\u7684\u65e5\u5fd7\u6587\u4ef6\u90fd\u88ab\u8ba4\u4e3a\u662f\u8054\u673a\u5f52\u6863\u65e5\u5fd7\u3002<\/p>\n\n\n\n

\u4e0b\u9762\u662f\u4e00\u4e2a\u793a\u4f8b\uff1a<\/p>\n\n\n\n

\u5728\u4e0b\u9762\u7684\u65b9\u6848\u4e2d\uff0c\u6d3b\u52a8\u65e5\u5fd7\u76ee\u5f55\u4e2d\u6709\u65e5\u5fd7\u6587\u4ef6 S000000.LOG - S000009.LOG<\/code>\uff0c\u5f52\u6863\u65e5\u5fd7\u76ee\u5f55\u4e2d\u6709 S000000.LOG - S000008.LOG<\/code>\u3002\u56e0\u4e3a S000009.LOG<\/code>\u662f\u7b2c\u4e00\u4e2a\u6d3b\u52a8\u65e5\u5fd7\u6587\u4ef6\uff0c\u6240\u4ee5\uff0c\u53ef\u4ee5\u4ece\u6d3b\u52a8\u65e5\u5fd7\u76ee\u5f55\u4e2d\u5220\u9664 S000001.LOG - S000008.LOG<\/code>\u4ee5\u91ca\u653e\u78c1\u76d8\u7a7a\u95f4\u3002\u5fc5\u987b\u5c06 S000009.LOG<\/code>\u6587\u4ef6\u7559\u5728\u6d3b\u52a8\u65e5\u5fd7\u76ee\u5f55\u4e2d\uff0c\u56e0\u4e3a\u5f53\u524d\u4e8b\u52a1\u4ecd\u7136\u5728\u4f7f\u7528\u5b83\u3002<\/p>\n\n\n\n

\u4e5f\u53ef\u4ee5\u68c0\u67e5\u6570\u636e\u5e93\u5386\u53f2\u6587\u4ef6\uff0c\u4ee5\u67e5\u770b\u6d3b\u52a8\u65e5\u5fd7\u76ee\u5f55\u4e2d\u4e0d\u518d\u9700\u8981\u54ea\u4e9b\u65e5\u5fd7\u6587\u4ef6\u3002\u4ee5\u4e0b\u547d\u4ee4\u5c06\u5217\u51fa\u6570\u636e\u5e93\u5907\u4efd\u4fe1\u606f\uff1a<\/p>\n\n\n\n

    db2 \"list history backup all for database sample\"<\/code><\/p>\n\n\n\n

\u4e0b\u9762\u662f\u8be5\u547d\u4ee4\u7684\u8f93\u51fa\u793a\u4f8b\uff1a<\/p>\n\n\n\n
List History File for sample\nNumber of matching file entries = 4\nOp Obj Timestamp+Sequence Type Dev Earliest Log Current Log \n-- --- ------------------ ---- --- ------------ ------------ \n B D 20030416162026001 F D S0000010.LOG S0000014.LOG\n------------------------------------------------------------\nContains 2 tablespace(s):\n00001 SYSCATSPACE\n00002 USERSPACE1\n------------------------------------------------------------\n<\/td><\/tr><\/tbody><\/table>\n\n\n\n

\u5728\u4e0a\u9762\u7684\u8f93\u51fa\u4e2d\uff0c\u6700\u65e9\u7684\u65e5\u5fd7\u5c06\u8868\u660e\uff1a\u9700\u8981 S0000010.LOG<\/code>\u53ca\u5176\u4e4b\u540e\u7684\u4efb\u4f55\u65e5\u5fd7\u3002\u53ef\u4ee5\u5b89\u5168\u5730\u5220\u9664 S00000010.LOG<\/code>\u4e4b\u524d\u7684\u4efb\u4f55\u65e5\u5fd7\u3002\u518d\u6b21\u63d0\u9192\uff0c\u5728\u4ece\u6d3b\u52a8\u65e5\u5fd7\u76ee\u5f55\u4e2d\u5220\u9664\u65e5\u5fd7\u6587\u4ef6\u4e4b\u524d\uff0c\u9a8c\u8bc1\u5728\u6d3b\u52a8\u65e5\u5fd7\u76ee\u5f55\u4e2d\u5b58\u5728\u8fd9\u4e9b\u65e5\u5fd7\u6587\u4ef6\u7684\u526f\u672c\u662f\u975e\u5e38\u91cd\u8981\u7684\u3002<\/p>\n\n\n\n

\u5c3d\u7ba1\u53ef\u4ee5\u4ece\u6d3b\u52a8\u65e5\u5fd7\u76ee\u5f55\u624b\u5de5\u5220\u9664\u65e5\u5fd7\u6587\u4ef6\uff0c\u4f46\u662f\u9664\u53bb\u8054\u673a\u5f52\u6863\u65e5\u5fd7\u6587\u4ef6\u7684\u66f4\u5b89\u5168\u65b9\u6cd5\u662f\u901a\u8fc7 prune logfile<\/em>\u547d\u4ee4\u3002\u53ef\u4ee5\u4f7f\u7528\u8be5\u547d\u4ee4\u6765\u5220\u9664\u6d3b\u52a8\u65e5\u5fd7\u76ee\u5f55\u4e2d\u7684\u65e5\u5fd7\u6587\u4ef6\u3002\u5728\u4e0b\u9762\u7684\u793a\u4f8b\u4e2d\uff0c\u4ee5\u4e0b\u547d\u4ee4\u5c06\u5220\u9664\u65e5\u5fd7\u6587\u4ef6 S000000.LOG - S000008.LOG<\/code>\uff1a<\/p>\n\n\n\n

db2 \"prune logfile prior to S000009.LOG\"<\/code><\/p>\n\n\n\n

\u6ce8\uff1a\u6839\u636e\u60a8\u7684\u6062\u590d\u7b56\u7565\uff0c\u5728\u6709\u4e9b\u60c5\u51b5\u4e0b\u524d\u9762\u7684\u524d\u6eda\u64cd\u4f5c\u53ef\u80fd\u4f1a\u5728\u6570\u636e\u5e93\u4e0a\u6267\u884c\u3002\u5f52\u6863\u76ee\u5f55\u4e2d\u65e7\u7684\u65e5\u5fd7\u6587\u4ef6\u53ef\u80fd\u4f1a\u88ab\u5177\u6709\u76f8\u540c\u540d\u79f0\u7684\u65b0\u65e5\u5fd7\u6587\u4ef6\u8986\u76d6\uff0c\u4ece\u800c\u4f1a\u963b\u6b62\u60a8\u4f7f\u7528\u65e7\u65e5\u5fd7\u6587\u4ef6\u5bf9\u6570\u636e\u5e93\u8fdb\u884c\u65f6\u95f4\u70b9\u6062\u590d\u3002\u7528\u6237\u51fa\u53e3\u7a0b\u5e8f\u7684\u7a0b\u5e8f\u5458\u9700\u8981\u8003\u8651\u8fd9\u79cd\u60c5\u51b5\uff0c\u8fd9\u4e00\u70b9\u975e\u5e38\u91cd\u8981
\u7a0b\u5e8f\u5de5\u5177\u81ea\u52a8\u7ba1\u7406\uff08\u672a\u9a8c\u8bc1\uff09
\u7531\u4e8eDB2\u5bf9\u6240\u6709\u5e73\u53f0\u90fd\u63d0\u4f9b\u4e86\u76f8\u5e94\u7684USEREXIT\u793a\u4f8b\u7a0b\u5e8f\uff0c\u800c\u4e14\u975e\u5e38\u6613\u4e8e\u4fee\u6539\u548c\u4f7f\u7528\uff0c\u6240\u4ee5IBM\u5efa\u8bae\u7528\u6237\u4f7f\u7528USEREXIT\u7a0b\u5e8f\u6765\u7ba1\u7406\u65e5\u5fd7\u6587\u4ef6\u3002<\/p>\n\n\n\n

\u4f7f\u7528USEREXIT\u7a0b\u5e8f\u7684\u65b9\u6cd5<\/p>\n\n\n\n

\u8981\u4f7f\u7528User exit program\u81ea\u52a8\u5316log\u6587\u4ef6\u7684archiving\u548cretrieval\u8fc7\u7a0b\uff1a<\/p>\n\n\n\n

1. \u8bbe\u7f6edatabase cfg\u53c2\u6570logarchmeth1 \u4e3aUSEREXIT<\/p>\n\n\n\n

connect to sample
update db cfg using logarchmeth1 USEREXIT
connect reset<\/p>\n\n\n\n

2. \u521b\u5efauser exit programs\u3002\u8be5\u7a0b\u5e8f\u5fc5\u987b\u662f\u4e00\u4e2a\u540d\u4e3adb2uext2\u7684\u53ef\u6267\u884c\u6587\u4ef6\u3002DB2\u5728\u5404\u79cd\u5e73\u53f0\u4e0a\u90fd\u63d0\u4f9b\u4e86User Exit\u7684\u793a\u4f8b\u7a0b\u5e8f\uff0c\u7528\u6237\u53ef\u4ee5\u901a\u8fc7\u76f4\u63a5\u4fee\u6539\u8be5\u6837\u672c\u6587\u4ef6\u6765\u5b9e\u73b0\u81ea\u5df1\u7684user exit\u7a0b\u5e8f\u3002<\/p>\n\n\n\n

\u5728UNIX(R) based\u7684\u7cfb\u7edf\u4e2d\uff0c\u8be5\u7a0b\u5e8f\u5b58\u653e\u5728sqllib\/samples\/c\u76ee\u5f55\u4e0b.<\/p>\n\n\n\n

There are four sample user exit programs for UNIX based systems:<\/p>\n\n\n\n

\u2022 db2uext2.ctsm<\/p>\n\n\n\n

This sample uses Tivoli(R) Storage Manager to archive and retrieve database log files.<\/p>\n\n\n\n

\u2022 db2uext2.ctape<\/p>\n\n\n\n

This sample uses tape media to archive and retrieve database log files .<\/p>\n\n\n\n

\u2022 db2uext2.cdisk<\/p>\n\n\n\n

This sample uses the operating system COPY command and disk media to archive and retrieve database log files.<\/p>\n\n\n\n

\u2022 db2uxt2.cxbsa<\/p>\n\n\n\n

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.<\/p>\n\n\n\n

\u2022 \u5728Windows(R) \u7cfb\u7edf\u4e2d\uff0c\u8be5\u6587\u4ef6\u5b58\u653e\u5728sqllib\/samples\/c\u76ee\u5f55\u4e0b\u3002<\/p>\n\n\n\n

There are two sample user exit programs for Windows operating systems:<\/p>\n\n\n\n

\u2022 db2uext2.ctsm<\/p>\n\n\n\n

This sample uses Tivoli Storage Manager to archive and retrieve database log files.<\/p>\n\n\n\n

\u2022 db2uext2.cdisk<\/p>\n\n\n\n

This sample uses the operating system COPY command and disk media to archive and retrieve database log files.<\/p>\n\n\n\n

3. \u914d\u7f6e\u8be5\u793a\u4f8b\u7a0b\u5e8f\uff0c\u6307\u5b9a\u8981\u5c06\u65e5\u5fd7\u6587\u4ef6Archive\u5230\u54ea\u4e2a\u7cfb\u7edf\u76ee\u5f55\u4e2d\uff08\u5728windows\u5e73\u53f0\u4e0b\uff0c\u7a0b\u5e8f\u4e2d\u9ed8\u8ba4\u4e3ac:\\mylogs\uff09\u3002<\/p>\n\n\n\n

#define ARCHIVE_PATH \"c:\\\\mylogs\\\\\"
#define RETRIEVE_PATH \"c:\\\\mylogs\\\\\"
#define AUDIT_ERROR_PATH \"c:\\\\mylogs\\\\\"<\/p>\n\n\n\n

4. \u7f16\u8bd1\u8be5C\u6587\u4ef6<\/p>\n\n\n\n

cl db2uext2.c<\/p>\n\n\n\n

5. \u62f7\u8d1ddb2uext2.exe\u5230\uff0fSQLLIB\/BIN\u76ee\u5f55\u4e0b<\/p>\n\n\n\n

6. \u5728db2cmd\u4e2d\u952e\u5165archive log for db sample user db2admin using duan1980\u547d\u4ee4\u5f3a\u5236\u6267\u884clog\u65e5\u5fd7\u5f52\u6863\u4efb\u52a1\u3002\u67e5\u770bc:\\mylogs\u76ee\u5f55\u4e0b\u6709\u65e0\u65e5\u5fd7\u6587\u4ef6\u5f52\u6863\uff0c\u9a8c\u8bc1\u662f\u5426\u6210\u529f\u3002
\u00a0<\/p>\n\n\n\n

\u00a0\u00a0\u53c2\u8003\u539f\u6587\uff1a<\/p>\n\n\n\n

https:\/\/blog.csdn.net\/woshilipengfei\/article\/details\/83327416<\/p>\n\n\n\n

https:\/\/blog.csdnnet\/xiyuan1999\/article\/details\/7898683\u00a0 <\/p>\n","protected":false},"excerpt":{"rendered":"

DB2\u7684\u65e5\u5fd7\u6a21\u5f0f 1.1\u5faa\u73af\u65e5\u5fd7 \u3000\u3000\u5f53\u5faa\u73af\u65e5\u5fd7\u751f\u6548\u65f6\uff0c\u4e8b\u52a1\u6570\u636e\u5c06\u901a\u8fc7\u5faa\u73af\u7684\u65b9\u5f0f\u5199\u5165\u4e3b\u8981\u65e5\u5fd7\u6587\u4ef6\u3002\u5f53\u5b58\u50a8\u4e8e\u67d0\u4e2a<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[17],"tags":[],"yoast_head":"\nDB2\u6570\u636e\u5e93\u7684\u65e5\u5fd7\u6587\u4ef6\u7ba1\u7406 - Linux\u81ea\u52a8\u5316\u8fd0\u7ef4<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.linuxdevops.cn\/2019\/10\/log-file-management-of-db2-database\/\" \/>\n<meta property=\"og:locale\" content=\"zh_CN\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"DB2\u6570\u636e\u5e93\u7684\u65e5\u5fd7\u6587\u4ef6\u7ba1\u7406 - Linux\u81ea\u52a8\u5316\u8fd0\u7ef4\" \/>\n<meta property=\"og:description\" content=\"DB2\u7684\u65e5\u5fd7\u6a21\u5f0f 1.1\u5faa\u73af\u65e5\u5fd7 \u3000\u3000\u5f53\u5faa\u73af\u65e5\u5fd7\u751f\u6548\u65f6\uff0c\u4e8b\u52a1\u6570\u636e\u5c06\u901a\u8fc7\u5faa\u73af\u7684\u65b9\u5f0f\u5199\u5165\u4e3b\u8981\u65e5\u5fd7\u6587\u4ef6\u3002\u5f53\u5b58\u50a8\u4e8e\u67d0\u4e2a\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.linuxdevops.cn\/2019\/10\/log-file-management-of-db2-database\/\" \/>\n<meta property=\"og:site_name\" content=\"Linux\u81ea\u52a8\u5316\u8fd0\u7ef4\" \/>\n<meta property=\"article:published_time\" content=\"2019-10-23T06:55:24+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2019-10-23T06:55:25+00:00\" \/>\n<meta name=\"author\" content=\"\u7ba1\u7406\u5458\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/www.linuxdevops.cn\/2019\/10\/log-file-management-of-db2-database\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/www.linuxdevops.cn\/2019\/10\/log-file-management-of-db2-database\/\"},\"author\":{\"name\":\"\u7ba1\u7406\u5458\",\"@id\":\"https:\/\/www.linuxdevops.cn\/#\/schema\/person\/3e206335d5796fdd8679e449df72a0d1\"},\"headline\":\"DB2\u6570\u636e\u5e93\u7684\u65e5\u5fd7\u6587\u4ef6\u7ba1\u7406\",\"datePublished\":\"2019-10-23T06:55:24+00:00\",\"dateModified\":\"2019-10-23T06:55:25+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/www.linuxdevops.cn\/2019\/10\/log-file-management-of-db2-database\/\"},\"wordCount\":330,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\/\/www.linuxdevops.cn\/#\/schema\/person\/3e206335d5796fdd8679e449df72a0d1\"},\"articleSection\":[\"Linux\"],\"inLanguage\":\"zh-CN\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/www.linuxdevops.cn\/2019\/10\/log-file-management-of-db2-database\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.linuxdevops.cn\/2019\/10\/log-file-management-of-db2-database\/\",\"url\":\"https:\/\/www.linuxdevops.cn\/2019\/10\/log-file-management-of-db2-database\/\",\"name\":\"DB2\u6570\u636e\u5e93\u7684\u65e5\u5fd7\u6587\u4ef6\u7ba1\u7406 - Linux\u81ea\u52a8\u5316\u8fd0\u7ef4\",\"isPartOf\":{\"@id\":\"https:\/\/www.linuxdevops.cn\/#website\"},\"datePublished\":\"2019-10-23T06:55:24+00:00\",\"dateModified\":\"2019-10-23T06:55:25+00:00\",\"breadcrumb\":{\"@id\":\"https:\/\/www.linuxdevops.cn\/2019\/10\/log-file-management-of-db2-database\/#breadcrumb\"},\"inLanguage\":\"zh-CN\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.linuxdevops.cn\/2019\/10\/log-file-management-of-db2-database\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.linuxdevops.cn\/2019\/10\/log-file-management-of-db2-database\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"\u9996\u9875\",\"item\":\"https:\/\/www.linuxdevops.cn\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Linux\",\"item\":\"https:\/\/www.linuxdevops.cn\/linux\/\"},{\"@type\":\"ListItem\",\"position\":3,\"name\":\"DB2\u6570\u636e\u5e93\u7684\u65e5\u5fd7\u6587\u4ef6\u7ba1\u7406\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.linuxdevops.cn\/#website\",\"url\":\"https:\/\/www.linuxdevops.cn\/\",\"name\":\"Linux\u81ea\u52a8\u5316\u8fd0\u7ef4\",\"description\":\"Linux\u81ea\u52a8\u5316\u8fd0\u7ef4\u7b14\u8bb0\",\"publisher\":{\"@id\":\"https:\/\/www.linuxdevops.cn\/#\/schema\/person\/3e206335d5796fdd8679e449df72a0d1\"},\"alternateName\":\"linuxdevops\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.linuxdevops.cn\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"zh-CN\"},{\"@type\":[\"Person\",\"Organization\"],\"@id\":\"https:\/\/www.linuxdevops.cn\/#\/schema\/person\/3e206335d5796fdd8679e449df72a0d1\",\"name\":\"\u7ba1\u7406\u5458\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"zh-CN\",\"@id\":\"https:\/\/www.linuxdevops.cn\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/www.linuxdevops.cn\/wp-content\/uploads\/2019\/07\/cropped-index.jpg\",\"contentUrl\":\"https:\/\/www.linuxdevops.cn\/wp-content\/uploads\/2019\/07\/cropped-index.jpg\",\"width\":512,\"height\":512,\"caption\":\"\u7ba1\u7406\u5458\"},\"logo\":{\"@id\":\"https:\/\/www.linuxdevops.cn\/#\/schema\/person\/image\/\"},\"description\":\"\u7ba1\u7406\u5458\",\"url\":\"https:\/\/www.linuxdevops.cn\/author\/root\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"DB2\u6570\u636e\u5e93\u7684\u65e5\u5fd7\u6587\u4ef6\u7ba1\u7406 - Linux\u81ea\u52a8\u5316\u8fd0\u7ef4","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.linuxdevops.cn\/2019\/10\/log-file-management-of-db2-database\/","og_locale":"zh_CN","og_type":"article","og_title":"DB2\u6570\u636e\u5e93\u7684\u65e5\u5fd7\u6587\u4ef6\u7ba1\u7406 - Linux\u81ea\u52a8\u5316\u8fd0\u7ef4","og_description":"DB2\u7684\u65e5\u5fd7\u6a21\u5f0f 1.1\u5faa\u73af\u65e5\u5fd7 \u3000\u3000\u5f53\u5faa\u73af\u65e5\u5fd7\u751f\u6548\u65f6\uff0c\u4e8b\u52a1\u6570\u636e\u5c06\u901a\u8fc7\u5faa\u73af\u7684\u65b9\u5f0f\u5199\u5165\u4e3b\u8981\u65e5\u5fd7\u6587\u4ef6\u3002\u5f53\u5b58\u50a8\u4e8e\u67d0\u4e2a","og_url":"https:\/\/www.linuxdevops.cn\/2019\/10\/log-file-management-of-db2-database\/","og_site_name":"Linux\u81ea\u52a8\u5316\u8fd0\u7ef4","article_published_time":"2019-10-23T06:55:24+00:00","article_modified_time":"2019-10-23T06:55:25+00:00","author":"\u7ba1\u7406\u5458","twitter_card":"summary_large_image","schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.linuxdevops.cn\/2019\/10\/log-file-management-of-db2-database\/#article","isPartOf":{"@id":"https:\/\/www.linuxdevops.cn\/2019\/10\/log-file-management-of-db2-database\/"},"author":{"name":"\u7ba1\u7406\u5458","@id":"https:\/\/www.linuxdevops.cn\/#\/schema\/person\/3e206335d5796fdd8679e449df72a0d1"},"headline":"DB2\u6570\u636e\u5e93\u7684\u65e5\u5fd7\u6587\u4ef6\u7ba1\u7406","datePublished":"2019-10-23T06:55:24+00:00","dateModified":"2019-10-23T06:55:25+00:00","mainEntityOfPage":{"@id":"https:\/\/www.linuxdevops.cn\/2019\/10\/log-file-management-of-db2-database\/"},"wordCount":330,"commentCount":0,"publisher":{"@id":"https:\/\/www.linuxdevops.cn\/#\/schema\/person\/3e206335d5796fdd8679e449df72a0d1"},"articleSection":["Linux"],"inLanguage":"zh-CN","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.linuxdevops.cn\/2019\/10\/log-file-management-of-db2-database\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.linuxdevops.cn\/2019\/10\/log-file-management-of-db2-database\/","url":"https:\/\/www.linuxdevops.cn\/2019\/10\/log-file-management-of-db2-database\/","name":"DB2\u6570\u636e\u5e93\u7684\u65e5\u5fd7\u6587\u4ef6\u7ba1\u7406 - Linux\u81ea\u52a8\u5316\u8fd0\u7ef4","isPartOf":{"@id":"https:\/\/www.linuxdevops.cn\/#website"},"datePublished":"2019-10-23T06:55:24+00:00","dateModified":"2019-10-23T06:55:25+00:00","breadcrumb":{"@id":"https:\/\/www.linuxdevops.cn\/2019\/10\/log-file-management-of-db2-database\/#breadcrumb"},"inLanguage":"zh-CN","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.linuxdevops.cn\/2019\/10\/log-file-management-of-db2-database\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.linuxdevops.cn\/2019\/10\/log-file-management-of-db2-database\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"\u9996\u9875","item":"https:\/\/www.linuxdevops.cn\/"},{"@type":"ListItem","position":2,"name":"Linux","item":"https:\/\/www.linuxdevops.cn\/linux\/"},{"@type":"ListItem","position":3,"name":"DB2\u6570\u636e\u5e93\u7684\u65e5\u5fd7\u6587\u4ef6\u7ba1\u7406"}]},{"@type":"WebSite","@id":"https:\/\/www.linuxdevops.cn\/#website","url":"https:\/\/www.linuxdevops.cn\/","name":"Linux\u81ea\u52a8\u5316\u8fd0\u7ef4","description":"Linux\u81ea\u52a8\u5316\u8fd0\u7ef4\u7b14\u8bb0","publisher":{"@id":"https:\/\/www.linuxdevops.cn\/#\/schema\/person\/3e206335d5796fdd8679e449df72a0d1"},"alternateName":"linuxdevops","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.linuxdevops.cn\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"zh-CN"},{"@type":["Person","Organization"],"@id":"https:\/\/www.linuxdevops.cn\/#\/schema\/person\/3e206335d5796fdd8679e449df72a0d1","name":"\u7ba1\u7406\u5458","image":{"@type":"ImageObject","inLanguage":"zh-CN","@id":"https:\/\/www.linuxdevops.cn\/#\/schema\/person\/image\/","url":"https:\/\/www.linuxdevops.cn\/wp-content\/uploads\/2019\/07\/cropped-index.jpg","contentUrl":"https:\/\/www.linuxdevops.cn\/wp-content\/uploads\/2019\/07\/cropped-index.jpg","width":512,"height":512,"caption":"\u7ba1\u7406\u5458"},"logo":{"@id":"https:\/\/www.linuxdevops.cn\/#\/schema\/person\/image\/"},"description":"\u7ba1\u7406\u5458","url":"https:\/\/www.linuxdevops.cn\/author\/root\/"}]}},"_links":{"self":[{"href":"https:\/\/www.linuxdevops.cn\/wp-json\/wp\/v2\/posts\/608"}],"collection":[{"href":"https:\/\/www.linuxdevops.cn\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.linuxdevops.cn\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.linuxdevops.cn\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.linuxdevops.cn\/wp-json\/wp\/v2\/comments?post=608"}],"version-history":[{"count":1,"href":"https:\/\/www.linuxdevops.cn\/wp-json\/wp\/v2\/posts\/608\/revisions"}],"predecessor-version":[{"id":609,"href":"https:\/\/www.linuxdevops.cn\/wp-json\/wp\/v2\/posts\/608\/revisions\/609"}],"wp:attachment":[{"href":"https:\/\/www.linuxdevops.cn\/wp-json\/wp\/v2\/media?parent=608"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.linuxdevops.cn\/wp-json\/wp\/v2\/categories?post=608"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.linuxdevops.cn\/wp-json\/wp\/v2\/tags?post=608"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}