Oracle 10g,11g中的資料庫複製安裝
有時候在很多工作環境中,如果彼此幾個機器的配置相似,我們就可以不用一遍又一遍的安裝資料庫軟體了,我們可以為了更快的完成安裝工作,在靜默安裝,圖形安裝的選擇之外,還有複製安裝。不過在Oracle 10g,11g的版本中還是存在一定的差別。雖然方法有差別,但是思路都是一致的。
我們可以從源環境中直接把ORACLE_HOME給打個包,在目標環境解壓即可。這個時候儘管你去嘗試sqlplus,exp這些工具也能用,但是還是存在很大的風險,畢竟別把它當成綠色版的。出了問題誰都兜不住。
11g的環境中,可以使用下面的方式來安裝。
到達$ORACLE_HOME/clone目錄下,運行下面的指令碼即可。輸入的參數為ORACLE_HOME,還有ORACLE_HOME的名字,這個可以自己定義。
$ perl clone.pl ORACLE_BASE=/U01/app/oracle ORACLE_HOME=/U01/app/oracle/product/11.2.0.2/db_1 ORACLE_HOME_NAME=OraDb10g_home1
./runInstaller -clone -waitForCompletion "ORACLE_BASE=/U01/app/oracle" "ORACLE_HOME=/U01/app/oracle/product/11.2.0.2/db_1" "ORACLE_HOME_NAME=OraDb10g_home1" -silent -noConfig -nowait
Starting Oracle Universal Installer...
Checking swap space: must be greater than 500 MB. Actual 16383 MB Passed
Preparing to launch Oracle Universal Installer from /tmp/OraInstall2015-07-24_11-19-08AM. Please wait ...Oracle Universal Installer, Version 11.2.0.3.0 Production
Copyright (C) 1999, 2011, Oracle. All rights reserved.
You can find the log of this install session at:
/home/oracle/oraInventory/logs/cloneActions2015-07-24_11-19-08AM.log
.................................................................................................... 100% Done.
Installation in progress (Friday, July 24, 2015 11:19:16 AM CST)
............................................................................... 79% Done.
Install successful
Linking in progress (Friday, July 24, 2015 11:19:23 AM CST)
Link successful
Setup in progress (Friday, July 24, 2015 11:20:00 AM CST)
Setup successful
End of install phases.(Friday, July 24, 2015 11:20:23 AM CST)
然後根據提示使用root運行兩個指令碼即可。
10g的資料庫軟體就得換個方式,
$ORACLE_HOME/oui/bin/runInstaller -clone -silent -ignorePreReq ORACLE_HOME="$ORACLE_HOME" ORACLE_HOME_NAME="OraDb10g_home1"
Starting Oracle Universal Installer...
.................................................................................................... 100% Done.
Installation in progress (Friday, July 24, 2015 2:33:50 PM CST)
.......................................................................... 74% Done.
Install successful
Linking in progress (Friday, July 24, 2015 2:34:03 PM CST)
Link successful
Setup in progress (Friday, July 24, 2015 2:34:03 PM CST)
Setup successful
End of install phases.(Friday, July 24, 2015 2:34:06 PM CST)
然後根據提示運行一個指令碼。
如果拿11g的ORACLE_HOME採用10g的思路,報出的錯誤都讓人摸不著頭腦,因為ORACLE_BASE早就指定了。
$ORACLE_HOME/oui/bin/runInstaller -clone -silent -ignorePreReq ORACLE_HOME="$ORACLE_HOME" ORACLE_HOME_NAME="OraDb10g_home1"
Checking swap space: must be greater than 500 MB. Actual 16383 MB Passed
Preparing to launch Oracle Universal Installer from /tmp/OraInstall2015-07-24_10-34-10AM. Please wait ...[oracle@smbionline ~]$ Oracle Universal Installer, Version 11.2.0.3.0 Production
Copyright (C) 1999, 2011, Oracle. All rights reserved.
You can find the log of this install session at:
/U01/app/oraInventory/logs/cloneActions2015-07-24_10-34-10AM.log
Values for the following variables could not be obtained from the command line or response file(s):
ORACLE_BASE
Cloning cannot continue.
不過對於這種複製方式還是需要簡單驗證一下,如果出現了意料之外的問題就是弄巧成拙了。