Friday, September 10, 2010

Creating Oracle Inventory

Oracle inventory could be created with runInstaller -attachHome option. Unlike the cloning process which includes creation of oracle inventory as well as relinking all libraries this only creates an inventory. Libraries must be manually relinked with relink -all option if have to. This option is prefered when inventory is damaged as it doesn't requires any relinking.

This method is also useful When copying an oracle home to a new server which doesn't have an oracle inventory but manual relinking of libraries is needed afterwards.

1. tar the source binaries
tar --exclude=excludeList -cvzf 10g2.tgz /opt/app/oracle/product/10.2.0/ent
Exclude log files, EM console related files in OC4J

2. Extract the tar file at the destination.

3. Set Oracle Base and Oracle Home variables, it is not necessary, if Oracle Base is not set and no oraInst.loc file exists oraInventory will be created in /home/oracle
export ORACLE_BASE=/opt/app/oracle
export ORACLE_HOME=`pwd`
export ORACLE_HOME=/opt/app/oracle/product/10.2.0/ent
cd $ORACLE_HOME/oui/bin/

./runInstaller -silent -attachHome ORACLE_HOME=$ORACLE_HOME ORACLE_HOME_NAME="10ghome"
Starting Oracle Universal Installer...

No pre-requisite checks found in oraparam.ini, no system pre-requisite checks will be executed.
OiiolLogger.addFileHandler:Error while adding file handler - /opt/app/oraInventory/logs/AttachHome2010-09-08_02-40-58PM.log
java.io.FileNotFoundException: /opt/app/oraInventory/logs/AttachHome2010-09-08_02-40-58PM.log (No such file or directory)
'AttachHome' failed.
As seen from above output runInstaller doesn't creates the oraInventory inside the oracle base directorywhich is the default location when installing 10g. (Oracle binaries used here have been patched to 10.2.0.5).

4. To fix this problem create the oraInventory manually
mkdir -p /opt/app/oraInventory/
chown oracle:oinstall oraInventory
chmod 770 oraInventory
5. Run the command again
./runInstaller -silent -attachHome ORACLE_HOME=$ORACLE_HOME ORACLE_HOME_NAME="10ghome"
Starting Oracle Universal Installer...

No pre-requisite checks found in oraparam.ini, no system pre-requisite checks will be executed.
The inventory pointer is located at /etc/oraInst.loc
The inventory is located at /opt/app/oraInventory
Please execute the '/opt/app/oraInventory/orainstRoot.sh' script at the end of the session.
'AttachHome' was successful.

/opt/app/oraInventory/orainstRoot.sh
Changing permissions of /opt/app/oraInventory to 770.
Changing groupname of /opt/app/oraInventory to oinstall.
The execution of the script is complete
This would have created the necessary files inside the oraInventory, added the oracle home to inventory and oraInst.loc file in /etc.

5. Use relink -all to relink the oracle binaries.