.............................................................................. 78% Done.
Install successful
Linking in progress (Tuesday, October 18, 2016 6:14:00 PM CST)
Link successful
Setup in progress (Tuesday, October 18, 2016 6:14:35 PM CST)
Setup successful
End of install phases.(Tuesday, October 18, 2016 6:14:59 PM CST)
WARNING:
The following configuration scripts need to be executed as the "root" user.
/u01/app/oracle/product/11.2.0/dbhome_1_clone/root.sh
To execute the configuration scripts:
1. Open a terminal window
2. Log in as "root"
3. Run the scripts
The cloning of clone was successful.
Please check '/u01/app/oraInventory/logs/cloneActions2016-10-18_06-13-35PM.log' for more details.
切换到root进行脚本执行。
[root@testlife ~]# cd /u01/app/oracle/product/11.2.0/dbhome_1_clone
[root@testlife dbhome_1_clone]# ./root.sh
Check /u01/app/oracle/product/11.2.0/dbhome_1_clone/install/root_testlife.localdomain_2016-10-18_18-16-58.log for the output of root script
注意:此时Clone是一个和主库一样的程序包,主库在补丁过程中是支持对外操作的。
下面可以在Clone数据库上进行补丁操作。
[oracle@testlife upload]$ export ORACLE_HOME=$C_ORACLE_HOME
[oracle@testlife upload]$ cd 23615392/
[oracle@testlife 23615392]$ ls -l
total 32
drwxr-xr-x 13 oracle oinstall 4096 Jul 20 19:30 23054359
drwxr-xr-x 5 oracle oinstall 4096 Jul 20 19:30 23177551
-rw-r--r-- 1 oracle oinstall 18806 Jul 20 19:50 README.html
-rw-r--r-- 1 oracle oinstall 25 Jul 20 19:30 README.txt
[oracle@testlife 23615392]$ cd 23054359/
[oracle@testlife 23054359]$ $ORACLE_HOME/OPatch/opatch apply
Oracle Interim Patch Installer version 11.2.0.3.10
Copyright (c) 2016, Oracle Corporation. All rights reserved.
Oracle Home : /u01/app/oracle/product/11.2.0/dbhome_1_clone
Central Inventory : /u01/app/oraInventory
from : /u01/app/oracle/product/11.2.0/dbhome_1_clone/oraInst.loc
OPatch version : 11.2.0.3.10
OUI version : 11.2.0.4.0
(中间略...)
两个补丁均完成。暂停原有服务,进行目录切换。
[oracle@testlife 23177551]$ export ORACLE_HOME=$O_ORACLE_HOME
[oracle@testlife 23177551]$ env | grep ORACLE_SID
ORACLE_SID=testdb
[oracle@testlife 23177551]$ sqlplus /nolog
SQL*Plus: Release 11.2.0.4.0 Production on Tue Oct 18 19:33:52 2016
Copyright (c) 1982, 2013, Oracle. All rights reserved.
SQL> conn / as sysdba
Connected.
SQL> shutdown immediate;
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL> exit
Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
[oracle@testlife 23177551]$ $ORACLE_HOME/bin/lsnrctl stop
LSNRCTL for Linux: Version 11.2.0.4.0 - Production on 18-OCT-2016 19:34:32
Copyright (c) 1991, 2013, Oracle. All rights reserved.
Connecting to (ADDRESS=(PROTOCOL=tcp)(HOST=)(PORT=1521))
The command completed successfully
将原有数据库目录Detach。
[oracle@testlife 23177551]$ cd ~
[oracle@testlife ~]$ export ORACLE_HOME=$O_ORACLE_HOME
[oracle@testlife ~]$ cd $ORACLE_HOME/..
[oracle@testlife 11.2.0]$ $ORACLE_HOME/oui/bin/detachHome.sh
Starting Oracle Universal Installer...
Checking swap space: must be greater than 500 MB. Actual 7967 MB Passed
The inventory pointer is located at /etc/oraInst.loc
The inventory is located at /u01/app/oraInventory
'DetachHome' was successful.
--原有目录修改名称
[oracle@testlife 11.2.0]$ mv $ORACLE_HOME `echo $ORACLE_HOME`_to_be_removed
[oracle@testlife 11.2.0]$ ls -l
total 8
drwxr-xr-x 79 oracle dba 4096 Oct 18 19:31 dbhome_1_clone
drwxr-xr-x. 75 oracle oinstall 4096 Oct 18 17:52 dbhome_1_to_be_removed
Detach新的目录对象。
[oracle@testlife 11.2.0]$ export ORACLE_HOME=$C_ORACLE_HOME
[oracle@testlife 11.2.0]$ $ORACLE_HOME/oui/bin/detachHome.sh
Starting Oracle Universal Installer...
Checking swap space: must be greater than 500 MB. Actual 7967 MB Passed
The inventory pointer is located at /etc/oraInst.loc
The inventory is located at /u01/app/oraInventory
'DetachHome' was successful.
--Clone出新的文件目录。
[oracle@testlife 11.2.0]$ mv $C_ORACLE_HOME $O_ORACLE_HOME
[oracle@testlife 11.2.0]$ export ORACLE_HOME=$O_ORACLE_HOME
[oracle@testlife 11.2.0]$ perl $ORACLE_HOME/clone/bin/clone.pl \
> ORACLE_BASE=$ORACLE_BASE \
> ORACLE_HOME=$O_ORACLE_HOME \
> ORACLE_HOME_NAME=$O_ORACLE_HOME_NAME