利用 backupConfig 指令備份配置之後,請利用 restoreConfig 指令來還原節點的配置。
支援的配置: 本文討論設定檔配置的移轉。
如果要將應用程式移轉至最新的版本,請使用 WebSphere® Application Server Migration Toolkit。
如需相關資訊,請參閱 WASdev 上的 Migration Toolkit。
sptcfg
restoreConfig 指令是利用 backupConfig 指令備份配置之後,用來還原節點配置的簡單公用程式。
依預設,配置還原之前,會先停止節點上的所有伺服器,因此在還原期間,不會進行節點的同步化。
如果配置目錄已存在,還原之前,會將它重新命名。
如需這個指令執行位置的相關資訊,請參閱「使用指令行工具」。
如果您直接變更 app_server_root/installedApps 目錄中的應用程式檔案,一個稱為「熱部署」的程序,但沒有對 app_server_root/config 目錄中的應用程式檔案進行相同的變更,如果您使用 restoreConfig 指令,可能會改寫這些變更。
backupConfig 指令不會儲存檔案許可權或所有權資訊。
當還原檔案時,restoreConfig 指令會利用現行 Umask 和有效使用者 ID (EUID) 來設定許可權和所有權。
如果還原的檔案必須有原始許可權和所有權,請利用 tar 指令(可用於所有 UNIX 或 Linux 系統)來備份及還原配置。
restoreConfig 指令是在 QEJBSVR 使用者設定檔之下執行,以確保 QEJBSVR 使用者設定檔是所建立的目錄和檔案的擁有者。
系統會將已建立目錄的 *PUBLIC 權限設為 *EXCLUDE。
配置目錄中的目錄和檔案上,任何先前存在的專用權限都會遺失。
請利用授與 WebSphere Application Server 權限 (
grtwasaut) Qshell Script 或
CHGAUT CL 指令來設定任何遺失的專用權限。
註: QEJBSVR 使用者設定檔針對位於包含 backup_file 的路徑中的每個目錄,至少必須有 *X 權限,以及該 backup_file 的 *R 權限。
restoreConfig 指令會將目錄結構及其內容的擁有者設為 QEJBSVR 使用者設定檔,但它不會還原專用權限。
如果您在相同的系統或分割區上,搭配應用程式伺服器來使用 IBM® HTTP Server 或 Lotus® Domino® HTTP Server 實例,且應用程式伺服器的
plugin-cfg.xml 檔在
profile_root/config 目錄結構之下,請利用下列指示,將必要的專用權限授與 IBM HTTP Server 或 Lotus Domino HTTP Server 的使用者設定檔。
註: 如果您沒有在還原設定檔的相同系統中使用 IBM HTTP Server 或 Lotus Domino HTTP Server,請勿完成這些步驟。
此外,如果 plugin-cfg.xml 檔不在設定檔的 config 目錄結構之下,請勿完成這些步驟。
- 登入系統。
- 利用 STRQSH 指令來啟動 Qshell 階段作業。
- 導覽至應用程式伺服器的 app_server_root/bin 目錄。
- 利用下列 grtwasaut Qshell 指令,從 config 目錄開始,授與路徑中每個包含 plugin-cfg.xml 檔之目錄的執行 (x) 權限:
grtwasaut -profileName profile_name -object path -dtaaut x -user user
其中 profile_name 是還原的設定檔配置的名稱,path 是相對於設定檔根目錄而有待修改的目錄路徑,user 是 QTMHHTTP(用於 IBM HTTP Server)或 QNOTES(用於 Lotus Domino HTTP Server)。
比方說,如果您使用適用於 iSeries 平台的 IBM HTTP Server,且 myprofile 設定檔的
plugin-cfg.xml 檔位於
profile_root/config/cells/MYSYSTEM_myprofile/nodes/MYSYSTEM_myprofile/servers/myHTTPinstance 目錄中,請執行下列指令:
grtwasaut -profileName myprofile -object config/cells/MYSYSTEM_myprofile/nodes/MYSYSTEM_myprofile/
servers/myHTTPinstance -dtaaut x -user QTMHHTTP
grtwasaut -profileName myprofile -object config/cells/MYSYSTEM_myprofile/nodes/MYSYSTEM_myprofile/
servers -dtaaut x -user QTMHHTTP
grtwasaut -profileName myprofile -object config/cells/MYSYSTEM_myprofile/nodes/MYSYSTEM_myprofile
-dtaaut x -user QTMHHTTP
grtwasaut -profileName myprofile -object config/cells/MYSYSTEM_myprofile/nodes -dtaaut x -user QTMHHTTP
grtwasaut -profileName myprofile -object config/cells/MYSYSTEM_myprofile -dtaaut x -user QTMHHTTP
grtwasaut -profileName myprofile -object config/cells -dtaaut x -user QTMHHTTP
grtwasaut -profileName myprofile -object config -dtaaut x -user QTMHHTTP
如果您使用適用於 iSeries 平台的 IBM HTTP Server,且 myprofile 設定檔的
plugin-cfg.xml 檔位於
profile_root/config/cells 目錄中,請使用下列範例:
grtwasaut -profileName myprofile -object config/cells -dtaaut x -user QTMHHTTP
grtwasaut -profileName myprofile -object config -dtaaut x -user QTMHHTTP
- 請利用下列 grtwasaut 指令來授與 plugin-cfg.xml 檔的讀取、執行 (rx) 權限:
grtwasaut -profileName profile_name -object path/plugin-cfg.xml -dtaaut x -user user
其中 profile_name 是還原的設定檔配置的名稱,path 是相對於設定檔根目錄而有待修改的目錄路徑,user 是 QTMHHTTP(用於 IBM HTTP Server)或 QNOTES(用於 Lotus Domino HTTP Server)。
比方說,如果您使用適用於 iSeries 平台的 IBM HTTP Server,且 myprofile 設定檔的
plugin-cfg.xml 檔位於
profile_root/config/cells/MYSYSTEM_myprofile/nodes/MYSYSTEM_myprofile/servers/myHTTPinstance 目錄中,請輸入下列指令:
grtwasaut -profileName myprofile -object config/cells/MYSYSTEM_myprofile/nodes/MYSYSTEM_myprofile
/servers/myHTTPinstance/plugin-cfg.xml -dtaaut rx -user QTMHHTTP
如果您使用適用於 iSeries 平台的 IBM HTTP Server,且 myprofile 設定檔的
plugin-cfg.xml 檔位於
profile_root/config/cells 目錄中,請使用下列範例:
grtwasaut -profileName myprofile -object config/cells/plugin-cfg.xml -dtaaut rx -user QTMHHTTP
語法
指令語法如下:
restoreConfig backup_file [options]
其中
backup_file 指定要還原的檔案。
如果您沒有指定,指令就不會執行。
參數
下列選項可用於 restoreConfig 指令:
- -help
- 列印用法陳述式
- -location directory_name
- 指定備份檔的還原目錄
- 位置預設為 profile_root/config 目錄。
- -logfile file_name
- 指定追蹤資訊寫入其中的日誌檔位置
依預設,日誌檔名稱為 restoreConfig.log,建立在您的 logs 目錄中。
- -nostop
- 告訴 restoreConfig 指令在還原配置之前,不要停止伺服器
- -password password
- 在伺服器啟用安全的情況下,指定密碼來進行鑑別
- -profileName profile_name
- 在多重設定檔安裝架構中,定義「應用程式伺服器」程序的設定檔
如果要在單一設定檔環境中執行,-profileName 選項不是必要選項。
這個選項的預設值是預設設定檔。
- -quiet
- 暫停 restoreConfig 指令以標準模式來列印的進度資訊
- -replacelog
- 取代日誌檔,而不是附加於現行日誌
- -trace
- 在日誌檔中產生追蹤資訊,用來進行除錯
- -username user_name
- 在伺服器啟用安全的情況下,指定使用者名稱來進行鑑別;與 -user 選項作用相同
- -user user_name
- 在伺服器啟用安全的情況下,指定使用者名稱來進行鑑別;與 -username 選項作用相同
- -?
- 列印用法陳述式
用法
下列範例示範正確的語法:
restoreConfig WebSphereConfig_2006-04-22.zip
下列範例會將給定的檔案還原到 /tmp 目錄中,開始還原之前,不會停止任何伺服器:
restoreConfig WebSphereConfig_2006-04-22.zip -location /tmp -nostop
下列範例會將 /home/mydir/myprofileBackup.zip 中所儲存的配置還原到 myprofile 設定檔的配置中:
restoreConfig /home/mydir/myprofileBackup.zip -profileName myprofile
請注意,如果您將配置還原到不是執行 backupConfig 指令時所備份的目錄中,您可能需要手動更新配置目錄中的一些路徑。