• 使用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创建新的实例了

    在新服务器上需要将原库拷贝过来的监听文件删除掉,然后重新创建新的监听器

  • 相关阅读:
    Asp.net 表单打印时的样式设置【原】
    Asp.net页面编辑时怎样获取隐藏列的值【原】
    C# Winform 捕获窗体的最小化和最大化事件、关闭按钮事件【整理】
    SQL 快速删除表数据并不生成日志的语句【搜藏】
    Asp.net 前段页面控件 filedset 对应的服务端控件【原】
    Asp.net 关于 HTTP403 – 访问错误 的原因及解决【原】
    Js对一个对象应用滤镜的几种方法【整理】
    Asp.net 查找不到动态创建的控件之解决办法【整理】
    C# windows service承載遠程對象
    自己写的一个日志记录类
  • 原文地址:https://www.cnblogs.com/hxlasky/p/16776328.html
Copyright © 2020-2023  润新知