Quantcast
Channel: Ludovico – DBA survival BLOG
Viewing all articles
Browse latest Browse all 119

Oracle SW_ONLY install leads to relink with rac_off at every attachHome

$
0
0

OK, I really do not know what other title I should use for this post.

I have developed and presented a few times my personal approach to Oracle Home provisioning and patching. You can read more in this series.

With this approach:

  • I install the software (either GI or RDBMS) with the option SW_ONLY once
  • I patch it to the last version
  • I create a golden image that I evolve for the rest of the release lifecycle

When I need to install it, I just unzip the golden image and attach it to the Central Inventory.

I have discovered quite longtime ago that, every time I was attaching the home to the inventory, the binaries were relinked with rac_off, disregarding the fact that the home that I zipped actually had RAC enabled. This is quite annoying at my work at CERN, as all our databases are RAC.

So my solution to the problem is to detect if the server is on a cluster, and relink on the fly:

### EARLIER, IN THE ENVIRONMENT SCRIPTS
if [ -f /etc/oracle/olr.loc ] ; then
        export CRS_EXISTS=1
else
        export CRS_EXISTS=0
fi

### LATER, AFTER ATTACHING THE ORACLE_HOME:
pushd $ORACLE_HOME/rdbms/lib
if [ $CRS_EXISTS -eq 1 ] ; then
	make -f ins_rdbms.mk rac_on
else
	make -f ins_rdbms.mk rac_off
fi
make -f ins_rdbms.mk ioracle

This is a simplified snippet of my actual code, but it gives the idea.

What causes the relink with rac_off?

I have discovered recently that the steps used by the runInstaller process to attach the Oracle Home are described in this file:

$ORACLE_HOME/inventory/make/makeorder.xml

and in my case, for all my golden images, it contains:

<ohmd:MAKE
MAKEPATH="/usr/bin/make" FILENAME="rdbms/lib/ins_rdbms.mk" >
<ohmd:TARGET ACTIONTYPE="INSTALL" TARGETNAME="rac_off" >
<ohmd:INPUT_LIST>
<ohmd:INPUT VAL="ORACLE_HOME=%ORACLE_HOME%"/>
</ohmd:INPUT_LIST>
<ohmd:COMP_LIST>
<ohmd:COMP NAME="oracle.rdbms" VERSION="18.0.0.0.0"/>
</ohmd:COMP_LIST>
</ohmd:TARGET>
</ohmd:MAKE>

So, it does not matter how I prepare my images: unless I change this file and put rac_on, the runInstaller keeps relinking with rac_off.

I have thought about changing the file, but then realized that I prefer to check and recompile at runtime, so I can reuse my images also for standalone servers (in case we need them).

Just to avoid surprises, it is convenient to check if a ORACLE_HOME is linked with RAC with this small function:

$ type isRACoh
isRACoh is a function
isRACoh ()
{
    OH2CHECK=${1:-$ORACLE_HOME};
    ar -t $OH2CHECK/rdbms/lib/libknlopt.a | grep --color=auto kcsm.o > /dev/null;
    if [ $? -eq 0 ]; then
        echo "Enabled";
    else
        echo "Disabled";
        false;
    fi
}

This is true especially for Grid Infrastructure golden images, as they have the very same behavior of RDBMS homes, with the exception that they might break out-of-place patching if RAC is not enabled: the second ASM instance will not mount because the first will be exclusively mounted without the RAC option.

 

HTH.

Ludovico


Viewing all articles
Browse latest Browse all 119

Trending Articles