Вы находитесь на странице: 1из 5

How to Clone an Oracle11g ASM and Database

home
Author Lokesh Krishnaswamy Oracle DBA Consultant

Document purpose
The purpose of this document is to explain cloning of an RAC RDBMS home in
Oracle11g R1. We at ran into a situation where we have to move the current homes for
the following purposes
1. With crs, asm and db all contributing the three times the regular binary size,
we had to come up with ways to clone the RAC homes, primarily to overcome
the 20Gb limitation of internal storage of the servers
2. Some of the Oracle11g R1 RAC bundles can double the size of the binaries
3. Have the ability to apply patches to the binaries much earlier than during
scheduled patch outage windows and switch the patched binaries during the
actual downtime if the patches cannot applied in a rolling fashion or perhaps if
the actual patching time takes longer for each node.

Introduction
The current environment we have is a 5 node cluster with Oracle11g R1 version 11.1.0.7
on Sun Sparc64 M5000 servers, with 32Gb memory and 16CPU. That’s lot of power!

First hurdle
Until Oracle9i, we had the luxury of just copying the binaries and using them. Starting
Oracle10g, we have to use the runInstaller but in Oracle11g, the significant change is, the
copy has to be done by the root user. Refere note: 559305.1. I did encounter some issues in
copying the links with the command suggested by oracle

cp –Rp /u00/app/oracle/product/11.1/asm /u01/app/oracle/product/11.1/asm

Instead I used the following as root and worked fantastic. Great many thanks to our unix admins
Bikram Singh and Mo Shafi.

Local:

tar -cf - asm | (cd /u01/app/oracle/product/11.1/;tar -xf - )

Register with Inventory : Did this for both asm and db home
cd $ORACLE_HOME/clone/bin
perl clone.pl ORACLE_HOME=”/u01/app/oracle/product/11.1/asm”
ORACLE_HOME_NAME=”OraASM11g_home2” ORACLE_BASE=”/u00/app/oracle”
Apply all the patches to the asm and db binaries. After application of patches on
one propagate the binaries to the remaining nodes in the cluster using the following
command.
remote:

tar -cf - db | ssh root@adcracdbq4 'cd /u01/app/oracle/product/11.1/;tar -xf - '

On each node perform the following to register the new binaries to be a valid
Oracle home

perl clone.pl ORACLE_HOME=”/u01/app/oracle/product/11.1/asm”


ORACLE_HOME_NAME=”OraASM11g_home2” ORACLE_BASE=”/u00/app/oracle”

OCR Changes

Change ASM Home

Identify the current location for asm OCR

[oracle@adcracdbp4] srvctl config asm -n adcracdbp4


+ASM1 /u00/app/oracle/product/11.1/asm

Change ASM home to new home


[oracle@adcracdbp4] srvctl modify asm –n adcracdbp4 –o /u01/app/oracle/product/11.1/asm
[oracle@adcracdbp4] srvctl modify asm –n adcracdbp5 –o /u01/app/oracle/product/11.1/asm

[oracle@adcracdbp4] srvctl modify asm –n adcracdbp6 –o /u01/app/oracle/product/11.1/asm

[oracle@adcracdbp4] srvctl modify asm –n adcracdbp7 –o /u01/app/oracle/product/11.1/asm

[oracle@adcracdbp4] srvctl modify asm –n adcracdbp8 –o /u01/app/oracle/product/11.1/asm

Validate changes

[oracle@adcracdbp4] srvctl config asm -n adcracdbp4


+ASM1 /u01/app/oracle/product/11.1/asm
[oracle@adcracdbp4] srvctl config asm -n adcracdbp5
+ASM1 /u01/app/oracle/product/11.1/asm
[oracle@adcracdbp4] srvctl config asm -n adcracdbp6
+ASM1 /u01/app/oracle/product/11.1/asm
[oracle@adcracdbp4] srvctl config asm -n adcracdbp7
+ASM1 /u01/app/oracle/product/11.1/asm
[oracle@adcracdbp4] srvctl config asm -n adcracdbp8
+ASM1 /u01/app/oracle/product/11.1/asm
Change DB Home

Identify the current location for database in OCR

[oracle@adcracdbp4] srvctl config database -d GHMP -a


