1. 源端tar ORACLE_HOME
tar cvf Oracle_Home11g_clone.tar db_1/
$ ls -l Oracle_Home11g_clone.tar
-rw-r--r-- 1 oracle oinstall 7772129280 Jan 27 12:49 Oracle_Home11g_clone.tar
$ id
uid=1999(oracle) gid=1000(oinstall) groups=1200(dba)
$ du -sg Oracle_Home11g_clone.tar
7.24 Oracle_Home11g_clone.tar
2.目标端准备
准备包括系统参数,用户,环境变量,目录,权限,必要的软件包,这里略过详细步骤。说下跟oracle有关的。
BASE跟HOME都要有。环境变量要配置。
mkdir -p /orahome/app/oracle/product/11.2.0/db_1
mkdir -p diag/rdbms/orcl/orcl/trace
mkdir -p admin/orcl/adump
mkdir -p admin/orcl/dpdump
chown -R oracle:oinstall app
chmod -R 775 app
export ORACLE_BASE=/orahome/app/oracle
export ORACLE_HOME=$ORACLE_BASE/product/11.2.0/db_1
export ORACLE_SID=orcl
export PATH=$ORACLE_HOME/bin:$ORACLE_HOME/OPatch:$PATH
3.tar包传到目标端
没有scp命令 用nfs方式
源端配置好后:
# showmount -e
export list for localhost:
/home/oracle/app/oracle/product/11.2 aix247
目标端:
# mkdir /clone
#
# mount 192.168.205.153:/home/oracle/app/oracle/product/11.2 /clone
# df -gt
Filesystem GB blocks Used Free %Used Mounted on
/dev/hd4 2.00 0.20 1.80 11% /
/dev/hd2 8.00 2.81 5.19 36% /usr
/dev/hd9var 4.00 0.35 3.65 9% /var
/dev/hd3 2.00 0.01 1.99 1% /tmp
/dev/hd1 0.03 0.00 0.03 3% /home
/dev/hd11admin 0.12 0.00 0.12 1% /admin
/proc - - - - /proc
/dev/hd10opt 0.44 0.26 0.18 59% /opt
/dev/livedump 0.25 0.00 0.25 1% /var/adm/ras/livedump
/dev/oralv 19.00 0.07 18.93 1% /orahome
192.168.205.153:/home/oracle/app/oracle/product/11.2/db_1 80.00 37.89 42.11 48% /clone
给权限 解压
# cd /clone
# chown oracle:oinstall Oracle_Home11g_clone.tar
# chmod 775 Oracle_Home11g_clone.tar
# ls -l Oracle_Home11g_clone.tar
-rwxrwxr-x 1 oracle oinstall 7772129280 Jan 27 2016 Oracle_Home11g_clone.tar
mv Oracle_Home11g_clone.tar /orahome/app/oracle/product/11.2.0
tar -xvf Oracle_Home11g_clone.tar
看看权限
$ ls -l
total 184
drwxr-xr-x 3 oracle oinstall 256 Dec 22 16:43 EMStage
4.处理几处文件
监听文件
LISTENER =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.205.111)(PORT = 1521))
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521))
)
)
ADR_BASE_LISTENER = /orahome/app/oracle
其他文件
cd /tmp;
rm -rf .oracle
cd /var/tmp
rm -rf .oracle
# more /etc/oraInst.loc
inventory_loc=/orahome/app/oraInventory
inst_group=oinstall
# pwd
/orahome/app
# ls -l
total 0
drwxrwxr-x 5 oracle oinstall 256 Dec 22 01:17 oraInventory
1. 克隆
$ cd $ORACLE_HOME/clone/bin
$ ls
clone.pl prepare_clone.pl
$ perl clone.pl ORACLE_BASE="/orahome/app/oracle/" ORACLE_HOME="/orahome/app/oracle/product/11.2.0/db_1" OSDBA_GROUP=dba OSOPER_GROUP=oper -defaultHomeName
********************************************************************************
Your platform requires the root user to perform certain pre-clone
OS preparation. The root user should run the shell script 'rootpre.sh' before
you proceed with cloning. rootpre.sh can be found at
/orahome/app/oracle/product/11.2.0/db_1/clone directory.
Answer 'y' if the root user has run 'rootpre.sh' script.
********************************************************************************
Has 'rootpre.sh' been run by the root user? [y/n] (n)
开另一个窗口
# pwd
/orahome/app/oracle/product/11.2.0/db_1/clone
# sh rootpre.sh
rootpre.sh output will be logged in /tmp/rootpre.out_16-01-26.07:38:00
Checking if group services should be configured....
Nothing to configure.
回来选Y,然后遇到报错。
Has 'rootpre.sh' been run by the root user? [y/n] (n)
y
./runInstaller -clone -waitForCompletion "ORACLE_BASE=/orahome/app/oracle/" "ORACLE_HOME=/orahome/app/oracle/product/11.2.0/db_1" "oracle_install_OSDBA=dba" "oracle_install_OSOPER=oper" -defaultHomeName -defaultHomeName -silent -noConfig -nowait
Starting Oracle Universal Installer...
Checking swap space: must be greater than 500 MB. Actual 1216 MB Passed
Preparing to launch Oracle Universal Installer from /tmp/OraInstall2016-01-26_07-38-04AM. 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:
/orahome/app/oraInventory/logs/cloneActions2016-01-26_07-38-04AM.log
OUI-10197:Unable to create a new Oracle Home at /orahome/app/oracle/product/11.2.0/db_1. Oracle Home already exists at this location. Select another location.
SEVERE:OUI-10197:Unable to create a new Oracle Home at /orahome/app/oracle/product/11.2.0/db_1. Oracle Home already exists at this location. Select another location.
干掉原来的ORACLE_HOME,
$ cd $ORACLE_HOME/oui/bin
$ ./runInstaller -detachHome ORACLE_HOME="/orahome/app/oracle/product/11.2.0/db_1"
Starting Oracle Universal Installer...
Checking swap space: must be greater than 500 MB. Actual 1216 MB Passed
The inventory pointer is located at /etc/oraInst.loc
The inventory is located at /orahome/app/oraInventory
'DetachHome' was successful.
继续克隆
$ id
uid=1100(oracle) gid=1000(oinstall) groups=1200(dba)
$ cd /orahome/app/oracle/product/11.2.0/db_1/clone/bin/
$ORACLE_HOME/perl/bin/perl clone.pl ORACLE_BASE="/orahome/app/oracle/" ORACLE_HOME="/orahome/app/oracle/product/11.2.0/db_1" OSDBA_GROUP=dba OSOPER_GROUP=oper –defaultHomeName
********************************************************************************
Your platform requires the root user to perform certain pre-clone
OS preparation. The root user should run the shell script 'rootpre.sh' before
you proceed with cloning. rootpre.sh can be found at
/orahome/app/oracle/product/11.2.0/db_1/clone directory.
Answer 'y' if the root user has run 'rootpre.sh' script.
********************************************************************************
Has 'rootpre.sh' been run by the root user? [y/n] (n)
y
./runInstaller -clone -waitForCompletion "ORACLE_BASE=/orahome/app/oracle/" "ORACLE_HOME=/orahome/app/oracle/product/11.2.0/db_1" "oracle_install_OSDBA=dba" "oracle_install_OSOPER=oper" -defaultHomeName -defaultHomeName -silent -noConfig -nowait
Starting Oracle Universal Installer...
Checking swap space: must be greater than 500 MB. Actual 1216 MB Passed
Preparing to launch Oracle Universal Installer from /tmp/OraInstall2016-01-26_08-02-55AM. 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:
/orahome/app/oraInventory/logs/cloneActions2016-01-26_08-02-55AM.log
.................................................................................................... 100% Done.
Installation in progress (Tuesday, January 26, 2016 8:04:32 AM CST)
.............................................................................. 78% Done.
Install successful
Linking in progress (Tuesday, January 26, 2016 8:06:05 AM CST)
Link successful
Setup in progress (Tuesday, January 26, 2016 8:14:05 AM CST)
Setup successful
End of install phases.(Tuesday, January 26, 2016 8:15:14 AM CST)
WARNING:
The following configuration scripts need to be executed as the "root" user.
/orahome/app/oracle/product/11.2.0/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 '/orahome/app/oraInventory/logs/cloneActions2016-01-26_08-02-55AM.log' for more details.
用root执行脚本
Performing root user operation for Oracle 11g
The following environment variables are set as:
ORACLE_OWNER= oracle
ORACLE_HOME= /orahome/app/oracle/product/11.2.0/db_1
Copying dbhome to /usr/local/bin ...
Copying oraenv to /usr/local/bin ...
Copying coraenv to /usr/local/bin ...
Entries will be added to the /etc/oratab file as needed by
Database Configuration Assistant when a database is created
Finished running generic part of root script.
Now product-specific root actions will be performed.
# su - oracle
$ sqlplus -v
SQL*Plus: Release 11.2.0.4.0 Production
$ lsnrctl
LSNRCTL for IBM/AIX RISC System/6000: Version 11.2.0.4.0 - Production on 26-JAN-2016 08:29:26
Copyright (c) 1991, 2013, Oracle. All rights reserved.
Welcome to LSNRCTL, type "help" for information.
LSNRCTL> start
Starting /orahome/app/oracle/product/11.2.0/db_1/bin/tnslsnr: please wait...
TNSLSNR for IBM/AIX RISC System/6000: Version 11.2.0.4.0 - Production
System parameter file is /orahome/app/oracle/product/11.2.0/db_1/network/admin/listener.ora
Log messages written to /orahome/app/oracle/diag/tnslsnr/aix247/listener/alert/log.xml
Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=192.168.205.111)(PORT=1521)))
Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1521)))
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=192.168.205.111)(PORT=1521)))
STATUS of the LISTENER
------------------------
Alias LISTENER
Version TNSLSNR for IBM/AIX RISC System/6000: Version 11.2.0.4.0 - Production
Start Date 26-JAN-2016 08:29:37
Uptime 0 days 0 hr. 1 min. 19 sec
Trace Level off
Security ON: Local OS Authentication
SNMP OFF
Listener Parameter File /orahome/app/oracle/product/11.2.0/db_1/network/admin/listener.ora
Listener Log File /orahome/app/oracle/diag/tnslsnr/aix247/listener/alert/log.xml
Listening Endpoints Summary...
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=192.168.205.111)(PORT=1521)))
(DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1521)))
The listener supports no services
The command completed successfully
LSNRCTL> status
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=192.168.205.111)(PORT=1521)))
STATUS of the LISTENER
------------------------
Alias LISTENER
Version TNSLSNR for IBM/AIX RISC System/6000: Version 11.2.0.4.0 - Production
Start Date 26-JAN-2016 08:29:37
Uptime 0 days 0 hr. 1 min. 32 sec
Trace Level off
Security ON: Local OS Authentication
SNMP OFF
Listener Parameter File /orahome/app/oracle/product/11.2.0/db_1/network/admin/listener.ora
Listener Log File /orahome/app/oracle/diag/tnslsnr/aix247/listener/alert/log.xml
Listening Endpoints Summary...
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=192.168.205.111)(PORT=1521)))
(DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1521)))
The listener supports no services
The command completed successfully
来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/30491527/viewspace-1982842/,如需转载,请注明出处,否则将追究法律责任。
转载于:http://blog.itpub.net/30491527/viewspace-1982842/