John’s Oracle Experiences

My everyday experiences with Oracle products

Archive for January, 2009

Oracle Identity Management Grid Control Plug-in Repository Assistant Failed

Posted by John Paul van Helvoort on January 26, 2009

While installing the Oracle Identity Management Grid Controle Plug-in as an add-on to your Enterprise Manager Grid Control, I ran into an error straight away. This happend to me before but i couldn’t remember what caused this behaviour. As the installer guides you through the installation process clearly, at some point you select your “/u00/oracle/product/10.2.0/oms10g” as ORACLE_HOME to be upgraded. After a successful installation, it automatically proceed to repository assistant configuration and it fails there shown this error:

Command = oracle.sysman.emcp.oms.IMRepositoryPatchUpgrade -verbose 

Setting configuration environment variables ...
INFO: Starting to execute configuration assistants
INFO: Command = oracle.sysman.emcp.oms.IMRepositoryPatchUpgrade -verbose
Command = oracle.sysman.emcp.oms.IMRepositoryPatchUpgrade has failed
Exception : java.lang.Exception:
Command: /u00/oracle/product/10.2.0/oms10g/sysman/admin/emdrep/bin/RepManager em.backbone.local 1521 emrep -action upgrade -verbose -repos_user sysman failed.
Exit code: expected [0 43 45 ], but got 2
INFO: Configuration assistant "IMGC Repository Assistant" failed
INFO: The "/u00/oracle/product/10.2.0/oms10g/cfgtoollogs/configToolFailedCommands" script contains all commands that failed, were skipped or were cancelled.
This file may be used to run these configuration assistants outside of OUI. Note that you may have to update this script with passwords (if any) before executing the same.
-----------------------------------------------------------------------------

As it turned out the RepManager has a problem when the correct ORACLE_HOME is not set while starting the runInstaller process. This is offcource the right setting to have, but as you select the ORACLE_HOME during the installation process, you might overlook this stupid mistake in the start.

To overcome this you need to stop the installer and set your ORACLE_HOME to point to the correct one , being the oms10g ORACLE_HOME.
After this start the installer and remove an earlier attempt by removing the plug-in from the “Installated Products”. When done so you are ready to try your luck again !

Here you can download this great plugin :
http://www.oracle.com/technology/software/products/ias/htdocs/101401.html

Posted in Grid Control, Identity Manager | Leave a Comment »

Oracle Portal “The XML page cannot be displayed” After using SSLConfigTool

Posted by John Paul van Helvoort on January 22, 2009

When using SSLConfigTool to reconfigure a HTTP portal ( 10.1.4 ) to listen to your external HTTPS adres. You might run into this error while requesting your default welcome page in portal. In my case i like to have 2 seperate external names for portal to listen too.

So here is what i did :

Create a file for each external adres to be configured by SSLConfigTool.
Under “/home/oracle/scripts/” i created a file “portal.it-eye.nl.cfg” for one of the external adresses “portal.it-eye.nl” which look like this;

<SSLConfig>
  <mid_tier>
    <virtual_address ssl="on" host="portal.it-eye.nl" port="443" inv_port="9401" ssl_terminate="lbr"/>
    <lbr loopback_port="7778"/>
    <wc/>
    <ohs>
      <servers>
        <server host="portal.iteye.local" port="7779" />
      </servers>
    </ohs>
  </mid_tier>
</SSLConfig>

Loopback_port ( 7778) = Webcache port which portal is using
Server port (7779) = http server port which portal is using
Inv_port ( 9401) = invalidation port which portal is using
( All these ports van be found from your AS console, under ports )
Virtual address port (443) = external port for .nl / testmijn.das.nl

You can then process this file by running the SSLConfigTool like :

[oracle@portal bin]$ ./SSLConfigTool -config_w_file /home/oracle/scripts/portal.it-eye.nl.cfg -ptl_inv_pwd <orcladmin_password>  -opwd <orcladmin_password>

After running the SSLConfigTool for both external addresses. I was not able to reach one of the external address, as this would result in the following error “The XML page cannot be displayed”.

