目的
本文详细描述了将EBS生产环境PROD克隆到SIT测试环境的全步骤。
EBS版本 | 操作系统 | 原系统HOST | 原系统IP | 目标系统HOST | 目标系统IP |
---|---|---|---|---|---|
R12.2.7 | Oracle Linux 7.4 | myebsprod | 192.168.15.10 | myebssit | 192.168.20.10 |
另外需要说明的是,准备的目标系统,需要注意规划的应用所在目录挂载时建议小于1T,避免应用克隆时出现问题,具体原因可见文章最后的问题解决部分。
克隆前准备
克隆前,需要对目标服务器进行以下准备工作:
(1)修改 host
[root@localhost ~]# vi /etc/hosts
添加内容
192.168.20.18 myebssit.mylinux.com myebssit
(2)修改 hostname
[root@localhost ~]# hostnamectl set-hostname myebssit
(3)创建用户组、用户
[root@ myebssit ~]# groupadd dba
[root@ myebssit ~]# useradd -g dba -d /home/orasit -m orasit
[root@ myebssit ~]# useradd -g dba -d /home/applsit -m applsit
设置密码,可暂时设置为用户名
[root@myebssit ~]# echo "orasit" | passwd orasit --stdin
[root@myebssit ~]# echo "applsit" | passwd applsit --stdin
(4)创建目录
先在源端判断 app 运行的实例,执行 echo $RUN_BASE
,根据结果是 fs1 还是 fs2 来创建对应文件夹
mkdir -p /u01/sit
mkdir -p /u01/sit/db
mkdir -p /u01/sit/temp
mkdir -p /u01/sit/oraInventory
mkdir -p /u01/sit/app/fs2(需确认fs1还是fs2)
chmod 777 /u01/sit/temp
chmod 777 /u01/sit/oraInventory
chown -R orasit:dba /u01/sit/db
chown -R orasit:dba /u01/sit/oraInventory
chown -R orasit:dba /u01/sit/temp
chown -R applsit:dba /u01/sit/app
(5)安装依赖包
下载 repo 文件
[root@myebssit ~]# cd /etc/yum.repos.d
[root@myebssit yum.repos.d]# wget http://public-yum.oracle.com/public-yum-ol7.repo
public-yum-ol7.repo
的内容替换为:
[ol7_latest]
name=Oracle Linux $releasever Latest ($basearch)
baseurl=http://yum.oracle.com/repo/OracleLinux/OL7/latest/$basearch/
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-oracle
gpgcheck=0
enabled=1
[ol7_u0_base]
name=Oracle Linux $releasever GA installation media copy ($basearch)
baseurl=http://yum.oracle.com/repo/OracleLinux/OL7/0/base/$basearch/
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-oracle
gpgcheck=1
enabled=0
[ol7_u1_base]
name=Oracle Linux $releasever Update 1 installation media copy ($basearch)
baseurl=http://yum.oracle.com/repo/OracleLinux/OL7/1/base/$basearch/
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-oracle
gpgcheck=1
enabled=0
[ol7_u2_base]
name=Oracle Linux $releasever Update 2 installation media copy ($basearch)
baseurl=http://yum.oracle.com/repo/OracleLinux/OL7/2/base/$basearch/
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-oracle
gpgcheck=1
enabled=0
[ol7_u3_base]
name=Oracle Linux $releasever Update 3 installation media copy ($basearch)
baseurl=http://yum.oracle.com/repo/OracleLinux/OL7/3/base/$basearch/
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-oracle
gpgcheck=1
enabled=0
[ol7_u4_base]
name=Oracle Linux $releasever Update 4 installation media copy ($basearch)
baseurl=http://yum.oracle.com/repo/OracleLinux/OL7/4/base/$basearch/
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-oracle
gpgcheck=0
enabled=1
[ol7_UEKR4]
name=Latest Unbreakable Enterprise Kernel Release 4 for Oracle Linux $releasever ($basearch)
baseurl=http://yum.oracle.com/repo/OracleLinux/OL7/UEKR4/$basearch/
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-oracle
gpgcheck=0
enabled=1
[ol7_UEKR3]
name=Latest Unbreakable Enterprise Kernel Release 3 for Oracle Linux $releasever ($basearch)
baseurl=http://yum.oracle.com/repo/OracleLinux/OL7/UEKR3/$basearch/
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-oracle
gpgcheck=1
enabled=0
[ol7_optional_latest]
name=Oracle Linux $releasever Optional Latest ($basearch)
baseurl=http://yum.oracle.com/repo/OracleLinux/OL7/optional/latest/$basearch/
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-oracle
gpgcheck=0
enabled=1
[ol7_addons]
name=Oracle Linux $releasever Add ons ($basearch)
baseurl=http://yum.oracle.com/repo/OracleLinux/OL7/addons/$basearch/
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-oracle
gpgcheck=0
enabled=1
[ol7_UEKR3_OFED20]
name=OFED supporting tool packages for Unbreakable Enterprise Kernel on Oracle Linux 7 ($basearch)
baseurl=http://yum.oracle.com/repo/OracleLinux/OL7/UEKR3_OFED20/$basearch/
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-oracle
gpgcheck=1
enabled=0
priority=20
[ol7_UEKR4_OFED]
name=OFED supporting tool packages for Unbreakable Enterprise Kernel Release 4 on Oracle Linux 7 ($basearch)
baseurl=http://yum.oracle.com/repo/OracleLinux/OL7/UEKR4/OFED/$basearch/
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-oracle
gpgcheck=1
enabled=0
priority=20
[ol7_MySQL57]
name=MySQL 5.7 for Oracle Linux 7 ($basearch)
baseurl=http://yum.oracle.com/repo/OracleLinux/OL7/MySQL57_community/$basearch/
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-oracle
gpgcheck=1
enabled=0
[ol7_MySQL56]
name=MySQL 5.6 for Oracle Linux 7 ($basearch)
baseurl=http://yum.oracle.com/repo/OracleLinux/OL7/MySQL56/$basearch/
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-oracle
gpgcheck=1
enabled=0
[ol7_MySQL55]
name=MySQL 5.5 for Oracle Linux 7 ($basearch)
baseurl=http://yum.oracle.com/repo/OracleLinux/OL7/MySQL55/$basearch/
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-oracle
gpgcheck=1
enabled=0
[ol7_openstack30]
name=OpenStack 3.0 packages for Oracle Linux 7 (x86_64)
baseurl=http://yum.oracle.com/repo/OracleLinux/OL7/openstack30/x86_64/
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-oracle
gpgcheck=1
enabled=0
[ol7_openstack_extras]
name=OpenStack 3.0 Extra packages for Oracle Linux 7 (x86_64)
baseurl=http://yum.oracle.com/repo/OracleLinux/OL7/openstack_extras/x86_64/
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-oracle
gpgcheck=1
enabled=0
[ol7_openstack21]
name=OpenStack 2.1 packages for Oracle Linux 7 (x86_64)
baseurl=http://yum.oracle.com/repo/OracleLinux/OL7/openstack21/x86_64/
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-oracle
gpgcheck=1
priority=20
enabled=0
[ol7_openstack20]
name=OpenStack 2.0 packages for Oracle Linux 7 (x86_64)
baseurl=http://yum.oracle.com/repo/OracleLinux/OL7/openstack20/x86_64/
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-oracle
gpgcheck=1
priority=20
enabled=0
[ol7_ceph]
name=Ceph Storage for Oracle Linux Release 2.0 - Oracle Linux 7.2 or later ($basearch)
baseurl=http://yum.oracle.com/repo/OracleLinux/OL7/ceph/$basearch/
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-oracle
gpgcheck=1
enabled=0
[ol7_ceph10]
name=Ceph Storage for Oracle Linux Release 1.0 - Oracle Linux 7.1 or later ($basearch)
baseurl=http://yum.oracle.com/repo/OracleLinux/OL7/ceph10/$basearch/
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-oracle
gpgcheck=1
enabled=0
[ol7_software_collections]
name=Software Collection Library release 2.3 packages for Oracle Linux 7 (x86_64)
baseurl=http://yum.oracle.com/repo/OracleLinux/OL7/SoftwareCollections/x86_64/
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-oracle
gpgcheck=1
enabled=0
[ol7_spacewalk24_server]
name=Spacewalk Server 2.4 for Oracle Linux 7 ($basearch)
baseurl=http://yum.oracle.com/repo/OracleLinux/OL7/spacewalk24/server/$basearch/
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-oracle
gpgcheck=1
enabled=0
[ol7_spacewalk24_client]
name=Spacewalk Client 2.4 for Oracle Linux 7 ($basearch)
baseurl=http://yum.oracle.com/repo/OracleLinux/OL7/spacewalk24/client/$basearch/
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-oracle
gpgcheck=1
enabled=0
[ol7_spacewalk26_server]
name=Spacewalk Server 2.6 for Oracle Linux 7 ($basearch)
baseurl=http://yum.oracle.com/repo/OracleLinux/OL7/spacewalk26/server/$basearch/
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-oracle
gpgcheck=1
enabled=0
[ol7_spacewalk26_client]
name=Spacewalk Client 2.6 for Oracle Linux 7 ($basearch)
baseurl=http://yum.oracle.com/repo/OracleLinux/OL7/spacewalk26/client/$basearch/
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-oracle
gpgcheck=1
enabled=0
[ol7_MODRHCK]
name=Latest RHCK with fixes from Oracle for Oracle Linux $releasever ($basearch)
baseurl=http://yum.oracle.com/repo/OracleLinux/OL7/MODRHCK/$basearch/
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-oracle
gpgcheck=1
priority=20
enabled=0
开始安装
yum install oracle-ebs-server-R12-preinstall -y
再单独安装下 openmotif21
,否则打开form会提示错误
yum install -y openmotif21
安装后执行
ldconfig –v
(6)修改内核设置
在 /etc/sysctl.conf中添加内容,在安装 oracle-ebs-server-R12-preinstall 后,会自动进行该配置,无需修改
# oracle-ebs-server-R12-preinstall setting for fs.file-max is 6815744
fs.file-max = 6815744
# oracle-ebs-server-R12-preinstall setting for kernel.sem is '256 32000 100 142'
kernel.sem = 256 32000 100 142
# oracle-ebs-server-R12-preinstall setting for kernel.shmmni is 4096
kernel.shmmni = 4096
# oracle-ebs-server-R12-preinstall setting for kernel.shmall is 1073741824 on x86_64
# oracle-ebs-server-R12-preinstall setting for kernel.shmall is 2097152 on i386
kernel.shmall = 1073741824
# oracle-ebs-server-R12-preinstall setting for kernel.shmmax is 4398046511104 on x86_64
# oracle-ebs-server-R12-preinstall setting for kernel.shmmax is 4294967295 on i386
kernel.shmmax = 4398046511104
# oracle-ebs-server-R12-preinstall setting for kernel.msgmni is 2878
kernel.msgmni = 2878
# oracle-ebs-server-R12-preinstall setting for net.core.rmem_default is 262144
net.core.rmem_default = 262144
# oracle-ebs-server-R12-preinstall setting for net.core.rmem_max is 4194304
net.core.rmem_max = 4194304
# oracle-ebs-server-R12-preinstall setting for net.core.wmem_default is 262144
net.core.wmem_default = 262144
# oracle-ebs-server-R12-preinstall setting for net.core.wmem_max is 1048576
net.core.wmem_max = 1048576
# oracle-ebs-server-R12-preinstall setting for fs.aio-max-nr is 1048576
fs.aio-max-nr = 1048576
# oracle-ebs-server-R12-preinstall setting for net.ipv4.ip_local_port_range is 9000 65500
net.ipv4.ip_local_port_range = 9000 65500
如果需要修改,那修改完成后运行命令,使配置生效
/sbin/sysctl -p
(7)修改DNS解析参数
在 /etc/resolv.conf
文件中添加内容,在安装 oracle-ebs-server-R12-preinstall 后,会自动进行该配置,重启后无效:
#oracle-ebs-server-R12-preinstall setting for attempts is 5
options attempts:5
#oracle-ebs-server-R12-preinstall setting for timeout is 15
options timeout:15
(8)修改资源限制
修改 /etc/security/limits.conf
文件,添加下面内容
@dba hard nofile 131072
@dba soft nofile 131072
@dba hard nproc 131072
@dba soft nproc 131072
@dba hard stack 16384
@dba soft stack 10240
(9)关闭防火墙和SELINUX
##关闭防火墙
systemctl stop firewalld
##关闭开机启动
systemctl disable firewalld
##查看防火墙状态
systemctl status firewalld
##修改/etc/selinux/config文件,其中的SELINUX=enforcing 修改为SELINUX=disabled
sed -i 's/SELINUX=enforcing/SELINUX=disabled/g' /etc/selinux/config
##即时关闭selinux
setenforce 0
##获取selinux状态
getenforce
(10)编辑 /etc/oraInst.loc
,若不存在则新添文件,修改内容为:
inventory_loc=/u01/sit/oraInventory
inst_group=dba
db 预克隆
在源端的 oracle 用户下操作
[oraprod@myebsprod] cd $ORACLE_HOME/appsutil/scripts/$CONTEXT_NAME
[oraprod@myebsprod] perl adpreclone.pl dbTier
根据提示,输入 apps 密码,等执行完后,交互参考:
[oraprod@myebsprod ~]$ cd $ORACLE_HOME/appsutil/scripts/$CONTEXT_NAME
[oraprod@myebsprod PROD_myebsprod]$ perl adpreclone.pl dbTier
Copyright (c) 2011, 2014 Oracle Corporation
Redwood Shores, California, USA
Oracle E-Business Suite Rapid Clone
Version 12.2
adpreclone Version 120.31.12020000.22
Enter the APPS User Password: --> 输入APPS密码
Verifying if Database Patch checker (ETCC) exists in /data/prod/db/12.1.0/appsutil/etcc
Running:
perl /data/prod/db/12.1.0/appsutil/bin/adclone.pl java=/data/prod/db/12.1.0/appsutil/jre mode=stage stage=/data/prod/db/12.1.0/appsutil/clone component=dbTier method=CUSTOM dbctx=/data/prod/db/12.1. 0/appsutil/PROD_myebsprod.xml showProgress
Beginning database tier Stage - Wed Apr 20 16:11:02 2022
/data/prod/db/12.1.0/appsutil/jre/bin/java -Xmx600M -DCONTEXT_VALIDATED=false -Doracle.installer.ou i_loc=/data/prod/db/12.1.0/oui -classpath /data/prod/db/12.1.0/lib/xmlparserv2.jar:/data/prod/db/12 .1.0/jdbc/lib/ojdbc6.jar:/data/prod/db/12.1.0/appsutil/java:/data/prod/db/12.1.0/oui/jlib/OraInstal ler.jar:/data/prod/db/12.1.0/oui/jlib/ewt3.jar:/data/prod/db/12.1.0/oui/jlib/share.jar:/data/prod/d b/12.1.0/oui/jlib/srvm.jar:/data/prod/db/12.1.0/jlib/ojmisc.jar oracle.apps.ad.clone.StageDBTier -e /data/prod/db/12.1.0/appsutil/PROD_myebsprod.xml -stage /data/prod/db/12.1.0/appsutil/clone -tmp /tm p -method CUSTOM -showProgress
APPS Password :
Log file located at /data/prod/db/12.1.0/appsutil/log/PROD_myebsprod/StageDBTier_04201611.log
/ 0% completed
Completed Stage...
Wed Apr 20 16:11:25 2022
将 cd $ORACLE_HOME/…/下的12.1.0 完整拷贝至目标目录 /u01/sit/db 下(data文件夹不用拷贝,通过rman来克隆数据库)
从源系统传文件至目标系统,nohup后台运行
--step1.源系统压缩,后台运行,等job完成
[oraprod@myebsprod ~]$ cd $ORACLE_HOME/..
[oraprod@myebsprod db] nohup tar czf /data/backup/db/12.1.0_20220420.tgz 12.1.0 &
[oraprod@myebsprod db]$ jobs
[1]+ Running nohup tar czf /data/backup/db/12.1.0_20220420.tgz 12.1.0 &
--step2.目标系统从源系统下载
[root@myebssit opt]# scp oraprod@192.168.15.10:/data/backup/db/12.1.0_20220420.tgz /opt
--step3.解压
[root@myebssit ~]# cd /u01/sit/db
[root@myebssit db]# nohup tar xzf /opt/12.1.0_20220420.tgz &
[root@myebssit db]# jobs
[1]+ Running nohup tar xzf /opt/12.1.0_20220420.tgz &
step4.等待解压完成后,修改权限
[root@myebssit db]# cd /u01/sit/db
[root@myebssit db]# chown -Rh orasit:dba 12.1.0
数据库备份
我使用的0级和1级备份脚本如下:
db_rman_0_bak.sh
#0级备份
#!/bin/bash
source ~/.bash_profile
rman target / log=/data/backup/db/rman_0_bak/full_`date +%F-%T`.log <<eof
run{
sql 'alter system archive log current';
allocate channel ch1 type disk;
allocate channel ch2 type disk;
backup as compressed backupset incremental level 0 database format '/data/backup/db/rman_0_bak/db0_%d_%T_%U.bak'
plus archivelog format '/data/backup/db/rman_0_bak/arch_%d_%T_%U.bak' delete all input;
backup current controlfile format '/data/backup/db/rman_0_bak/cntrl_%d_%T_%U.bak';
release channel ch1;
release channel ch2;
}
eof
db_rman_1_bak.sh
#1级备份脚本
#!/bin/sh
source ~/.bash_profile
rman target / log=/data/backup/db/rman_1_bak/full_`date +%F-%T`.log <<eof
run{
sql 'alter system archive log current';
allocate channel ch1 type disk;
allocate channel ch2 type disk;
backup as compressed backupset incremental level 1 cumulative database format '/data/backup/db/rman_1_bak/db1_%d_%T_%U.bak' plus archivelog format '/data/backup/db/rman_1_bak/arch_%d_%T_%U.bak' delete all input;
backup current controlfile format '/data/backup/db/rman_1_bak/cntrl_%d_%T_%U.bak';
release channel ch1;
release channel ch2;
}
eof
可以设置定时任务,每天跑一次。
这次克隆,我们只需要0级备份的文件即可,从备份脚本,定位到备份文件路径在 /data/backup/db/rman_0_bak
在目标端执行以下脚本,下载0级备份相关文件至目标环境,可以按日期筛选,这里我下载至 /opt/stage
[root@hsebssit ~]$ cd /opt/stage
[root@hsebssit stage]$ scp oraprod@192.168.15.10:/data/backup/db/rman_0_bak/*20220420*.* /opt/stage
## 修改备份文件的拥有者
[root@hsebssit stage]$ chown -R orasit:dba /opt/stage/*20220420*.*
app 预克隆
在源端的应用用户下,运行 adpreclone.pl
进行预克隆,交互参考如下:
[applprod@myebsprod ~]$ cd $ADMIN_SCRIPTS_HOME
[applprod@myebsprod scripts]$ perl adpreclone.pl appsTier
Copyright (c) 2011, 2014 Oracle Corporation
Redwood Shores, California, USA
Oracle E-Business Suite Rapid Clone
Version 12.2
adpreclone Version 120.31.12020000.22
Enter the APPS User Password: --> 输入apps密码
Enter the Weblogic AdminServer password : --> 输入weblogic密码
Checking the status of the Oracle WebLogic Administration Server....
Running perl /home/prod/app/fs2/EBSapps/appl/ad/12.0.0/patch/115/bin/adProvisionEBS.pl ebs-get-serverstatus -contextfile=/home/prod/app/fs2/inst/apps/PROD_myebsprod/appl/admin/PROD_myebsprod.xml -servername=AdminServer -promptmsg=hide
The Oracle WebLogic Administration Server is up.
Running:
perl /home/prod/app/fs2/EBSapps/appl/ad/12.0.0/bin/adclone.pl java=/home/prod/app/fs2/EBSapps/comn/util/jdk64 mode=stage stage=/home/prod/app/fs2/EBSapps/comn/clone component=appsTier method= appctx=/home/prod/app/fs2/inst/apps/PROD_myebsprod/appl/admin/PROD_myebsprod.xml showProgress
Setting the wls environment
Beginning application tier Stage - Wed Apr 20 16:29:08 2022
/home/prod/app/fs2/EBSapps/comn/util/jdk64/bin/java -Xmx600M -DCONTEXT_VALIDATED=false -Doracle.installer.oui_loc=/oui -classpath /home/prod/app/fs2/FMW_Home/webtier/lib/xmlparserv2.jar:/home/prod/app/fs2/FMW_Home/webtier/jdbc/lib/ojdbc6.jar:/home/prod/app/fs2/EBSapps/comn/java/classes:/home/prod/app/fs2/FMW_Home/webtier/oui/jlib/OraInstaller.jar:/home/prod/app/fs2/FMW_Home/webtier/oui/jlib/ewt3.jar:/home/prod/app/fs2/FMW_Home/webtier/oui/jlib/share.jar:/home/prod/app/fs2/FMW_Home/webtier/../Oracle_EBS-app1/oui/jlib/srvm.jar:/home/prod/app/fs2/FMW_Home/webtier/jlib/ojmisc.jar:/home/prod/app/fs2/FMW_Home/wlserver_10.3/server/lib/weblogic.jar:/home/prod/app/fs2/FMW_Home/oracle_common/jlib/obfuscatepassword.jar oracle.apps.ad.clone.StageAppsTier -e /home/prod/app/fs2/inst/apps/PROD_myebsprod/appl/admin/PROD_myebsprod.xml -stage /home/prod/app/fs2/EBSapps/comn/clone -tmp /tmp -method CUSTOM -showProgress -nopromptmsg
Log file located at /home/prod/app/fs2/inst/apps/PROD_myebsprod/admin/log/clone/StageAppsTier_04201629.log
| 20% completed
Completed Stage...
打包RUN File System下的EBSapps目录,可通过 $RUN_BASE 确定路径,即打包 $RUN_BASE/EBSapps
[applprod@myebsprod ~]$ cd $RUN_BASE
[applprod@myebsprod fs2]$ ll
total 8
drwxr-xr-x. 5 applprod dba 44 Aug 13 2018 EBSapps
drwxr-x--- 11 applprod dba 4096 Aug 13 2018 FMW_Home
drwxr-xr-x. 3 applprod dba 18 May 6 2018 inst
[applprod@myebsprod fs2] nohup tar czf /data/backup/app/EBSapps_20220420.tgz EBSapps &
[applprod@myebsprod fs2]$ jobs
[1]+ Running nohup tar czf /data/backup/app/EBSapps_20220420.tgz EBSapps &
目标系统下载并解压
--目标系统从源系统下载
[root@myebssit db]# scp applprod@192.168.15.10:/data/backup/app/EBSapps_20220420.tgz /opt
--解压
[root@myebssit app]# cd /u01/sit/app/fs2
[root@myebssit fs2]# nohup tar xzf /opt/EBSapps_20220420.tgz &
[root@myebssit fs2]# jobs
[1]+ Running nohup tar xzf /opt/EBSapps_20220420.tgz &
--等待解压完成后,修改权限
[root@myebssit fs2]# cd /u01/sit/app/fs2
[root@myebssit fs2]# chown -Rh applsit:dba EBSapps
db 克隆
在目标系统的数据库用户下,执行命令 perl adcfgclone.pl dbTechStack
,交互参考如下:
[orasit@myebspsit ~]$ cd /u01/sit/db/12.1.0/appsutil/clone/bin
[orasit@myebspsit bin]$ perl adcfgclone.pl dbTechStack
Copyright (c) 2002, 2015 Oracle Corporation
Redwood Shores, California, USA
Oracle E-Business Suite Rapid Clone
Version 12.2
adcfgclone Version 120.63.12020000.60
Enter the APPS password : -> APPS密码
Running: Context clone...
Log file located at /u01/sit/db/12.1.0/appsutil/clone/bin/CloneContext_0421090750.log
Provide the values required for creation of the new Database Context file.
Target System Hostname (virtual or normal) [myebspsit] : -> 输入hostname
Target Instance is RAC (y/n) [n] : -> 是否RAC
Target System Database SID : SIT –> 数据库SID
Target System Base Directory : /u01/sit/db -> db层根目录
Role separation is supported y/n [n] ? :
Target System utl_file_dir Directory List : /u01/sit/temp -> utl_file_dir目录
Number of DATA_TOP's on the Target System [1] :
Target System DATA_TOP Directory 1 [/u01/sit/db/data] : -> 默认即可
Target System RDBMS ORACLE_HOME Directory [/u01/sit/db/12.1.0] : -> 默认即可
Do you want to preserve the Display [hserp:0.0] (y/n) : n -> N
Target System Display [myebspsit:0.0] : -> 默认
Do you want the target system to have the same port values as the source system (y/n) [y] ? : --> 端口池,如果没有特别要求,默认即可
Validating if the source port numbers are available on the target system..
Complete port information available at /u01/sit/db/12.1.0/appsutil/clone/bin/out/SIT_myebspsit/portpool.lst
The new database context file has been created :
/u01/sit/db/12.1.0/appsutil/SIT_myebspsit.xml
Check Clone Context logfile /u01/sit/db/12.1.0/appsutil/clone/bin/CloneContext_0421090750.log for details.
Running Rapid Clone with command:
Running:
perl /u01/sit/db/12.1.0/appsutil/clone/bin/adclone.pl java=/u01/sit/db/12.1.0/appsutil/clone/bin/../jre mode=apply stage=/u01/sit/db/12.1.0/appsutil/clone component=dbTechStack method=CUSTOM dbctxtg=/u01/sit/db/12.1.0/appsutil/SIT_myebspsit.xml showProgress contextValidated=true
Beginning rdbms home Apply - Thu Apr 21 09:09:44 2022
/u01/sit/db/12.1.0/appsutil/clone/bin/../jre/bin/java -Xmx600M -DCONTEXT_VALIDATED=true -Doracle.installer.oui_loc=/u01/sit/db/12.1.0/oui -classpath /u01/sit/db/12.1.0/appsutil/clone/jlib/xmlparserv2.jar:/u01/sit/db/12.1.0/appsutil/clone/jlib/ojdbc6.jar:/u01/sit/db/12.1.0/appsutil/clone/jlib/java:/u01/sit/db/12.1.0/appsutil/clone/jlib/oui/OraInstaller.jar:/u01/sit/db/12.1.0/appsutil/clone/jlib/oui/ewt3.jar:/u01/sit/db/12.1.0/appsutil/clone/jlib/oui/share.jar:/u01/sit/db/12.1.0/appsutil/clone/jlib/oui/srvm.jar:/u01/sit/db/12.1.0/appsutil/clone/jlib/ojmisc.jar oracle.apps.ad.clone.ApplyDBTechStack -e /u01/sit/db/12.1.0/appsutil/SIT_myebspsit.xml -stage /u01/sit/db/12.1.0/appsutil/clone -showProgress
APPS Password : Log file located at /u01/sit/db/12.1.0/appsutil/log/SIT_myebspsit/ApplyDBTechStack_04210909.log
\ 0% completed
Completed Apply...
Thu Apr 21 09:12:18 2022
Starting database listener for SIT:
Running:
/u01/sit/db/12.1.0/appsutil/scripts/SIT_myebspsit/addlnctl.sh start SIT
Logfile: /u01/sit/db/12.1.0/appsutil/log/SIT_myebspsit/addlnctl.txt
You are running addlnctl.sh version 120.4
Starting listener process SIT ...
LSNRCTL for Linux: Version 12.1.0.2.0 - Production on 21-APR-2022 09:12:18
Copyright (c) 1991, 2014, Oracle. All rights reserved.
Starting /u01/sit/db/12.1.0/bin/tnslsnr: please wait...
TNSLSNR for Linux: Version 12.1.0.2.0 - Production
System parameter file is /u01/sit/db/12.1.0/network/admin/SIT_myebspsit/listener.ora
Log messages written to /u01/sit/db/12.1.0/admin/SIT_myebspsit/diag/tnslsnr/myebspsit/sit/alert/log.xml
Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=myebspsit.mylinux.com)(PORT=1521)))
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=myebspsit.mylinux.com)(PORT=1521)))
STATUS of the LISTENER
------------------------
Alias SIT
Version TNSLSNR for Linux: Version 12.1.0.2.0 - Production
Start Date 21-APR-2022 09:12:19
Uptime 0 days 0 hr. 0 min. 0 sec
Trace Level off
Security ON: Local OS Authentication
SNMP OFF
Listener Parameter File /u01/sit/db/12.1.0/network/admin/SIT_myebspsit/listener.ora
Listener Log File /u01/sit/db/12.1.0/admin/SIT_myebspsit/diag/tnslsnr/myebspsit/sit/alert/log.xml
Listening Endpoints Summary...
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=myebspsit.mylinux.com)(PORT=1521)))
Services Summary...
Service "SIT" has 1 instance(s).
Instance "SIT", status UNKNOWN, has 1 handler(s) for this service...
The command completed successfully
addlnctl.sh: exiting with status 0
addlnctl.sh: check the logfile /u01/sit/db/12.1.0/appsutil/log/SIT_myebspsit/addlnctl.txt for more information ...
Running ETCC to check status of DB technology patches...
+===============================================================+
| Copyright (c) 2005, 2017 Oracle and/or its affiliates. |
| All rights reserved. |
| Oracle E-Business Suite Release 12.2 |
| Database EBS Technology Codelevel Checker |
+===============================================================+
Using context file from command line argument:
/u01/sit/db/12.1.0/appsutil/SIT_myebspsit.xml
Starting Database EBS Technology Codelevel Checker, Version 120.55
Thu Apr 21 09:12:58 CST 2022
Log file for this session : /u01/sit/db/12.1.0/appsutil/etcc/checkDBpatch_45328.log
Bugfix XML file version: 120.0.12020000.39
This file will be used for identifying missing bugfixes.
Mapping XML file version: 120.0.12020000.12
This file will be used for mapping bugfixes to patches.
[WARNING] DB-ETCC: Bugfix XML file (/u01/sit/db/12.1.0/appsutil/etcc/txk_R1220_DB_base_bugs.xml) in current directory is more than 30 days old.
Check if a newer version is available in patch 17537119.
Identifying database release.
Database release set to 12.1.0.2.
Connecting to database.
+-----------------------------------------------------------------------------+
[WARNING] DB-ETCC: Could not connect to database, so unable to check:
- Whether database is in READ-WRITE mode.
- Existence of table needed to store DB-ETCC results.
- Enablement of database In-Memory option.
If this feature is enabled, additional fixes need to be verified.
Resolve the database connectivity issue, and then rerun DB-ETCC.
+-----------------------------------------------------------------------------+
Checking Bugfix XML file for 12.1.0.2_PSU
Obtained list of bugfixes to be applied and the list to be rolled back.
Now checking Database ORACLE_HOME.
The opatch utility is version 12.2.0.1.11.
DB-ETCC is compatible with this opatch version.
Found patch records in the inventory.
Checking Mapping XML file for 12.1.0.2.171017
All the required one-off bugfixes are present in Database ORACLE_HOME.
[WARNING] Database not available. DB-ETCC results cannot be stored.
Finished checking fixes for Oracle Database: Thu Apr 21 09:13:14 CST 2022
Log file for this session: /u01/sit/db/12.1.0/appsutil/etcc/checkDBpatch_45328.log
===============================================================================
修改 .bash_profile,在最后添加 . /u01/sit/db/12.1.0/SIT_myebssit.env
,加载环境变量,退出重新登录,或者手工加载 source ~/.bash_profile
# .bash_profile
# Get the aliases and functions
if [ -f ~/.bashrc ]; then
. ~/.bashrc
fi
# User specific environment and startup programs
PATH=$PATH:$HOME/.local/bin:$HOME/bin
export PATH
. /u01/sit/db/12.1.0/SIT_myebssit.env
创建 startdb.sh,注意修改 ORACLE_SID
export ORACLE_SID=SIT
lsnrctl start $ORACLE_SID
sqlplus /nolog <<EOF
conn /as sysdba
startup
exit
EOF
创建 stopdb.sh,注意修改 ORACLE_SID
export ORACLE_SID=SIT
lsnrctl stop $ORACLE_SID
sqlplus /nolog <<EOF
conn /as sysdba
shutdown immediate
exit
EOF
修改脚本权限
[orasit@myebssit ~]$ chmod +x startdb.sh stopdb.sh
数据库恢复
重新登录数据用户,加载环境变量
修改 $ORACLE_HOME/dbs/initSIT.ora
,添加以下内容,根据实际情况填写,分别是源系统和目标系统的data目录
db_file_name_convert='/data/prod/db/data','/u01/sit/db/data'
log_file_name_convert='/data/prod/db/data','/u01/sit/db/data'
nomount 启动数据库
[orasit@myebssit ~]$ sqlplus / as sysdba
SQL*Plus: Release 12.1.0.2.0 Production on Thu Apr 21 09:53:30 2022
Copyright (c) 1982, 2014, Oracle. All rights reserved.
Connected to an idle instance.
SQL> startup nomount -->nomount 启动数据库
ORA-32004: obsolete or deprecated parameter(s) specified for RDBMS instance
ORACLE instance started.
Total System Global Area 2147483648 bytes
Fixed Size 3712904 bytes
Variable Size 486541432 bytes
Database Buffers 1644167168 bytes
Redo Buffers 13062144 bytes
SQL> show parameter convert -–>显示参数,确保修改initSIT.ora 正确
NAME TYPE
------------------------------------ ---------------------------------
VALUE
------------------------------
db_file_name_convert string
/data/prod/db/data, /u01/sit/d
b/data
log_file_name_convert string
/data/prod/db/data, /u01/sit/d
b/data
pdb_file_name_convert string
SQL> quit
Disconnected from Oracle Database 12c Enterprise Edition Release 12.1.0.2.0 - 64bit Production
With the Partitioning, OLAP, Advanced Analytics and Real Application Testing options
新增脚本 dup.sh,内容如下,注意下最后语句中标红语句,确保正确,其中 /opt/stage 里存放0级备份相关文件,注意确认文件的拥有者是否是 orasit
DUPLICATE DATABASE TO 'SIT' BACKUP LOCATION '/opt/stage' NOFILENAMECHECK
,注意最后语句中的 SIT
为目标数据库名称,/opt/stage
为存放0级备份文件的路径,注意备份文件的拥有者是否是数据库用户,若不是,则修改文件拥有者 chown -R orasit:dba /opt/stage/*20220420*.*
(若需执行chown,需要切至root,然后记得切换回来)
rman auxiliary / <<EOF
run{
ALLOCATE AUXILIARY CHANNEL aux1 DEVICE TYPE DISK;
ALLOCATE AUXILIARY CHANNEL aux2 DEVICE TYPE DISK;
ALLOCATE AUXILIARY CHANNEL aux3 DEVICE TYPE DISK;
ALLOCATE AUXILIARY CHANNEL aux4 DEVICE TYPE DISK;
ALLOCATE AUXILIARY CHANNEL aux5 DEVICE TYPE DISK;
ALLOCATE AUXILIARY CHANNEL aux6 DEVICE TYPE DISK;
ALLOCATE AUXILIARY CHANNEL aux7 DEVICE TYPE DISK;
ALLOCATE AUXILIARY CHANNEL aux8 DEVICE TYPE DISK;
DUPLICATE DATABASE TO 'SIT' BACKUP LOCATION '/opt/stage' NOFILENAMECHECK;
}
赋予脚本执行权限
[orasit@myebssit ~]$ chmod +x dup.sh
后台运行,会在执行目录下,自动生成文件 nohup.log
[orasit@myebssit ~]$ nohup ./dup.sh &
运行进度可以通过 tail –f nohup.log
,查看运行日志,或者切换至 /u01/sit/db/data,查看数据库文件是否生成来确定
[orasit@myebssit ~]$ tail -f nohup.out
数据库恢复耗时较长,等待完成后,将数据库 mount 启动,另外一般还需要做一些清除动作,比如dblink,应用节点等
sqlplus / as sysdba
shutdown immediate –先关闭
startup mount –在mount启动
alter database noarchivelog; --关闭归档
alter database open;
--必要的步骤
conn apps/apps
--删除 db link
..
--清除应用节点信息
SELECT node_name FROM fnd_nodes; --查看结果,应该显示的正式环境
--清除后提交
exec fnd_conc_clone.setup_clean;
commit;
SELECT node_name FROM fnd_nodes; --再次查看结果,应清空,后面运行 adautocfg.sh 时,会自动新增记录
启用监听,一般在前面执行 perl adcfgclone.pl dbTechStack
时,会自动启用了,可用 lsnrctl status
查看状态,如果未启用,则启用
cd $ORACLE_HOME/bin
lsnrctl start
运行 adautocfg.sh,交互参考如下:
[orasit@myebssit ~]$ cd $ORACLE_HOME/appsutil/scripts/$CONTEXT_NAME
[orasit@myebssit SIT_myebssit]$ adautocfg.sh
Enter the APPS user password:
The log file for this session is located at: /u01/sit/db/12.1.0/appsutil/log/SIT_myebssit/04211337/adconfig.log
AutoConfig is configuring the Database environment...
AutoConfig will consider the custom templates if present.
Using ORACLE_HOME location : /u01/sit/db/12.1.0
Classpath : :/u01/sit/db/12.1.0/jdbc/lib/ojdbc6.jar:/u01/sit/db/12.1.0/appsutil/java/xmlparserv2.jar:/u01/sit/db/12.1.0/appsutil/java:/u01/sit/db/12.1.0/jlib/netcfg.jar:/u01/sit/db/12.1.0/jlib/ldapjclnt12.jar
Using Context file : /u01/sit/db/12.1.0/appsutil/SIT_myebssit.xml
Context Value Management will now update the Context file
Updating Context file...COMPLETED
Attempting upload of Context file and templates to database...COMPLETED
Updating rdbms version in Context file to db121
Updating rdbms type in Context file to 64 bits
Configuring templates from ORACLE_HOME ...
AutoConfig completed successfully.
运行成功后,再次查找 SELECT * FROM fnd_nodes
,会有新的节点信息生成。
建议额外查询下 SESSION 和 PROCESS 的设置,改大些,在应用层启动后也会占些,要是太小,打开界面会报错,具体修改如下,另外需要重启数据库使参数生效
SQL> show parameter session
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
_optimizer_use_gtt_session_stats boolean TRUE
java_max_sessionspace_size integer 0
java_soft_sessionspace_limit integer 0
license_max_sessions integer 0
license_sessions_warning integer 0
session_cached_cursors integer 500
session_max_open_files integer 10
sessions integer 400
shared_server_sessions integer
SQL> show parameter process
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
aq_tm_processes integer 1
cell_offload_processing boolean TRUE
db_writer_processes integer 1
gcs_server_processes integer 0
global_txn_processes integer 1
job_queue_processes integer 2
log_archive_max_processes integer 4
processes integer 200
processor_group_name string
SQL> alter system set processes=2000 scope=spfile;
System altered.
SQL> alter system set sessions=3000 scope=spfile;
System altered.
app 克隆
目标端登录应用用户,设置环境变量 export CONFIG_JVM_ARGS="-Xmx2048m -Xms1024m"
,并运行命令 perl adcfgclone.pl appsTier dualfs
,交互参考如下:
[applsit@myebssit ~]$ export CONFIG_JVM_ARGS="-Xmx2048m -Xms1024m"
[applsit@myebssit ~]$ cd /u01/sit/app/fs2/EBSapps/comn/clone/bin/
[applsit@myebssit bin]$ perl adcfgclone.pl appsTier dualfs
Copyright (c) 2002, 2015 Oracle Corporation
Redwood Shores, California, USA
Oracle E-Business Suite Rapid Clone
Version 12.2
adcfgclone Version 120.63.12020000.60
Enter the APPS password : ->输入apps密码
Enter the Weblogic AdminServer password : ->输入weblogic密码
Do you want to add a node (yes/no) [no] :
Running: Context clone...
Log file located at /u01/sit/app/fs2/EBSapps/comn/clone/bin/CloneContext_0429094603.log
Provide the values required for creation of the new APPL_TOP Context file.
Target System Hostname (virtual or normal) [myebssit] : ->hostname
Target System Database SID : SIT –> 数据库SID
Target System Database Server Node [myebssit] : ->默认
Target System Database Domain Name [mylinux.com] : ->默认
Target System Base Directory : /u01/sit/app -> 应用根目录
Target System Base Directory set to /u01/sit/app
Target System Current File System Base set to /u01/sit/app/fs2
Target System Other File System Base set to /u01/sit/app/fs1
Target System Fusion Middleware Home set to /u01/sit/app/fs2/FMW_Home
Target System Other File System Fusion Middleware Home set to /u01/sit/app/fs1/FMW_Home
Target System Web Oracle Home set to /u01/sit/app/fs2/FMW_Home/webtier
Target System Other File System Web Oracle Home set to /u01/sit/app/fs1/FMW_Home/webtier
Target System Appl TOP set to /u01/sit/app/fs2/EBSapps/appl
Target System Other File System Appl TOP set to /u01/sit/app/fs1/EBSapps/appl
Target System COMMON TOP set to /u01/sit/app/fs2/EBSapps/comn
Target System Other File System COMMON TOP set to /u01/sit/app/fs1/EBSapps/comn
Target System Instance Home Directory [/u01/sit/app] :
Target System Current File System Instance Top set to /u01/sit/app/fs2/inst/apps/SIT_myebssit
Do you want to preserve the Display [hserp:0.0] (y/n) : n
Target System Display [myebssit:0.0] :
Target System Root Service [enabled] :
Target System Web Entry Point Services [enabled] :
Target System Web Application Services [enabled] :
Target System Batch Processing Services [enabled] :
Target System Other Services [disabled] :
Do you want the target system to have the same port values as the source system (y/n) [y] ? :
Validating if the source port numbers are available on the target system..
Complete port information available at /u01/sit/app/fs2/EBSapps/comn/clone/bin/out/SIT_myebssit/portpool.lst
UTL_FILE_DIR on database tier consists of the following directories.
1. /usr/tmp
2. /u01/sit/temp
3. /u01/sit/db/12.1.0/appsutil/outbound/SIT_myebssit
4. /usr/tmp
Choose a value which will be set as APPLPTMP value on the target node [1] : 2
The new APPL_TOP context file has been created :
/u01/sit/app/fs2/inst/apps/SIT_myebssit/appl/admin/SIT_myebssit.xml
Check Clone Context logfile /u01/sit/app/fs2/EBSapps/comn/clone/bin/CloneContext_0429094603.log for details.
Creating Patch file system context file.....
Log file located at /u01/sit/app/fs2/EBSapps/comn/clone/bin/CloneContextPatch_0429094628.log
Target System Other File System Instance Top set to /u01/sit/app/fs1/inst/apps/SIT_myebssit
Validating if the source port numbers are available on the target system..
Complete port information available at /u01/sit/app/fs2/EBSapps/comn/clone/bin/out/SIT_myebssit/portpool.lst
The new APPL_TOP context file has been created :
/u01/sit/app/fs1/inst/apps/SIT_myebssit/appl/admin/SIT_myebssit.xml
Check Clone Context logfile /u01/sit/app/fs2/EBSapps/comn/clone/bin/CloneContextPatch_0429094628.log for details.
FMW Pre-requisite check log file location : /u01/sit/app/fs2/EBSapps/comn/clone/FMW/logs/prereqcheck.log
Running: FMW pre-req check...
Configuring: Run file system....
LogFile located at /u01/sit/app/fs2/inst/apps/SIT_myebssit/admin/log/clone/run/RCloneApplyAppstier_04290946.log
Configuring: Patch file system....
LogFile located at /u01/sit/app/fs2/inst/apps/SIT_myebssit/admin/log/clone/patch/RCloneApplyAppstier_04291011.log
Do you want to startup the Application Services for SIT? (y/n) [n] : n
Services not started
修改 .bash_profile
,最后添加 . /u01/sit/app/EBSapps.env run
,加载环境变量,退出重新登录,或是手工重新加载 source ~/.bash_profile
# .bash_profile
# Get the aliases and functions
if [ -f ~/.bashrc ]; then
. ~/.bashrc
fi
# User specific environment and startup programs
PATH=$PATH:$HOME/.local/bin:$HOME/bin
export PATH
. /u01/sit/app/EBSapps.env run
设置启停脚本
startapp.sh
$ADMIN_SCRIPTS_HOME/adstrtal.sh apps/apps <<EOF
manager0
EOF
stopapp.sh
$ADMIN_SCRIPTS_HOME/adstpall.sh apps/apps <<EOF
manager0
EOF
修改脚本权限
chmod +x startapp.sh stopapp.sh
克隆后
克隆后,一般还需要进行一些设置
修改配置文件
配置文件 | 值 | 备注 |
---|---|---|
地点名称 | SIT | 会自动变更,可以再检查下 |
Java 色彩设计 | 灰色 | 改成和正式环境不一致的,另外如果没有生效,可以清除高速缓存 |
如果用到SOA发布的webservice接口,需要取消部署后重新部署下
如果有使用db_link 和 目录,可以检查下,切换至目标环境对应的目录
SELECT *
FROM dba_db_links;
SELECT *
FROM dba_directories t;
重启并发管理器
cd $ADMIN_SCRIPTS_HOME/
## 关闭并发管理器
adcmctl.sh stop apps/apps
## 查看进程是否存在
ps -ef | grep FND
## 进程无结果后,再次启动
adcmctl.sh start apps/apps
## 查看并发管理器状态,前面几步执行的时候,也可以执行该命令查看状态
adcmctl.sh status apps/apps
问题解决
- inode number 大于 2 ^ 32 时,会导致应用克隆时,可能会出现各种莫名其妙的问题,比如说:
Error occurred during initialization of VM
java/lang/NoClassDefFoundError: java/lang/Object
原因:查看资料后,得知,如果分配的空间大于1T,那么 inode_number 可能会大于 2 ^ 32,而 EBS 的应用使用的java是32位的,无法识别 inode_number 大于2 ^ 32 的文件
解决:在搭建目标环境时,建议将应用目录单独挂载,并且磁盘空间小于 1T,一般应用也不需要这么大;另外数据库克隆时,没有限制,可以大于1T。