使用clone.pl脚本拷贝原库的软件到新的目的库
环境:
OS:Centos 6.9
DB:11.2.0.4
前提条件:
1.新库的ORACLE_HOME、ORACLE_BASE环境变量跟原库保持一致
2.新库需要创建好oralce账号和相应的组
3.新库安装好相应的系统补丁和环境
1.检查Oracle补丁状态
[oracle@localhost 19023822]$ $ORACLE_HOME/OPatch/opatch lsinventory
Oracle Interim Patch Installer version 11.2.0.3.4
Copyright (c) 2012, Oracle Corporation. All rights reserved.
Oracle Home : /u01/app/oracle/product/11.2.0.4/db_1
Central Inventory : /u01/app/oraInventory
from : /u01/app/oracle/product/11.2.0.4/db_1/oraInst.loc
OPatch version : 11.2.0.3.4
OUI version : 11.2.0.4.0
Log file location : /u01/app/oracle/product/11.2.0.4/db_1/cfgtoollogs/opatch/opatch2022-10-10_15-59-31PM_1.log
Lsinventory Output file location : /u01/app/oracle/product/11.2.0.4/db_1/cfgtoollogs/opatch/lsinv/lsinventory2022-10-10_15-59-31PM.txt
--------------------------------------------------------------------------------
Installed Top-level Products (1):
Oracle Database 11g 11.2.0.4.0
There are 1 products installed in this Oracle Home.
Interim patches (1) :
Patch (online) 19023822: applied on Mon Oct 10 15:51:11 CST 2022
Unique Patch ID: 17884511
Created on 28 Jul 2014, 20:54:00 hrs PST8PDT
Bugs fixed:
19023822
--------------------------------------------------------------------------------
OPatch succeeded.
2.停止数据库进程
好像不需要停掉数据库的,我这里是在没有停掉数据库的情况下操作的
3.打包ORACLE HOME
[root@localhost oracle]# su - root
[root@localhost oracle]# cd /home/oracle
[root@localhost oracle]# tar -cvf Oracle.tar /u01/app/oracle/product/11.2.0.4/db_1
4.将tar包拷贝到B机
B机环境变量设置成和A机一样
都需要安装scp软件
yum install openssh-clients -y
scp Oracle.tar root@192.168.58.111:/home/oracle/
5.目标机器上进行解压
[root@localhost oracle]# pwd
/home/oracle
[root@localhost oracle]# mv Oracle.tar /
[root@localhost /]# cd /
[root@localhost /]# tar -xvf Oracle.tar
修改属主:
[root@localhost /]# chown -R oracle:oinstall /u01
6.现在查看补丁情况
[oracle@localhost bin]$ $ORACLE_HOME/OPatch/opatch lsinventory
Oracle Interim Patch Installer version 11.2.0.3.4
Copyright (c) 2012, Oracle Corporation. All rights reserved.
Oracle Home : /u01/app/oracle/product/11.2.0.4/db_1
Central Inventory : /u01/app/oraInventory
from : /u01/app/oracle/product/11.2.0.4/db_1/oraInst.loc
OPatch version : 11.2.0.3.4
OUI version : 11.2.0.4.0
Log file location : /u01/app/oracle/product/11.2.0.4/db_1/cfgtoollogs/opatch/opatch2022-10-10_16-38-46PM_1.log
OPatch failed to locate Central Inventory.
Possible causes are:
The Central Inventory is corrupted
The oraInst.loc file specified is not valid.
LsInventorySession failed: OPatch failed to locate Central Inventory.
Possible causes are:
The Central Inventory is corrupted
The oraInst.loc file specified is not valid.
OPatch failed with error code 73
6.克隆
[oracle@localhost bin]$ cd /u01/app/oracle/product/11.2.0.4/db_1/clone/bin
[oracle@localhost bin]$ /u01/app/oracle/product/11.2.0.4/db_1/perl/bin/perl clone.pl ORACLE_BASE="/u01/app/oracle" ORACLE_HOME="/u01/app/oracle/product/11.2.0.4/db_1" OSDBA_GROUP=dba
./runInstaller -clone -waitForCompletion "ORACLE_BASE=/u01/app/oracle" "ORACLE_HOME=/u01/app/oracle/product/11.2.0.4/db_1" "oracle_install_OSDBA=dba" -defaultHomeName -silent -noConfig -nowait
Starting Oracle Universal Installer...
Checking swap space: must be greater than 500 MB. Actual 2047 MB Passed
Preparing to launch Oracle Universal Installer from /tmp/OraInstall2022-10-10_04-41-57PM. 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:
/u01/app/oraInventory/logs/cloneActions2022-10-10_04-41-57PM.log
.................................................................................................... 100% Done.
Installation in progress (Monday, October 10, 2022 4:42:06 PM CST)
.............................................................................. 78% Done.
Install successful
Linking in progress (Monday, October 10, 2022 4:42:12 PM CST)
Link successful
Setup in progress (Monday, October 10, 2022 4:42:41 PM CST)
Setup successful
End of install phases.(Monday, October 10, 2022 4:43:04 PM CST)
WARNING:A new inventory has been created in this session. However, it has not yet been registered as the central inventory of this system.
To register the new inventory please run the script '/u01/app/oraInventory/orainstRoot.sh' with root privileges.
If you do not register the inventory, you may not be able to update or patch the products you installed.
The following configuration scripts need to be executed as the "root" user.
/u01/app/oraInventory/orainstRoot.sh
/u01/app/oracle/product/11.2.0.4/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 OraHome1 was successful.
Please check '/u01/app/oraInventory/logs/cloneActions2022-10-10_04-41-57PM.log' for more details.
按照提示执行如下脚本(root账号运行)
/u01/app/oraInventory/orainstRoot.sh
/u01/app/oracle/product/11.2.0.4/db_1/root.sh
这个时候查看补丁情况
[oracle@localhost bin]$ $ORACLE_HOME/OPatch/opatch lsinventory
Oracle Interim Patch Installer version 11.2.0.3.4
Copyright (c) 2012, Oracle Corporation. All rights reserved.
Oracle Home : /u01/app/oracle/product/11.2.0.4/db_1
Central Inventory : /u01/app/oraInventory
from : /u01/app/oracle/product/11.2.0.4/db_1/oraInst.loc
OPatch version : 11.2.0.3.4
OUI version : 11.2.0.4.0
Log file location : /u01/app/oracle/product/11.2.0.4/db_1/cfgtoollogs/opatch/opatch2022-10-10_16-44-53PM_1.log
Lsinventory Output file location : /u01/app/oracle/product/11.2.0.4/db_1/cfgtoollogs/opatch/lsinv/lsinventory2022-10-10_16-44-53PM.txt
--------------------------------------------------------------------------------
Installed Top-level Products (1):
Oracle Database 11g 11.2.0.4.0
There are 1 products installed in this Oracle Home.
Interim patches (1) :
Patch (online) 19023822: applied on Mon Oct 10 15:51:11 CST 2022
Unique Patch ID: 17884511
Created on 28 Jul 2014, 20:54:00 hrs PST8PDT
Bugs fixed:
19023822
--------------------------------------------------------------------------------
OPatch succeeded.
后面就可以使用dbca创建新的实例了
在新服务器上需要将原库拷贝过来的监听文件删除掉,然后重新创建新的监听器
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· DeepSeek 开源周回顾「GitHub 热点速览」
· 物流快递公司核心技术能力-地址解析分单基础技术分享
· .NET 10首个预览版发布:重大改进与新特性概览!
· AI与.NET技术实操系列(二):开始使用ML.NET
· 单线程的Redis速度为什么快?
2019-10-10 elasticsearch单机部署