久久r热视频,国产午夜精品一区二区三区视频,亚洲精品自拍偷拍,欧美日韩精品二区

您的位置:首頁技術文章
文章詳情頁

DB2數(shù)據(jù)庫歸檔日志的管理方案簡介

瀏覽:27日期:2023-11-11 08:36:57
需求描述:由于使用了LOGRETAIN=ON數(shù)據(jù)庫配置,所以數(shù)據(jù)庫日志文件將不會被數(shù)據(jù)庫從活動日志目錄中自動刪除或循環(huán)利用,活動日志目錄中的日志文件將會越來越多,所以需要對該目錄下的日志文件進行歸檔。問題分析將LOGRETAIN設置為ON后,數(shù)據(jù)庫將支持前滾恢復。此時,系統(tǒng)中將會存在三種類型的日志文件:活動日志:該日志包含尚未提交或回滾的事務單元的相關信息,以及已提交但尚未寫入數(shù)據(jù)庫文件的事務的信息。聯(lián)機存檔日志:活動日志中所有改動對正常處理已不需要,即該日志中所記錄的事務都已提交并寫入數(shù)據(jù)庫文件時,該活動日志轉換為聯(lián)機存檔日志。稱之為聯(lián)機,是由于它們與活動日志存放在同一個目錄下。脫機存檔日志:將聯(lián)機存檔日志從活動日志目錄下Copy到另外的地方存檔,就稱為脫機存檔日志。這些日志可能在數(shù)據(jù)庫前滾恢復的時候仍然需要。治理數(shù)據(jù)庫日志的工作可以手工完成(即將聯(lián)機存檔日志手工拷貝到某個archive目錄),也可由編寫USEREXIT程序自動維護。由于DB2對所有平臺都提供了相應的USEREXIT示例程序,而且非常易于修改和使用,所以IBM建議用戶使用USEREXIT程序來治理日志文件。使用USEREXIT程序的方法要使用User exit program自動化log文件的archiving和retrieval過程:1. 設置database cfg參數(shù)logarchmeth1 為USEREXIT。connect to sampleupdate db cfg using logarchmeth1 USEREXITconnect reset2. 創(chuàng)建user exit programs。該程序必須是一個名為db2uext2的可執(zhí)行文件。DB2在各種平臺上都提供了User Exit的示例程序,用戶可以通過直接修改該樣本文件來實現(xiàn)自己的user exit程序。在UNIX(R) based的系統(tǒng)中,該程序存放在sqllib/samples/c目錄下.There are four sample user exit programs for UNIX based systems:• db2uext2.ctsmThis sample uses Tivoli(R) Storage Manager to archive and retrieve database log files.• db2uext2.ctapeThis sample uses tape media to archive and retrieve database log files .• db2uext2.cdiskThis sample uses the operating system COPY command and disk media to archive andretrieve database log files.• db2uxt2.cxbsaThis 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 isonly supported on AIX.•在Windows(R) 系統(tǒng)中,該文件存放在sqllib/samples/c目錄下。There are two sample user exit programs for Windows operating systems:• db2uext2.ctsmThis sample uses Tivoli Storage Manager to archive and retrieve database log files.• db2uext2.cdiskThis sample uses the operating system COPY command and disk media to archiveand retrieve database log files.3. 配置該示例程序,指定要將日志文件Archive到哪個系統(tǒng)目錄中(在windows平臺下,程序中默認為c:mylogs)。#define ARCHIVE_PATH "c:mylogs"#define RETRIEVE_PATH "c:mylogs"#define AUDIT_ERROR_PATH "c:mylogs"4. 編譯該C文件。cl db2uext2.c5. 拷貝db2uext2.exe到/SQLLIB/BIN目錄下。6. 在db2cmd中鍵入archive log for db sample user db2admin using duan1980命令強制執(zhí)行l(wèi)og日志歸檔任務。查看c:mylogs目錄下有無日志文件歸檔,驗證是否成功。
主站蜘蛛池模板: 四平市| 新民市| 大埔区| 柘城县| 锦州市| 玉山县| 霍山县| 社旗县| 大悟县| 洛阳市| 淅川县| 郯城县| 依兰县| 石嘴山市| 白河县| 商水县| 麻江县| 车致| 泰安市| 绥芬河市| 昆明市| 云龙县| 宿州市| 九龙县| 元朗区| 屏边| 永宁县| 陵水| 渭南市| 东兰县| 祁连县| 新宾| 道真| 梅州市| 宜宾县| 光山县| 娄烦县| 自治县| 西林县| 太湖县| 襄汾县|