orawin.info

Niall's Oracle Pages – Oracle Opinion since 2004

Archive for July, 2011

In Praise of Clones

with 5 comments

I’m all alone, so are we all
We’re all clones
All are one and one are all

~ Alice Cooper

Two separate discussions, one at work and one around the virtual OakTable , have made me aware that maybe not as many Oracle professionals as I imagined are aware that Oracle provides a facility to clone Oracle Software homes, either to a new home on the same machine, or to a new home on a brand new machine with the same build. This process is far quicker than the graphical installation routine, or even than a straightforward silent install using OUI. It also lends itself very neatly to quickly provisioning identical builds of database servers. I thought therefore I’d jot down my notes on how I recently did just that for a data guard demo environment.

Servers Involved

I had 2 servers involved here, their setup is as follows:

Purpose Server Physical IP Address SID
Primary Server DB11-2-NODE1 192.168.56.11/24 db11gr2
Standby Server DB11-2-NODE2 192.168.56.11/24 db11g_stdby

The servers are both running my favourite RHEL clone CentOS, in this case the Release 5.6.

Initial Setup

After installing the O/S, updating the kernel for security patches I installed the following products in /u01/app/oracle/product/11.2.0/dbhome_1 on node1.

  • Oracle Database 11.2.0.2
  • Oracle July PSU (12419331 )

The above process took approximately 2 hours including media download and basic server documentation.

Gold Image

At this point I could have simply repeated the process on node 2. However cloning is much easier and repeatable.  First I made a Gold Image by running the following as root on node 1. /media/dsl/database/linux/11.2 is a mount point containing my gold images.

cd /u01/app/oracle/product/11.2.0/dbhome_1
tar -cpvzf /media/dsl/database/linux/11.2/db112023.tgz .

Cloning

On the second machine I also mounted my DSL as above and then ran the following script

./installOracle.sh /media/dsl/database/linux/11.2/db112023.tgz /u01/app/oracle/product/11.1.0/dbhome_1 /u01/app/oracle OracleHome1

where installOracle.sh reads as follows

#!/usr/bin/ksh
#
# Install gold image of Oracle using clone home functionality of OUI.
#
# Expects parameters <name of image> <install_loc> <Oracle Home Name>
# Assumes Pre-Reqs are met -- TODO add pre-req fixing
# assumes unzip installed
#
if [[ $# -ne 4 ]]; then
 echo "Usage : installOracle.sh imageName instLoc oracle_base HomeName";
 echo " : eg installOracle.sh /media/dbhome111.tgz /u01/app/oracle/product/11.1.0/db_1 /u01/app/oracle OracleHome11g"
 exit 1;
fi

IMAGE=$1
INSTLOC=$2
ORABASE=$3
HOMENAME=$4

echo "Making Oracle Home Directory"
mkdir -p ${INSTLOC}
chown -R oracle:oinstall ${ORABASE}
cd ${INSTLOC}
echo "Extracting Archive at $(date +%Y%M%d%m)"
tar -xvzf ${IMAGE}
cd clone/bin
echo "Cloning Home........."
sudo -u oracle perl clone.pl ORACLE_HOME="${INSTLOC}" ORACLE_HOME_NAME="${HOMENAME}" ORACLE_BASE="${ORABASE}" -ignoreSysPrereqs
${INSTLOC}/root.sh
echo "Install Finished at $(date +%Y%M%d%m)"
echo "Please run any non root.sh scripts as instructed above. root.sh has been run"

This code has to be run as root. It does the following

  • creates the home directory
  • extracts the gold image from the tarball
  • runs a perl script as the oracle user
  • runs root.sh

This script completed in less than 10 minutes on an identical virtual machine to the one that had taken 2 hours to perform the complete install and patching process.

Metalink Reference : How to clone an Oracle Database Home using OUI 

Possibly Related Posts:

  • No Related Posts found

Written by Niall Litchfield

July 27th, 2011 at 3:20 pm

Posted in Uncategorized

Tagged with , ,

Another World XI

with one comment

In celebration of Test Match 2000 (where surely Sachin Tendulkar is due to complete his century of centuries – albeit in a losing cause :) ) The ICC have a new poll looking for an all time XI. You have til midnight tonight to complete it Mine is the same as the World XI I put together, with the inclusion of Sobers as a mandatory all rounder.

Possibly Related Posts:

Written by Niall Litchfield

July 13th, 2011 at 10:49 am

Posted in Uncategorized

Tagged with

Operating System Interaction

without comments

The excellent Madrid from the otn forums has a nice post here on a particular listener error caused by not following the install instructions precisely. I thought that I’d dig in a little further to illustrate the interplay between the O/S and our wonderful C program that is oracle.exe

The message Hector got was

Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=echo.world)(PORT=15
21)))
TNS-12535: TNS:operation timed out
TNS-12560: TNS:protocol adapter error
TNS-00505: Operation timed out
32-bit Windows Error: 60: Unknown error

 

what has happened here is that our program (oracle.exe) has made an o/s call and got an o/s error message that it doesn’t know about. That doesn’t mean that the code is undocumented though. You can find the Windows system error codes at this useful page on MSDN. Here you will find that error 60 means

ERROR_BAD_REM_ADAP – The adaptor is not capable.

Which is a pretty clear indication that there is a network adapter issue. What is slightly more surprising is the error message shown in the trace file. The relevant output is


2011-07-05 15:09:59.249389 : nsc2addr:(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=echo.oracle.com)(PORT=1521)))
2011-07-05 15:09:59.249561 : snlinGetAddrInfo:getaddrinfo() failed with error 11001

The initial line is the Oracle Net  function to extract a host address from the net service name the second line is the actual failure, However the return code 11001 corresponds to a windows socket error in name resolution

The main point to make here is that where Oracle calls os functions and gets unexpected results, then it maybe time to dig into the os calls. MSDN is a great resource for this as is the Windows Internals book.

 

 

Possibly Related Posts:

Written by Niall Litchfield

July 7th, 2011 at 2:57 pm

Posted in Uncategorized

Tagged with , ,