Sun Java System Calendar Server 6 2005Q4 管理指南

重建已損毀的行事曆資料庫

本小節說明如何使用 csdb rebuild 指令,其中包含以下主題:

rebuild 簡介

rebuild 指令掃描行事曆資料庫,並檢查行事曆特性 (calprop) 事件和待辦事項 (工作) 是否損毀。如果 rebuild 指令找到不一致性,其會在 cal_svr_base/SUNWics5/cal/sbin/rebuild_db 目錄中產生重建行事曆資料庫 (.db 檔案)。

不帶有 -g 選項的 rebuild 指令重建除群組排程引擎 (GSE) 資料庫之外的所有資料庫。若還要重建 GSE 資料庫,請包含 -g 選項。

若要確定 GSE 資料庫中是否有項目,請在執行 rebuild 指令之前執行 csschedule -v list 指令,然後使 GSE 處理完那些項目。

Procedure重建行事曆資料庫

步驟
  1. 以具有安裝 Calendar Server 的系統之管理權限的使用者身份登入。

  2. 停止 Calendar Server。

  3. 建立行事曆資料庫副本,並將行事曆資料庫置於 /tmp/db 目錄中。

    複製資料庫 (.db) 檔案和記錄 (log.*) 檔。您無需複製任何共用 (__db.*) 檔案。

  4. 變更至 cal_svr_base/SUNWics5/cal/sbin 目錄。

    例如,在 Solaris 作業系統上,輸入以下作為預設目錄:


    cd /opt/SUNWics5/cal/sbin

    備註 –

    如果 sbin 目錄的磁碟空間不足,請在其他目錄中執行 rebuild 指令。


  5. 在行事曆資料庫的副本中執行 rebuild 指令:


    ./csdb rebuild /tmp/db /tmp/

    如果未指定資料庫路徑,rebuild 將使用目前的目錄。/tmp/ 參數為重建資料庫指定目標目錄。

    若還要重建 GSE 資料庫,請包含 -g 選項。

    rebuild 指令可產生大量資訊,因此請考量將所有輸出 (包括 stdoutstderr) 重新導向至一個檔案。


    備註 –

    請始終使用最新的備份複本重建您的行事曆資料庫。

    然而,如果您的資料大量遺失,而您已經定期備份了資料庫並有多個複本可用,請從最新的複本到最舊的複本進行重建。(唯一的缺點是已刪除的行事曆元件將重新出現在重建資料庫中。)

    例如,如果您有三組備份行事曆資料庫檔案,分別在目錄 db_0601db_0615db_0629 中,請按以下序列執行 rebuild 指令:


    ./csdb rebuild db_0629 
    ./csdb rebuild db_0615 
    ./csdb rebuild db_0601

    然後 rebuild 指令會將重建資料庫寫入 cal_svr_base/SUNWics5/cal/sbin/rebuild_db 目錄。


  6. rebuild 完成後,請複查 rebuild.out 檔案中的輸出。

    如果重建成功,rebuild.out 檔案中的最後一行應為:


    Calendar database has been rebuilt
  7. 驗證在先前步驟中的重建成功之後,請從 rebuild_db 目錄將重建資料庫 (.db) 檔案複製到您的生產資料庫。

  8. 如果您有任何已毀壞資料庫的共用 (__db.*) 檔案或記錄 (log.*) 檔,請將其移至其他目錄。

  9. 重新啟動 Calendar Server。

重建輸出範例

以下範例顯示指令及其產生的輸出:


# ./csdb -g rebuild
Building calprops based on component information.
Please be patient, this may take a while...
Scanning events database...
512 events scanned
Scanning todos database...
34 todos scanned
Scanning events database...
512 events scanned
Scanning todos database...
34 todos scanned
Scanning deletelog database...
15 deletelog entries scanned
Scanning gse database...
21 gse entries scanned
Scanning recurring database...
12 recurring entries scanned
Successful components db scan
Calendar database has been rebuilt
Building components based on calprops information.
Please be patient, this may take a while...
Scanning calprops database to uncover events...
25 calendars scanned
Scanning calprops database to uncover todos...
25 calendars scanned
Successful calprops db scan
Calendar database has been rebuilt
            

備註 –

前面的輸出範例顯示事件資料庫和待辦事項資料庫分別被掃描了兩遍。這不是錯誤。掃描第一遍以驗證行事曆特性資料庫中的資訊,然後再掃描一遍以確定行事曆特性資料庫可存取。