<?xml version="1.0"?>
<!DOCTYPE service_bundle SYSTEM '/usr/share/lib/xml/dtd/service_bundle.dtd.1'>

<!-- $Id: oracle-database-service.xml,v 1.11 2005/12/28 13:25:09 joost Exp $ 

  The contents of this file are subject to the terms of the
  Common Development and Distribution License, Version 1.0 only
  (the "License").  You may not use this file except in compliance
  with the License.

  You can obtain a copy of the license at
   http://www.opensource.org/licenses/cddl1.php
  See the License for the specific language governing permissions and
  limitations under the License.

  Copyright 2005, Joost Mulders.

  This document contains a service definition for Oracle databases. 

  It defines properties and depedencies for databases under smf control.
  This manifest DOES NOT define any instances. Instances of this service 
  are defined in the oracle-database-instance.xml manifest. 

  Instances can be created by:
   * running $MTHPATH/ora-smf autoimport, or by
   * by modifying and importing 
     $MFTPATH/oracle-database-instance.xml

  SMF instances created contain Oracle instance specific variables 
  like ORACLE_SID and inherit generic properties from this service.

  See also
   ora-smf(5)
   $MFTPATH/oracle-database-service.xml 
   $MFTPATH/oracle-database-instance.xml
   $MFTPATH/oracle-listener-service.xml
   $MFTPATH/oracle-listener-instance.xml
   $MTHPATH/ora-smf
   $MTHPATH/ora-smf-func
-->


<service_bundle type='manifest' name='oracle-database-service'>
 <service
  name='application/oracle/database'
  type='service'
  version='1'>

  <!-- 
   grouping='require_all'
    The multi-user milestone must actually be ONLINE (or DEGRADED) before we 
    start: No multi-user, no database.

    A less tight relation could be defined by optional_all, meaning something 
    like "we want to be started after the attempt to start the multi-user 
    milestone, regardless of the status of the milestone"

   restart_on='error'
    If multi-user goes away due to an error, we will go with it. If it comes up,
    we will go with it. Change to 'none' if you don't want the databases to go 
    down with the milestone.
  -->
  <dependency
   name='multi-user'
   grouping='require_all'
   restart_on='error'
   type='service'>
   <service_fmri 
    value='svc:/milestone/multi-user:default' />
  </dependency>

  <!-- The milestone multi-user-server depends on us -->
  <dependent
   name='oracle-database_multi-user-server'
   grouping='optional_all'
   restart_on='none'>
   <service_fmri
    value='svc:/milestone/multi-user-server:default' />
  </dependent>

  <exec_method
   type='method'
   name='start'
   exec='$MTHPATH/ora-smf %m database %i'
   timeout_seconds='0'>
  </exec_method>

  <exec_method
   type='method'
   name='stop'
   exec='$MTHPATH/ora-smf %m database %i'
   timeout_seconds='0'>
  </exec_method>

  <!-- 
    Tell svc.startd to run this service under contract which is the default.
    This means that startd will restart a database automatically when it is
    stopped. The *ONLY* way valid ways to stop a database are 

     svcadm mark maintenance FMRI, or
     svcadm disable FMRI

    DBA's with a habit of doing "shutdown immediate" in SQL*Plus will find that
    the database immediately gets started again. This could lead to dataloss
    if the "shutdown immediate" is done as part of an offline backup procedure.

    It might help to change the commonly used "dbshut" and "dbstart" commands
    so that svcadm is executed instead of SQL*Plus.

    If the restart behaviour is not desired, change the duration value to
    transient. 
   -->
  <property_group name='startd' type='framework'>
   <propval name='duration' type='astring' value='contract' />

   <propval name='modify_authorization' type='astring'
    value='solaris.smf.manage.oracle.database' />
  </property_group>

  <!--
   Authorized accounts may 
    - add, change and delete properties in this property group
    - change the status (stop/start) of instances
  -->
  <property_group name='general' type='framework'>
   <propval name='modify_authorization' type='astring'
    value='solaris.smf.manage.oracle.database' />

   <propval name='action_authorization' type='astring'
    value='solaris.smf.manage.oracle.database' />
  </property_group>

  <!-- Allow the good guys to modify this dependeny -->
  <property_group name='multi-user' type='dependency'>
    <propval name='modify_authorization' type='astring'
     value='solaris.smf.manage.oracle.database' />
  </property_group>

  <!-- 
   A generic options property group for this database. 

   auth, astring
   Used as the argument in the connect statement. The default value is 
   '/ as sysdba', which assumes OS authentication. 
   If passwordfile authentication is used, change it for example to
   'john/secret as sysdba'. 
   The ora-smf method peels out this variable and uses it in the connect
   statement as "connect $autvariable"
  -->
  <property_group name='options' type='application'>
   <stability value='External' />

   <propval name='auth' type='astring' value='/ as sysdba' />

   <propval name='modify_authorization' type='astring'
    value='solaris.smf.manage.oracle.database' />

  </property_group>
  
  <stability value='External' />
  
  <template>
   <common_name>
    <loctext xml:lang='C'>
     Oracle database 
    </loctext>
   </common_name>
   <documentation>
    <manpage title='ora-smf' section='5'
     manpath='/usr/share/man' />
   </documentation>
  </template>
 </service>
</service_bundle>
