Cloning
简介:
10g以后 oracle支持cloning,克隆是复制现有的安装到不同的服务器或位置的过程,克隆类似于OUI “克隆模式”操作,会复制Oracle home的所有文件到目标端。
源服务器和目标服务器应具有相同的配置和程序包安装。
克隆不能跨平台。
克隆可以用OPatch或者OUI来删除patch。
用处:
1. 创建一个具有很多patch的环境。
2. 创建一个开发或测试环境。
3. 创建Oracle home在多个主机。
4. 快速部署an instance and the applications。
方式:
1.Clone using “perl clone.pl”In this method
you need to install DB Console so that the required Perl files will be
installed in $ORACLE_HOME/clone/bin.
2.Clone using “runInstaller”In this method
you need to install DB Console
3.Clone using “runInstaller in silent”
modeIn this method you will be using same “runInstaller” in non-interactive
mode
步骤:
1. 源端复制Oracle installation到目标端。
2. 运行OUI。
Step 1: Copy source Oracle Installation
在做copy之前,关闭数据库,监听,代理,etc,只复制HOME的话,不用管实例。
根据目录以及实例名的不同,排除敏感目录以及文件
Database related directories
o $ORACLE_HOME/dbs
(
init.ora,spfile.ora,orapwd)
o $ORACLE_HOME/admin
(trace,
alert, core files…etc)
o $ORACLE_BASE/diag
(trace,
alert, core, incident files…etc)
o $ORACLE_HOME/oc4j/j2ee/OC4J_DBConsole__ (Enterprise manager/db
console)
o $ORACLE_HOME/hs/admin/ (heterogeneous
files)
$ cat exclude_list.txt
./network/admin/listener.ora
./network/admin/sqlnet.ora
./network/admin/tnsnames.ora
./bin/nmo
./bin/nmb
./bin/nmhs
源端解压:
$ cd $ORACLE_HOME
$ tar -zcvf ~/Oracle_Home11g_clone.tar.gz . -X ~/exclude_list.txt > ~/
Oracle_Home11g_clone.log
目标端要满足oracle的要求,用户,目录,权限等。
传到目标端后,进行解压
$ cd $ORACLE_HOME
$ tar -xvf Oracle_Home11g_clone.tar.gz
Step 2: Clone Oracle Installation
确保目标端ORACLE_HOME和ORACLE_BASE环境变量设置,/etc/orainst.loc (for AIX,Linux), /var/opt/oracle/oraInst.loc (for
Solaris,HP-UX)文件已经存在。
例子:
$ cat /etc/oraInst.loc
inventory_loc=/home/oracle/oraInventory
inst_group=dba
如果orainst.loc文件存在于不同的位置,可以创建一个软链接或编辑$ORACLE_HOME/clone/config/cs.properties file,并添加“–invPtrLoc
/oraInst.loc”参数到”clone_command_line”.
If you have copied oracle Inventory, then
you will receive a message that the inventory already exists when you run
“clone.pl” or “./runInstaller” to clone the Oracle installation. So before you
run cloning commands makes sure to detach the Oracle home.
See below See the below example to detach the
oracle inventory:
$
cd /home/oracle/product/11.2.0/dbhome_1/oui/bin
$./runInstaller -detachHome ORACLE_HOME=/home/oracle/product/10.2.0/db_1
Starting Oracle Universal Installer...
No pre-requisite checks found in
oraparam.ini, no system pre-requisite checks will be executed.
The inventory pointer is located at /etc/oraInst.loc
The inventory is located at /home/oracle/oraInventory
‘DetachHome’ was successful.
1. Clone using “perl clone.pl”
$ cd $ORACLE_HOME/clone/bin
$ perl clone.pl ORACLE_HOME="" ORACLE_HOME_NAME=""
Where
ORACLE_HOME: specifies the new Oracle home directory location
ORACLE_HOME_NAME: specifies a unique name for the Oracle Home for the server
See the below example to clone the installation using “perl clone.pl”.
$ perl clone.pl ORACLE_HOME="/home/oracle/product/11.2.0.4/dbhome_1"
ORACLE_HOME_NAME=" Oracle_home11204" ORACLE_BASE="/home/oracle" OSDBA_GROUP=dba
OSPER_GROUP=dba
OSOPER_GROUP=dba ./runInstaller -clone -
waitForCompletion "ORACLE_HOME=/home/oracle/product/11.2.0.4/dbhome_1"
"ORACLE_HOME_NAME=Oracle_home11204" "ORACLE_BASE=/home/oracle" "oracle_install_OSDBA=dba" "oracle_install_
OSOPER=dba" -silent -noConfig -nowait Starting Oracle Universal Installer... Checking swap space: must be greater than 500 MB. Actual 3999 MB Passed Preparing to launch Oracle Universal Installer from /tmp/OraInstall2014-07-13_05
-34-06PM. Please wait ...Oracle Universal Installer, Version 11.2.0.4.0 Production Copyright (C) 1999, 2013, Oracle. All rights reserved. You can find the log of this install session at: /home/oracle/oraInventory/logs/cloneActions2014-07-13_05-34-06PM.log .................................................................100% Done. Installation in progress (Sunday, July 13, 2014 5:34:16 PM PDT) ........................................................... 84% Done. Install successful Linking in progress (Sunday, July 13, 2014 5:34:27 PM PDT) Link successful Setup in progress (Sunday, July 13, 2014 5:35:00 PM PDT) Setup successful End of install phases.(Sunday, July 13, 2014 5:35:22 PM PDT) WARNING: The following configuration scripts need to be executed as the "root" user. /home/oracle/product/11.2.0.4/dbhome_1/root.sh To execute the configuration scripts: 1. Open a terminal window 2. Log in as "root" 3. Run the scripts The cloning of Oracle_home11204 was successful. Please check '/home/oracle/oraInventory/logs/cloneActions2014-07-13_05-34-06PM
.log' for more details.
2. Clone using “runInstaller”
$ORACLE_HOME/oui/bin/runInstaller -clone ORACLE_HOME=""
ORACLE_HOME_NAME=""
Where
-clone: specifies that the home is a clone of another location
ORACLE_BASE: specifies the base directory location for Oracle products
ORACLE_HOME: specifies the new Oracle home directory location
ORACLE_HOME_NAME: specifies a unique name for the Oracle Home for the server
See the below example to clone the installation using “runInstaller”.
$ORACLE_HOME/oui/bin/runInstaller -clone ORACLE_HOME_NAME=" Oracle_home11204"
ORACLE_BASE="/home/oracle" OSDBA_GROUP=dba OSPER_GROUP=dba Starting Oracle Universal Installer... Checking swap space: must be greater than 500 MB. Actual 3999 MB Passed Preparing to launch Oracle Universal Installer from /tmp/OraInstall2014-07-13
_05-18-27PM. Please wait ...Oracle Universal Installer, Version 11.2.0.4.0 Production Copyright (C) 1999, 2008, Oracle. All rights reserved. You can find a log of this install session at: /home/oracle/oraInventory/logs/cloneActions2014-07-13_05-18-27PM.log .................................................................. 100% Done. Installation in progress (Sunday, July 13, 2014 5:18:38 PM PDT) .................................................. 74% Done. Install successful Linking in progress (Sunday, July 13, 2014 5:18:47 PM PDT) Link successful Setup in progress (Sunday, July 13, 2014 5:20:20 PM PDT) Setup successful End of install phases.(Sunday, July 13, 2014 5:20:22 PM PDT) WARNING: The following configuration scripts need to be executed as the "root" user. #!/bin/sh #Root script to run /home/oracle/product/10.2.0/db_1/root.sh To execute the configuration scripts: 1. Open a terminal window 2. Log in as "root" 3. Run the scripts The cloning of home10g was successful. Please check '/home/oracle/oraInventory/logs/cloneActions2014-07-13_05
-18-27PM.log' for more details.
3. Clone using “runInstaller in silent” mode
See the below example to clone the installation using “runInstaller in silent” mode.
$ORACLE_HOME/oui/bin/runInstaller -clone -silent ORACLE_HOME_NAME=" Oracle_home11204"
ORACLE_BASE="/home/oracle" OSDBA_GROUP=dba OSPER_GROUP=dba Starting Oracle Universal Installer... Checking swap space: must be greater than 500 MB. Actual 3999 MB Passed Preparing to launch Oracle Universal Installer from /tmp/OraInstall2014-07-13
_05-29-22PM. Please wait ...Oracle Universal Installer, Version 11.2.0.1.0 Production Copyright (C) 1999, 2009, Oracle. All rights reserved. You can find the log of this install session at: /home/oracle/oraInventory/logs/cloneActions2014-07-13_05-29-22PM.log .................................................................... 100% Done. Installation in progress (Sunday, July 13, 2014 5:29:30 PM PDT) .................................................. 77% Done. Install successful Linking in progress (Sunday, July 13, 2014 5:29:39 PM PDT) Link successful Setup in progress (Sunday, July 13, 2014 5:30:10 PM PDT) Setup successful End of install phases.(Sunday, July 13, 2014 5:30:43 PM PDT) WARNING: The following configuration scripts need to be executed as the "root" user. /home/oracle/product/11.2.0.4/dbhome_1/root.sh To execute the configuration scripts: 1. Open a terminal window 2. Log in as "root" 3. Run the scripts The cloning of Oracle_home11204 was successful. Please check '/home/oracle/oraInventory/logs/cloneActions2014-07-13_05-29-22
PM.log' for more details.
To complete the clone you should log in as “root” and run $ORACLE_HOME/root.sh.
# /home/oracle/product/11.2.0.4/dbhome_1/root.sh
Performing root user operation for Oracle 11g
The following environment variables are set as:
ORACLE_OWNER= oracle
ORACLE_HOME= /home/oracle/product/11.2.0.4/dbhome_1
Copying dbhome to /usr/local/bin ...
Copying oraenv to /usr/local/bin ...
Copying coraenv to /usr/local/bin ...
Entries will be added to the /etc/oratab file as needed by
Database Configuration Assistant when a database is created
Finished running generic part of root script.
Now product-specific root actions will be performed.
Finished product-specific root actions.
Finished product-specific root actions.
参考大神博客:http://allthingsoracle.com/should-you-install-or-clone-oracle-home/
来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/30491527/viewspace-1982681/
,如需转载,请注明出处,否则将追究法律责任。