As of this point i was not sure where to find the solution for this strange error. While checking the webcache configuration i found one external address missing here. I was sure this would be taken care of by the SSLConfigTool as this step was succesfully processed as shown in the configuration log.

After manually adding this entry i was able to reach my default welcome page in portal again.
(https://portal.it-eye.nl/portal/page/portal/TOPLEVELSITE/Welcome)

Background information on this is that the Oracle Portal was not configured correctly using webcache and therefor not responding in the correct way.

Since Portal 10.1.4 relies on ESI technology, the response from the OHS Port is an XML file which is displayed
as-is in the browser. If this XML was correctly accessed thru WebCache, then WebCache would have processed the XML to return a Portal page.

Posted in Application Server | Leave a Comment »

To associate a Management Agent with a new Management Service

Posted by John Paul van Helvoort on January 21, 2009

As the situation could rise where you want to re-install your enterprise grid control server on a new server.
You want to have an easy way to migratie the agent reporting to it aswell.
After some searching on metalink i could preform the following steps to make this work.

$ORACLE_HOME/bin/emctl stop agent

[agent] xxx:bin> ./emctl stop agent
Oracle Enterprise Manager 10g Release 3 Grid Control 10.2.0.3.0.
Copyright (c) 1996, 2007 Oracle Corporation. All rights reserved.
Stopping agent … stopped.

Edit the Agent’s $ORACLE_HOME/sysman/config/emd.properties file

Change the REPOSITORY_URL
REPOSITORY_URL=https://zzz:1159/em/upload
To
REPOSITORY_URL=http://yyy:1159/em/upload

( !!Change HTTPS://….. to HTTP (non-secure)!!)

Change emdWalletSrcUrl
emdWalletSrcUrl=https://zzz:4889/em/wallets/emd
To
emdWalletSrcUrl=http://yyy:4889/em/wallets/emd

(!!Change HTTPS to HTTP (non-secure)!!)

rm -r $ORACLE_HOME/sysman/emd/state/*
rm -r $ORACLE_HOME/sysman/emd/collection/*
rm -r $ORACLE_HOME/sysman/emd/upload/*
rm $ORACLE_HOME/sysman/emd/lastupld.xml
rm $ORACLE_HOME/sysman/emd/agntstmp.txt
rm $ORACLE_HOME/sysman/emd/blackouts.xml
rm $ORACLE_HOME/sysman/emd/protocol.ini

$ORACLE_HOME/bin/emctl clearstate agent

[agent] xxx:bin> ./emctl clearstate agent
Oracle Enterprise Manager 10g Release 3 Grid Control 10.2.0.3.0.
Copyright (c) 1996, 2007 Oracle Corporation. All rights reserved.
EMD clearstate completed successfully

$ORACLE_HOME/bin/emctl secure agent

[agent] xxx:bin> ./emctl secure agent
Oracle Enterprise Manager 10g Release 3 Grid Control 10.2.0.3.0.
Copyright (c) 1996, 2007 Oracle Corporation. All rights reserved.
Enter Agent Registration password :
Agent is already stopped… Done.
Securing agent… Started.
Requesting an HTTPS Upload URL from the OMS… Done.
Requesting an Oracle Wallet and Agent Key from the OMS… Done.
Check if HTTPS Upload URL is accessible from the agent… Done.
Configuring Agent for HTTPS in CENTRAL_AGENT mode… Done.
EMD_URL set in /u00/oracle/product/10.2.0/agent/sysman/config/emd.properties
Securing agent… Successful.

$ORACLE_HOME/bin/emctl start agent

[agent] xxx:bin> ./emctl start agent
Oracle Enterprise Manager 10g Release 3 Grid Control 10.2.0.3.0.
Copyright (c) 1996, 2007 Oracle Corporation. All rights reserved.
Starting agent ……………. started.

$ORACLE_HOME/bin/emctl upload agent

[agent] xxx:bin> ./emctl upload agent
Oracle Enterprise Manager 10g Release 3 Grid Control 10.2.0.3.0.
Copyright (c) 1996, 2007 Oracle Corporation. All rights reserved.
—————————————————————
EMD upload completed successfully

After these steps it will take a little while for the new OMS to process this information and show the newly added host and targets.

Posted in Grid Control | 2 Comments »

OPatch cannot find the required command ‘fuser’ from Property file and your PATH

Posted by John Paul van Helvoort on January 20, 2009

As the Error shows a fairly good reason why the OPatch can’t proceed installing. To solve this still can take some time when you don’t know the exact place OPatch is searching for this file.
The reason why fuser is used by OPatch is to check if there is any running instance from the current ORACLE_HOME.

I ran into this stupid error while updating an Enterpise Manager Grid Control 10.2.0.1 to 10.2.0.4 on SuSE Enterprise Server 10 SP2 32bit.
When preforming this upgrade, you need to OPatch the database ORACLE_HOME with an one-off patch 4329444.

This is the error returned :

oracle@xxx:/u04/patch_10204/4329444> /u00/oracle/product/10.2.0/db10g/OPatch/opatch apply
Invoking OPatch 10.2.0.1.0

Oracle interim Patch Installer version 10.2.0.1.0
Copyright (c) 2005, Oracle Corporation.  All rights reserved..

Oracle Home       : /u00/oracle/product/10.2.0/db10g
Central Inventory : /u00/oracle/oraInventory
   from           : /u00/oracle/product/10.2.0/db10g/oraInst.loc
OPatch version    : 10.2.0.1.0
OUI version       : 10.2.0.1.0
OUI location      : /u00/oracle/product/10.2.0/db10g/oui
Log file location : /u00/oracle/product/10.2.0/db10g/cfgtoollogs/opatch/opatch-2009_Jan_19_13-15-31-CET_Mon.log

Apply Session failed: OPatch cannot find the required command 'fuser' from Property file and your PATH.
Property file = 'properties'
PATH = 'null'

System intact, OPatch will not attempt to restore the system

OPatch failed with error code 73

In search of Oracle’s recommendations on this topic, i came across this documentation :

OPatch cannot find system commands like fuser, make

Cause: The OPatch utility uses fuser on UNIX systems to check for active Oracle instances. On certain hp-ux systems, only a super-user can run fuser.

Action: Do the following steps to resolve this problem:
Set /tmp in your PATH.

For more information refer to section “Check for System Commands”.

Create an empty file named fuser.
Shut down the Oracle instances.
Run the OPatch utility.

( reference : http://docs.huihoo.com/oracle/docs/B19306_01/em.102/b16227/oui8_opatch.htm#BABJAAIB )

When this did not solve the problem, i found a solution for the problem by creating a symbolic link on my system.
( this has to be done as the root user )

xxx:/ # ln -s /bin/fuser /sbin/fuser

Now i tried my command again with succes !

oracle@xxx:/u04/patch_10204/4329444> /u00/oracle/product/10.2.0/db10g/OPatch/opatch apply
Invoking OPatch 10.2.0.1.0

Oracle interim Patch Installer version 10.2.0.1.0
Copyright (c) 2005, Oracle Corporation.  All rights reserved..

Oracle Home       : /u00/oracle/product/10.2.0/db10g
Central Inventory : /u00/oracle/oraInventory
   from           : /u00/oracle/product/10.2.0/db10g/oraInst.loc
OPatch version    : 10.2.0.1.0
OUI version       : 10.2.0.1.0
OUI location      : /u00/oracle/product/10.2.0/db10g/oui
Log file location : /u00/oracle/product/10.2.0/db10g/cfgtoollogs/opatch/opatch-2009_Jan_19_13-16-39-CET_Mon.log

ApplySession applying interim patch '4329444' to OH '/u00/oracle/product/10.2.0/db10g'
Invoking fuser to check for active processes.
Invoking fuser on "/u00/oracle/product/10.2.0/db10g/bin/oracle"

OPatch detected non-cluster Oracle Home from the inventory and will patch the local system only.

Please shutdown Oracle instances running out of this ORACLE_HOME on the local system.
(Oracle Home = '/u00/oracle/product/10.2.0/db10g')

Is the local system ready for patching?

Do you want to proceed? [y|n]

Posted in Application Server, Database, Linux | Leave a Comment »

Can’t delete oci.dll from an old ORACLE_HOME

Posted by John Paul van Helvoort on January 20, 2009

While removing and reinstalling a Management agent. I ran into the problem where after a successful uninstall using The Oracle Universal Installer. I was not able to remove the almost empty directory saying the file oci.dll is still in use, so an Access Denied error is displayed.

After a restart the same problem presented itself over and over again.

After some research i found that stopping the “Distributed Transaction Coordinator” service before deleting the old directory ( with oci.dll in it ) will help. After that the service can be started again offcourse.

Background information on the service:

The Distributed Transaction Coordinator (MSDTC) service is a component of modern versions of Microsoft Windows that is responsible for coordinating transactions that span multiple resource managers, such as databases, message queues, and file systems. MSDTC is included in Windows 2000 and later operating systems, and is also available for Windows NT 4.0.

MSDTC performs the transaction coordination role for components, usually with COM and .NET architectures. In MSDTC terminology, the director is called the transaction manager.

Posted in Application Server | Leave a Comment »

Easy (Apache) logfile clean-up script

Posted by John Paul van Helvoort on January 19, 2009

Here is a script to cleanup Apache logfiles which exceed 100 Megabytes.
This script was originally created to prevent the logfiles to grow over 2 Gigabytes as this would
crash the Apache server process. As it turned out this script can be used in many cases to control the growth of logfiles.

A report is send as a confirmation of the cleaned logfile which looks like this :

----------------------------------------------------------------
Checking Logfiles Apache in : /var/log/apache2 on web
Files with size : 100000 Kb are cleared
----------------------------------------------------------------
CLEANING : /var/log/apache2/web_ssl_access.log
----------------------------------------------------------------

Here is the actual script :

#!/bin/sh
#####################################################################################################
#
# Check Logfiles script for Apache server
# John Paul van Helvoort
#
#####################################################################################################
export PATH=/usr/local/bin:/usr/bin:/bin
HOSTNAME=`uname -a | cut -f2 -d" "`
DAY=`date "+%A"`
APACHEPATH=/var/log/apache2
MAILADRES=sys@backbone.local
SIZE=100000

mail_output() {
 /usr/bin/mailx -s "Check Apache Logfile on $HOSTNAME" $MAILADRES < $APACHEPATH\logging.log
}

clean_logging() {
 > $APACHEPATH\logging.log
}

for LOG in `find $APACHEPATH -name "*.log" -size +$SIZE -exec ls {} ';'`
  do
  clean_logging
  if [ "$LOG" != "" ]; then
    echo "---------------------------------------------------------------- "    >> $APACHEPATH\logging.log
    echo "Checking Logfiles Apache in : $APACHEPATH on $HOSTNAME            "    >> $APACHEPATH\logging.log
    echo "Files with size : $SIZE Kb are cleared                           "    >> $APACHEPATH\logging.log
    echo "---------------------------------------------------------------- "    >> $APACHEPATH\logging.log
    echo CLEANING : $LOG  >> $APACHEPATH\logging.log
    echo CLEANING : $LOG
    > $LOG
  fi
  echo "---------------------------------------------------------------- "  >> $APACHEPATH\logging.log
  mail_output
done

Posted in Application Server | Leave a Comment »

Synchronization from a relational database to Oracle Internet Directory

Posted by John Paul van Helvoort on January 14, 2009

In order to be able to sync from a relational database to an Oracle Internet Directory ( 10.1.2.0.2 ). We need to create our own Custom sync profile.
This profile will have to select the information we want to store in our OID plus it has to map these values to an entry in our OID.
The information we want to import can be selected in the configuration file ( in our case CUSTOMDB_OID.cfg ) while the mapping can be made threw the mapping file ( in our case CUSTOMDB_OID.map ). The integration server uses profiles which holds configuration and mappings.

To create your very own CUSTOMDB sync profile you can use these example files

CUSTOMDB_OID.properties – profile settings
CUSTOMDB_OID.cfg - configuration file
CUSTOMDB_OID.map - mapping file

CUSTOMDB_OID.properties

odip.profile.name = CUSTOMDB
odip.profile.status = DISABLE
odip.profile.syncmode = IMPORT
odip.profile.retry = 5
odip.profile.schedinterval = 60
odip.profile.condirurl = db01.backbone.local:1521:APPSDB
odip.profile.condiraccount = operator
odip.profile.condirpassword = *******
odip.profile.interface = DB
odip.profile.configfile = /u00/oracle/product/10.1.2/idm/ldap/odi/conf/CUSTOMDB_OID.cfg
odip.profile.mapfile = /u00/oracle/product/10.1.2/idm/ldap/odi/conf/CUSTOMDB_OID.map
odip.profile.lastchgnum = 0
odip.profile.debuglevel = 63

CUSTOMDB_OID.cfg

[DBQUERY
select:
ID,
EMAILADDRESS,
NAME,
TO_CHAR(LAST_UPDATE,'YYYYMMDDHH24MISS') CHANGEDATE
from
APPSUSERS
WHERE
LAST_UPDATE&amp;gt;TO_DATE (:CHANGEDATE,'YYYYMMDDHH24MISS')
ORDER BY
LAST_UPDATE

[SYNC-PARAMS]
CHANGEKEYATTRS:CHANGEDATE
[INTERFACEDETAILS]
SKIPERRORTOSYNCNEXTCHANGE: TRUE

CUSTOMDB_OID.map

DomainRules
NONLDAP:cn=users,dc=backbone,dc=local:cn=%,cn=users,dc=backbone,dc=local
AttributeRules
ID:1: : :cn: :person
ID: : : :cn: :orcluserv2
ID: : : :cn: :organizationalPerson
NAME: : : :sn: :person
EMAILADDRESS: : : :mail: :inetOrgperson
EMAILADDRESS: : : :uid: :inetOrgperson

And preform the following statement to load your own config in Oracle Internet Directory;

$ORACLE_HOME/bin/dipassistant createprofile -host idm01.backbone.local -port 389 -w &amp;lt;password&amp;gt; -configset 1 –file CUSTOMDB_OID.properties

We now have created a sync profile which uses the CHANGEDATE field in the relational database to determine if a row is changed and therefor needs to be resync or not.
This is a basic setup to use for a more complex import using more fields and mappings.

More information on the topic can be found here

Posted in Identity Manager | Leave a Comment »

Errordocument fails to intercept internal 500 error

Posted by John Paul van Helvoort on January 13, 2009

When using your SSO server as a first login page for external users. You might want to catch ugly 401,404,500 errors and redirect it to a nice page so that the users are presented with a more meaningful message.

While testing with an 10.1.4.2.0 infrastructure i am able to do this by using the
standard ErrorDocument 500 … feature of Apache HTTP_Server. ( No extra configuration files needed or to be adjusted )
When i try to configure the same settings on a 10.1.2.0.2 infrastructure the error page 500 is not caught although other errors like 404 and 401 work. After searching Metalink i could find a couple of suggestions which should address this issue. Unfortunally this did not resolve my issue.

What i did to make it work on the 10.1.2.0.2 infrastructure is :
I’ve edited the dads.conf file and added the line, just before any Plsql… entry;

PlsqlErrorStyle ApacheStyle

I’ve edited the mod_oc4j.conf file and added the line , just above the Oc4jmount;

Oc4jUseOHSErrors on

The httpd.conf contains :

ErrorDocument 500 /error-pages/500.html
ErrorDocument 404 /error-pages/404.html
ErrorDocument 401 /error-pages/401.html

The directory and files are available under $ORACLE_HOME\Apache\Apache\htdocs\

Just to be clear, this config works on a 10.1.4 infra but not on a 10.1.2 infra.
the URL used to reproduce this is : http://testserver:7777/pls/orasso/orasso.wwsso_app_admin.ls_login?

After a long search and evaluation of the problem it seems to be neccessary to apply a patch on my 10.1.2.0.2 Application Server.

Inorder for custom messages configured via the ErrorDocument directive to apply to requests that have been service via the MOD_OC4J component, it is necessary to set the following entry in the mod_oc4j.conf file:

Oc4jUseOHSErrors on

But, users of Application Server 10.1.2 releases prior to 10.1.2.2, should upgrade to 10.1.2.2 or later to address the following bug:
Bug 4331689 MOD_OC4J “OC4JUSEOHSERRORS” DIRECTIVE NOT WORKING

After upgrading to this 10.1.2.2.0 i was able to catch the 500 message and replace it with my custom message.

Also turn of “Show friendly HTTP error messages” in your IE browser as it interfears with displaying plain errors.
When dealing with external users where you have no controle on the option being checked or not, made sure your custom error page is larger than 512 Kb.
When doing so “Show Friendly Messages” will not be activated and show your custom page as you like it to be shown.

Posted in Application Server | 3 Comments »

Switch Stand-by database to Primary Database role

Posted by John Paul van Helvoort on January 12, 2009

Not long ago i had to switch a standby database to a primary database role. This was necessary when the primary database was lost as a result of disk corruption.
Luckily we setup a standby database to overcome this tragedy and as it seemed , this can be done in just 2 steps.

The statements i used to switch this standby database to a primary database are

First get your standby database to understand it should stop recovering by archives.

SQL> ALTER DATABASE RECOVER MANAGED STANDBY DATABASE FINISH;

( with stand-by redologs )

SQL> ALTER DATABASE RECOVER MANAGED STANDBY DATABASE FINISH SKIP STANDBY LOGFILE;

( without stand-by redologs )

Now to make the actual switch :

SQL> ALTER DATABASE COMMIT TO SWITCHOVER TO PRIMARY;

After this , you cannot use this database as a stand-by database anymore.
You will need to create a new standby database as a replica of this new primary database.

Posted in Database | Leave a Comment »

Start and Stop scripts for your Oracle environment

Posted by John Paul van Helvoort on January 8, 2009

Whenever i am asked to implement start and stop scripts for an Oracle environment. I use these good old scripts to support the need for most systems.
These scripts use profiles for every ORACLE_HOME and ORACLE_SID.
Beside the start and stop purpose , they can also be used to just “set” the Oracle environment right for whatever you like to do.

So here is what i do;
First i create the profile files for every environment :

Environment file for an infrastrcuture DATABASE , profile_SID

PATH=/home/oracle/bin:/usr/local/bin:/usr/bin:/usr/X11R6/bin:/bin:/usr/games:/opt/gnome/bin:/opt/kde3/bin       ; export PATH
ORACLE_HOME=/u00/app/oracle/product/10.1.4/idm                                                                  ; export ORACLE_HOME
ORACLE_SID=SID                                                                                                  ; export ORACLE_SID
PATH=$ORACLE_HOME/bin:$PATH                                                                                     ; export PATH
SCRIPT_DIR=/home/oracle/scripts                                                                                 ; export SCRIPT_DIR

Environment file for an INFRASTRUCTURE , profile_IDM

PATH=/home/oracle/bin:/usr/local/bin:/usr/bin:/usr/X11R6/bin:/bin:/usr/games:/opt/gnome/bin:/opt/kde3/bin       ; export PATH
ORACLE_HOME=/u00/app/oracle/product/10.1.4/idm                                                                  ; export ORACLE_HOME
ORACLE_SID=idm101                                                                                               ; export ORACLE_SID
PATH=$ORACLE_HOME/bin:$PATH                                                                                     ; export PATH
SCRIPT_DIR=/home/oracle/scripts                                                                                 ; export SCRIPT_DIR

Environment file for a MIDTIER , profile_MID

PATH=/home/oracle/bin:/usr/local/bin:/usr/bin:/usr/X11R6/bin:/bin:/usr/games:/opt/gnome/bin:/opt/kde3/bin       ; export PATH
ORACLE_HOME=/u00/app/oracle/product/10.1.2/mid                                                                  ; export ORACLE_HOME
ORACLE_SID=mid101                                                                                               ; export ORACLE_SID
PATH=$ORACLE_HOME/bin:$ORACLE_HOME/opmn/bin:$PATH                                                               ; export PATH
SCRIPT_DIR=/home/oracle/scripts

After creating the profiles we are ready to start using the actual start and stop scripts which use these profiles to set the right environment.

Start script for an INFRASTRUCTURE , start_idm101.sh

#######################################################################
#
# Script for starting an infrastructure
#
# Author : John Paul van Helvoort
# dd     : 9-12-2008
#
#######################################################################

. /home/oracle/scripts/profile_SID

lsnrctl start

sqlplus /nolog <<EOF
conn / as sysdba
startup
exit
EOF

. /home/oracle/scripts/profile_IDM

$ORACLE_HOME/opmn/bin/opmnctl startall

$ORACLE_HOME/bin/emctl start iasconsole

Stop script for an INFRASTRUCTURE , stop_idm101.sh

#######################################################################
#
# Script for starting an infrastructure
#
# Author : John Paul van Helvoort
# dd     : 9-12-2008
#######################################################################

. /home/oracle/scripts/profile_IDM

$ORACLE_HOME/bin/emctl stop iasconsole

$ORACLE_HOME/opmn/bin/opmnctl stopall

. /home/oracle/scripts/profile_SID

lsnrctl stop

sqlplus /nolog <<EOF
conn / as sysdba
shutdown immediate
exit
EOF

Start script for a MIDTIER , start_mid101.sh

#######################################################################
#
# Script for starting an midtier
#
# Author : John Paul van Helvoort
# dd     : 9-12-2008
#######################################################################

. /home/oracle/scripts/profile_MID

$ORACLE_HOME/opmn/bin/opmnctl startall

$ORACLE_HOME/bin/emctl start iasconsole

Stop script for MIDTIER , stop_mid101.sh

#######################################################################
#
# Script for starting an  midtier
#
# Author : John Paul van Helvoort
# dd     : 9-12-2008
#######################################################################

. /home/oracle/scripts/profile_MID

$ORACLE_HOME/bin/emctl stop iasconsole

$ORACLE_HOME/opmn/bin/opmnctl stopall

The scripts to start and stop the Oracle components are ready. If you like to use these scripts to start and stop your Oracle environment upon booting and shutting the system.
You can follow up on the next script.

Create a file called /etc/init.d/oracle as the user root.
Put this in the script ( please check the path to the scripts called for here )

#! /bin/sh
#
# Author: John Paul van Helvoort
#
# /etc/rc.d/oracle
#
#

case "$1" in
    start)
        echo -n "Starting Oracle Components"
        echo ""
        /bin/su - oracle -c "/home/oracle/scripts/start_idm101.sh"
        /bin/sleep 10
        /bin/su - oracle -c "/home/oracle/scripts/start_mid101.sh"
        ;;
    stop)
        echo -n "Shutting Oracle Components"
        /bin/su - oracle -c "/home/oracle/scripts/stop_mid101.sh"
        /bin/sleep 10
        /bin/su - oracle -c "/home/oracle/scripts/stop_idm101.sh"
        ;;
    try-restart)

        ;;
    restart)
        $0 stop
        $0 start

        ;;
    *)
        echo "Usage: $0 {start|stop|status|try-restart|restart}"
        exit 1
        ;;
esac
exit

After this you need to create symbolic links from the correct runlevel directory to this /etc/init.d/oracle file.
Say your server uses runlevel 3 ( you can check this by viewing /etc/inittab on SLES ).

Go to /etc/init.d/rc3.d

ln -s /etc/init.d/oracle S99oracle
( S99 , being the last process to be started by the server )
ln -s /etc/init.d/oracle K01oracle
( K01 , being the first process to be killed by the server )

Posted in Application Server, Database, Scripting | Leave a Comment »