Home | History | Annotate | Download | only in 9ias
      1 #!/usr/bin/ksh
      2 #
      3 # CDDL HEADER START
      4 #
      5 # The contents of this file are subject to the terms of the
      6 # Common Development and Distribution License (the License).
      7 # You may not use this file except in compliance with the License.
      8 #
      9 # You can obtain a copy of the license at usr/src/CDDL.txt
     10 # or http://www.opensolaris.org/os/licensing.
     11 # See the License for the specific language governing permissions
     12 # and limitations under the License.
     13 #
     14 # When distributing Covered Code, include this CDDL HEADER in each
     15 # file and include the License file at usr/src/CDDL.txt.
     16 # If applicable, add the following below this CDDL HEADER, with the
     17 # fields enclosed by brackets [] replaced with your own identifying
     18 # information: Portions Copyright [yyyy] [name of copyright owner]
     19 #
     20 # CDDL HEADER END
     21 #
     22 
     23 #
     24 # Copyright 2007 Sun Microsystems, Inc.  All rights reserved.
     25 # Use is subject to license terms.
     26 #
     27 # ident	"@(#)10gas_register.ksh	1.5	07/08/07 SMI"
     28 #
     29 
     30 . `dirname $0`/10gas_config
     31 
     32 PORT=10000
     33 OIAS_ADMIN=dummy
     34 OIAS_FQDN=dummy
     35 
     36 validate_registration()
     37 {
     38 St=$?
     39 RS=$1
     40 RG=$2
     41 ORACLE_HOME=$3
     42 ORACLE_SID=$4
     43 OIAS_LHOST=$5
     44 OIAS_USER=$6
     45 OIAS_ADMIN=$7
     46 OIAS_INFRA=$8
     47 OIAS_FQDN=$9
     48 
     49 if [ "${St}" -ne 0 ]; then
     50         echo "Registration of resource ${RS} failed, please correct the wrong parameters"
     51         exit 1
     52 else
     53         echo "Registration of resource ${RS} succeeded"
     54 fi
     55 
     56 # VALIDATE RESOURCE
     57 
     58 `dirname $0`/../bin/validate_9ias -R $RS -G $RG \
     59 -O $ORACLE_HOME -S $ORACLE_SID -H $OIAS_LHOST \
     60 -U $OIAS_USER -P $OIAS_ADMIN -E $OIAS_INFRA -D $OIAS_FQDN
     61 
     62 St=$?
     63 
     64 if [ "${St}" -ne 0 ]; then
     65         echo "Validation of resource ${RS} failed, please correct the wrong parameters"
     66         echo "Removing resource ${RS} from the cluster configuration"
     67 
     68         scrgadm -r -j ${RS}
     69         exit 1
     70 else
     71         echo "Validation of resource ${RS} succeeded"
     72 fi
     73 }
     74 
     75 scrgadm -a -j $RS_OPMN -g $RG -t SUNW.gds \
     76 -x Start_command="/opt/SUNWsc9ias/bin/start-opmn \
     77 -R $RS_OPMN -G $RG -O $ORACLE_HOME -S $ORACLE_SID -H $OIAS_LHOST \
     78 -U $OIAS_USER -P $OIAS_ADMIN -E $OIAS_INFRA -D $OIAS_FQDN -C $OIAS_OPMN " \
     79 -x Stop_command="/opt/SUNWsc9ias/bin/stop-opmn \
     80 -R $RS_OPMN -G $RG -O $ORACLE_HOME -S $ORACLE_SID -H $OIAS_LHOST \
     81 -U $OIAS_USER -P $OIAS_ADMIN -E $OIAS_INFRA -D $OIAS_FQDN -C $OIAS_OPMN " \
     82 -x Probe_command="/opt/SUNWsc9ias/bin/probe-opmn \
     83 -R $RS_OPMN -G $RG -O $ORACLE_HOME -S $ORACLE_SID -H $OIAS_LHOST \
     84 -U $OIAS_USER -P $OIAS_ADMIN -E $OIAS_INFRA -D $OIAS_FQDN -C $OIAS_OPMN " \
     85 -y Port_list=$PORT/tcp \
     86 -x Stop_signal=9 -x Probe_timeout=90 -y Retry_interval=600 \
     87 -y Resource_dependencies=$RS_HAS,$RS_LH,$RS_ORACLE,$RS_ORALSR
     88 
     89 validate_registration $RS_OPMN $RG \
     90 $ORACLE_HOME $ORACLE_SID $OIAS_LHOST \
     91 $OIAS_USER $OIAS_ADMIN $OIAS_INFRA $OIAS_FQDN $OIAS_OPMN
     92 
     93 # The Enterprise Manager resource is not required for Oracle
     94 # Application Server v10.1.3.0 or higher. Instead the Enterprise
     95 # Manager has now been included within OC4J managed by OPMN.
     96 
     97 VERSION=`/usr/bin/ls -d ${ORACLE_HOME}/inventory/Components*/oracle.ias.ha/* | \
     98 /usr/bin/awk -F/ '{print $NF}' | /usr/xpg4/bin/tr -d .`
     99 
    100 [[ "${VERSION}" == +([0-9]) && "${VERSION}" -ge 101300 ]] && exit 0
    101 
    102 if [ ! -z "$RS_EM" ]; then
    103 
    104 scrgadm -a -j $RS_EM -g $RG -t SUNW.gds \
    105 -x Start_command="/opt/SUNWsc9ias/bin/start-em \
    106 -R $RS_EM -G $RG -O $ORACLE_HOME -S $ORACLE_SID -H $OIAS_LHOST \
    107 -U $OIAS_USER -P $OIAS_ADMIN -E $OIAS_INFRA -D $OIAS_FQDN " \
    108 -x Stop_command="/opt/SUNWsc9ias/bin/stop-em \
    109 -R $RS_EM -G $RG -O $ORACLE_HOME -S $ORACLE_SID -H $OIAS_LHOST \
    110 -U $OIAS_USER -P $OIAS_ADMIN -E $OIAS_INFRA -D $OIAS_FQDN " \
    111 -x Probe_command="/opt/SUNWsc9ias/bin/probe-em \
    112 -R $RS_EM -G $RG -O $ORACLE_HOME -S $ORACLE_SID -H $OIAS_LHOST \
    113 -U $OIAS_USER -P $OIAS_ADMIN -E $OIAS_INFRA -D $OIAS_FQDN " \
    114 -y Port_list=$PORT/tcp \
    115 -y Failover_mode=NONE -x Failover_enabled=false \
    116 -x Stop_signal=9 \
    117 -y Resource_dependencies=$RS_LH,$RS_OPMN
    118 
    119 validate_registration $RS_EM $RG \
    120 $ORACLE_HOME $ORACLE_SID $OIAS_LHOST \
    121 $OIAS_USER $OIAS_ADMIN $OIAS_INFRA $OIAS_FQDN
    122 
    123 fi
    124 
    125