1、介绍
clone有不同的用途:
1)可以做个生产系统的副本来做补丁测试。
2)创建一个stageing area(可理解为缓冲区准备区)来降低打补丁的停机时间
3)刷新测试系统(把最新的生产系统拷贝给测试系统)
4)把当前存在的系统拷贝到一个不同的机器或者平台上(一般常用的是我们给一个企业做好系统,clone一个做测试,一个开发)
2、Rapid Cline Operation
通过运行Rapid Clone tool,快速克隆不改变原来的系统,运行:adpreclone.pl脚本收集数据库的信息,然后创建通用模本文件(这个模版文件时从已经存在的指定源的硬编码的值,然后这些模板文件被存放到<RDBMS_ORACLE_HOME>/appsutil/template)
运行完adpreclone.pl 之后,从源系统拷贝相关的文件和目录到目标的系统,然后运行adcfgclone.pl脚本来配置。很多的参数的值会用来创建context文件,context文件是用来配置目标系统的,那么。。这些参数的值是怎么来的呢?一些是当前系统自动计算的,还有一些是adcfgclone.pl 提示让你指定的(比如会提示你指定一个端口池,用它来完成预定义的服务端口,一共有100个端口池,你选pool
port3,数据库的1521端口就会被1524代替)。
3、快速克隆和Oracle Universal Installer
oracle universal installer的全局资料库(global inventory)是简单的指针的列表,分别指向每个本地资料库(local inventory),每个oracle home 都有一个本地资料库,位置在<ORACLE_HOME>/invertory。这里面包含了所有的oracle home的补丁(patch)信息。
which contains all the patch information for the ORACLE_HOME in question
快速克隆首先确认原系统的local inventory是xml格式的,如果是二进制格式的,快速克隆会转换成xml格式。本地资料库(就是在oracle home里面等待被克隆的那个)被拷贝到目标系统,然后用新的值重新配置。然后快速克隆把配置好的本地资料库添加到目标系统的全局资料库里面。如果目标系统没有全局资料库,快速克隆会在添加的时候顺便自己创建一个全局资料库。。
4、总结
In essence,快速克隆做如下事情:
数据库层:
创建数据库的context file。
在Global Inventory里注册ORACLE_HOME
Relink ORACLE_HOME
配置ORACLE_HOME
重新创建数据库控制文件
启动数据库
配置数据库
启动数据库Listener
应用层:
创建Applications context file
在Global Inventory里注册OracleAS 10.1.2和OracleAS10.1.3的ORACLE_HOME
Relink OracleAS ORACLE_HOMEs
配置OracleAS ORACLE_HOMEs
配置APPL_TOP
创建INST_TOP
启动应用层的server processes
For further details of Rapid Clone capabilities and operation, see My Oracle Support Knowledge
Document 406982.1, Cloning Oracle Applications Release 12 with Rapid Clone.
For details of cloning options in general , see My Oracle Support Knowledge
Document 783188.1, Certified RAC Scenarios for E-Business Suite Cloning.
What
happening when executing adpreclone.pl in DB and Apps Tier?
adpreclone.pl
- This is the preparation phase, will collects information about the source system, creates a cloning stage area, and generates templates and drivers. All of these are to reconfigure the instance on a Target machine.
Preclone will do the following:
Convert Symbolic links(转换符号链接)
All symbolic links pointing to a static path will be converted into relative paths
All symbolic links pointing to a static path will be converted into relative paths
所有指向静态路径的符号链接将会被转换到相关路径
Create templates(创建模板)
Any files under the $ORACLE_HOME that contain system specific information, will be replicated and converted into a template. These templates are placed into the $ORACLE_HOME/appsutil/template directory.
Create driver(s)(创建驱动文件)
A driver file, relating to these new templates is created called instconf.drv. This contains a list of all the templates and their locations, and the destination
configuration files that these templates will create.
This driver file is called instconf.drv and is placed into directory
$ORACLE_HOME/appsutil/driver
Create Stage area
A clone stage is created containing the requiredjava code and scripts to reconfigure the instace on the Target machine
Rapid Clone stage area:
dbTier : $ORACLE_HOME/appsutil/clone
appsTier(s) - $COMMON_TOP/clone
The stage area(s) consist of the following directories:-
jre used to run the java code on the Target machine.
bin contains the RapidClone scripts that can be run on the Target machine:-
adclone.pl is the main cloning script
adcfgclone.pl is used to configure the Target system, this calls adclone.pl
adclonectx.pl is used to clone a Source XML file manually
adaddnode.pl is used to add a new node to the Patch History tables
adchkutl.sh checks for existence of require O/S utils, cc, make, ar and ld
jlib contains all the Rapid Clone java code, jdbc libraries etc
context contains templates used for a Target XML file
data (Database Tier only) contains the driver file, and templates used to generate the control file SQL script
adcrdb.zip contains the template and list of datafiles on the Source
addbhomsrc.xml contains information on the datafile mount points of the Source
appl (Applications Tier only) this is used when merging appltops, i.e Multi-node to Single node cloning
Executing adpreclone.pl will create a log file:-
Rapid Clone:
dbTier : $ORACLE_HOME/appsutil/log/$CONTEXT_NAME/StageDBTier_xxxxxx.log
appsTier : $APPL_TOP/admin/$CONTEXT_NAME/log/StageAppsTier_xxxxxx.log
Once this adpreclone.pl step has been completed successfully, all the java .class files under the following directories should be identical to those under $JAVA_TOP/oracle :
RDBMS $ORACLE_HOME/appsutil/java/oracle
RDBMS $ORACLE_HOME/appsutil/clone/jlib/java/oracle
$COMMON_TOP/clone/jlib/java/oracle
在clone新系统的时候,可以使用生产环境的数据库rman备份+当时应用层apps目录的tar包 然后再从另一个系统tar一个oracle数据库层的代码过来。
注意:
1、在taroracle数据库层代码时需要执行preclone。
2、生产apps层tar之前也需要执行preclone。
3、rman备份为了和应用层保持时间轴一致,需满足:rman备份后应用层没有打过补丁,没有进行客户化程序发布。
因为这两种操作都会对数据库的数据进行改变,导致应用层和数据库层的不一致。