adcracdbp5 GHMP2 /u00/app/oracle/product/11.1/db
adcracdbp4 GHMP1 /u00/app/oracle/product/11.1/db
adcracdbp6 GHMP3 /u00/app/oracle/product/11.1/db
adcracdbp7 GHMP6 /u00/app/oracle/product/11.1/db
adcracdbp8 GHMP5 /u00/app/oracle/product/11.1/db
DB_UNIQUE_NAME: GHMP
DB_NAME: GHMP
ORACLE_HOME: /u00/app/oracle/product/11.1/db
SPFILE: +GHMP_DATA/GHMP/spfileGHMP.ora
DOMAIN: null
DB_ROLE: null
START_OPTIONS: null
POLICY: AUTOMATIC
ENABLE FLAG: DB ENABLED

Let us change the homes to the new homes


[oracle@adcracdbp4] srvctl modify database –d GHMP –o /u01/app/oracle/product/11.1/db –s open

Validate changes

[oracle@adcracdbp4] srvctl config database -d GHMP -a


adcracdbp5 GHMP2 /u01/app/oracle/product/11.1/db
adcracdbp4 GHMP1 /u01/app/oracle/product/11.1/db
adcracdbp6 GHMP3 /u01/app/oracle/product/11.1/db
adcracdbp7 GHMP6 /u01/app/oracle/product/11.1/db
adcracdbp8 GHMP5 /u01/app/oracle/product/11.1/db
DB_UNIQUE_NAME: GHMP
DB_NAME: GHMP
ORACLE_HOME: /u01/app/oracle/product/11.1/db
SPFILE: +GHMP_DATA/GHMP/spfileGHMP.ora
DOMAIN: null
DB_ROLE: null
START_OPTIONS: open
POLICY: AUTOMATIC
ENABLE FLAG: DB ENABLED

Change Database Listener Home

srvctl modify listener -n adcracdbp4 -o /u01/app/oracle/product/11.1/asm -l


"LISTENER_ADCRACDBP4"
srvctl modify listener -n adcracdbp5 -o /u01/app/oracle/product/11.1/asm -l
"LISTENER_ADCRACDBP5"
srvctl modify listener -n adcracdbp6 -o /u01/app/oracle/product/11.1/asm -l
"LISTENER_ADCRACDBP6"
srvctl modify listener -n adcracdbp7 -o /u01/app/oracle/product/11.1/asm -l
"LISTENER_ADCRACDBP7"
srvctl modify listener -n adcracdbp8 -o /u01/app/oracle/product/11.1/asm -l
"LISTENER_ADCRACDBP8"

Change log file directory for Listener

Change TNS_ADMIN directory location in .profile to point to the correct TNS_ADMIN


directory. It is /u01/app/oracle/product/11.1/asm/network/admin in this situation. This has to be
done on all the nodes.

cd $TNS_ADMIN
vi listener.ora
include the following on each node in the listener.ora file
ADR_BASE_LISTENER_<nodename>=/u01/app/oracle
eg
ADR_BASE_LISTENER_ADCRACDBP4=/u01/app/oracle

[oracle@adcracdbp4] srvctl setenv database –d GHQ –t


“TNS_ADMIN=/u01/app/oracle/product/11.1/asm/network/admin”

srvctl setenv nodeapps –n adcracdbq3 –t


“TNS_ADMIN=/u01/app/oracle/product/11.1/asm/network/admin”

The above srvctl commands have to be run for all the databases and nodes if needed.

Change the entries in listener.ora for the oracle home


LISTENER_ADCRACDBP4 =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = adcracdbP4-racvip)(PORT = 1521)(IP =
FIRST))
# (ADDRESS = (PROTOCOL = TCP)(HOST = 10.163.64.93)(PORT = 1521)(IP = FIRST))
(ADDRESS = (PROTOCOL = TCP)(HOST = 10.163.254.93)(PORT = 1521)(IP = FIRST))
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC))
)
)

SID_LIST_LISTENER_ADCRACDBP4 =
(SID_LIST =
(SID_DESC =
(SID_NAME = PLSExtProc)
(ORACLE_HOME = /u01/app/oracle/product/11.1/asm)
(PROGRAM = extproc)
(ENVS =
"EXTPROC_DLLS=ANY,LD_LIBRARY_PATH=/u01/app/oracle/product/11.1/asm/lib:/usr/lib
:/apps/nubridge/xp_nuencryption_
ora_solaris/2.7/lib:/usr/sfw/lib/64,PCI_CONFIG_PATH=/apps/nubridge/resources,NU_LOGGI
NG_CFG=/apps/nubridge/xp_nuencryption_or
a_solaris/2.7/config/samples/logging.cfg,LOGNAME=oracle")
)
)

Further to the changes above, the backup scripts and other scripts running from crontab should
also be changed.
For further questions, you can email me anytime at lokesh.krishnaswamy@ihg.com or
lokesh@avidts.com.