欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  数据库

Oracle 10g,11g中的数据库克隆安装

程序员文章站 2022-06-16 08:34:00
...

有时候在很多工作环境中,如果彼此几个机器的配置相似,我们就可以不用一遍又一遍的安装数据库软件了,我们可以为了更快的完成安

有时候在很多工作环境中,如果彼此几个机器的配置相似,我们就可以不用一遍又一遍的安装数据库软件了,我们可以为了更快的完成安装工作,在静默安装,图形安装的选择之外,还有克隆安装。不过在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.
不过对于这种克隆方式还是需要简单验证一下,如果出现了意料之外的问题就是弄巧成拙了。