自拍偷在线精品自拍偷,亚洲欧美中文日韩v在线观看不卡

DB2歸檔日志的管理方案從哪幾點(diǎn)入手?

數(shù)據(jù)庫(kù)
此文章主要向大家描述的是DB2歸檔日志的管理方案,以及對(duì)其需求,問(wèn)題分析,使用USEREXIT程序的實(shí)際操作方法等內(nèi)容的介紹。

此文章主要向大家講述的是DB2歸檔日志的管理方案,我們主要是從其需求描述。問(wèn)題分析,使用USEREXIT程序的實(shí)際操作方法等相關(guān)內(nèi)容對(duì)DB2歸檔日志的管理方案進(jìn)行描述,以下就是文章的主要內(nèi)容講述。

 

需求描述

由于使用了LOGRETAIN=ON數(shù)據(jù)庫(kù)配置,所以數(shù)據(jù)庫(kù)日志文件將不會(huì)被數(shù)據(jù)庫(kù)從活動(dòng)日志目錄中自動(dòng)刪除或循環(huán)利用,活動(dòng)日志目錄中的日志文件將會(huì)越來(lái)越多,所以需要對(duì)該目錄下的日志文件進(jìn)行歸檔。

問(wèn)題分析

將LOGRETAIN設(shè)置為ON后,數(shù)據(jù)庫(kù)將支持前滾恢復(fù)。此時(shí),系統(tǒng)中將會(huì)存在三種類型的日志文件:

活動(dòng)日志:該日志包含尚未提交或回滾的事務(wù)單元的相關(guān)信息,以及已提交但尚未寫入數(shù)據(jù)庫(kù)文件的事務(wù)的信息。

聯(lián)機(jī)存檔日志:活動(dòng)日志中所有改動(dòng)對(duì)正常處理已不需要,即該日志中所記錄的事務(wù)都已提交并寫入數(shù)據(jù)庫(kù)文件時(shí),該活動(dòng)日志轉(zhuǎn)換為聯(lián)機(jī)存檔日志。稱之為聯(lián)機(jī),是由于它們與活動(dòng)日志存放在同一個(gè)目錄下。

脫機(jī)存檔日志:將聯(lián)機(jī)存檔日志從活動(dòng)日志目錄下Copy到另外的地方存檔,就稱為脫機(jī)存檔日志。這些日志可能在數(shù)據(jù)庫(kù)前滾恢復(fù)的時(shí)候仍然需要。

DB2歸檔日志管理數(shù)據(jù)庫(kù)日志的工作可以手工完成(即將聯(lián)機(jī)存檔日志手工拷貝到某個(gè)archive目錄),也可由編寫USEREXIT程序自動(dòng)維護(hù)。

由于DB2對(duì)所有平臺(tái)都提供了相應(yīng)的USEREXIT示例程序,而且非常易于修改和使用,所以IBM建議用戶使用USEREXIT程序來(lái)DB2歸檔日志文件。

使用USEREXIT程序的方法

要使用User exit program自動(dòng)化log文件的archiving和retrieval過(guò)程:

1. 設(shè)置database cfg參數(shù)logarchmeth1 為USEREXIT

 

  1. connect to sample  
  2. update db cfg using logarchmeth1 USEREXIT  
  3. connect reset  

 

2. 創(chuàng)建user exit programs。該程序必須是一個(gè)名為db2uext2的可執(zhí)行文件。DB2在各種平臺(tái)上都提供了User Exit的示例程序,用戶可以通過(guò)直接修改該樣本文件來(lái)實(shí)現(xiàn)自己的user exit程序。

在UNIX(R) based的系統(tǒng)中,該程序存放在sqllib/samples/c目錄下.

 

  1. There are four sample user exit programs for UNIX based systems:  
  2. • db2uext2.ctsm  
  3. This sample uses Tivoli(R) Storage Manager to archive and retrieve database log files.  
  4. • db2uext2.ctape  
  5. This sample uses tape media to archive and retrieve database log files .  
  6. • db2uext2.cdisk  
  7. This sample uses the operating system COPY command and disk media to archive and retrieve database log files.  
  8. • db2uxt2.cxbsa  
  9. 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) 系統(tǒng)中,該文件存放在sqllib/samples/c目錄下。

 

  1. There are two sample user exit programs for Windows operating systems:  
  2. • db2uext2.ctsm  
  3. This sample uses Tivoli Storage Manager to archive and retrieve database log files.  
  4. • db2uext2.cdisk  
  5. This sample uses the operating system COPY command and disk media to archive and retrieve database log files.  

 

3. 配置該示例程序,指定要將日志文件Archive到哪個(gè)系統(tǒng)目錄中(在windows平臺(tái)下,程序中默認(rèn)為c:\mylogs)。

 

  1. #define ARCHIVE_PATH "c:\\mylogs\\"  
  2. #define RETRIEVE_PATH "c:\\mylogs\\"  
  3. #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命令強(qiáng)制執(zhí)行l(wèi)og日志歸檔任務(wù)。查看c:\mylogs目錄下有無(wú)日志文件歸檔,驗(yàn)證是否成功。以上的相關(guān)內(nèi)容就是對(duì)DB2歸檔日志管理方案的介紹,望你能有所收獲。

 

 

責(zé)任編輯:佚名 來(lái)源: CNBeta
相關(guān)推薦

2010-08-16 10:53:33

DB2 9管理軟件安裝

2010-08-17 13:00:19

DB2數(shù)據(jù)遷移

2010-08-27 11:22:01

DB2日志文件歸檔

2010-11-04 11:07:56

DB2管理命令

2010-11-01 12:11:43

DB2表空間

2010-11-01 11:13:57

DB2表管理

2010-11-01 11:45:06

DB2管理頁(yè)大小

2010-08-17 13:37:18

DB2 Online

2010-08-18 10:59:20

IBM DB2 Cat

2010-09-01 10:17:14

DB2日志

2010-08-20 10:26:25

DB2數(shù)據(jù)類型

2010-08-12 17:55:04

DB2無(wú)限活動(dòng)日志策略

2010-09-30 11:55:03

DB2表空間

2010-09-01 14:46:16

DB2表空間

2010-08-12 16:10:45

DB2 Online

2010-07-30 13:21:21

2010-08-06 13:40:06

DB2建立nickna

2010-08-04 15:00:06

DB2未使用索引

2010-08-16 13:53:26

2010-08-18 14:36:32

安裝DB2 管理軟件
點(diǎn)贊
收藏

51CTO技術(shù)棧公眾號(hào)