Sun Cluster 2.2 Software Installation Guide

5.2.5 How to Set Up Sun Cluster HA for Oracle

These are the high-level steps to set up Sun Cluster HA for Oracle:

These are the detailed steps to set up Sun Cluster HA for Oracle.

  1. Make SID entries for the Sun Cluster HA for Oracle databases of all database instances.

    You must include the SID of the instance associated with your database in the /var/opt/oracle/oratab file on all nodes running Sun Cluster HA for Oracle. You must keep this file current on all nodes running Sun Cluster HA for Oracle for a failover to succeed. Update the file manually as are you add or remove a SID. If the oratab files do not match, an error message will be returned and the haoracle start command will fail.

    All entries in the /var/opt/oracle/oratab file should have the -:N option specified to ensure that the instance will not start automatically on Solaris reboot. For example:

    oracle_sid:/oracle:N
  2. Depending on which authentication method you choose, Oracle authentication or Solaris authentication, perform one of the following steps.

    1. Enable access for the user and password to be used for fault monitoring.

      You must complete this step if you do not enable Solaris authentication, as described in Step b.

      In the following examples, the user is scott and the password is tiger. Note that the user and password pair must agree with those used in Step 6, if you are using Oracle authentication.

      For all supported Oracle releases, enable access by typing the following script into the screen brought up by the srvmgrl(1M) command.

      # svrmgrl
      
       	connect internal;
       			grant connect, resource to scott identified by tiger;
       			alter user scott default tablespace system quota 1m on
       				system;
              			grant select on v_$sysstat to scott;
       			grant create session to scott;
       			grant create table to scott;
       	disconnect;
      
          exit;
    2. Grant permission for the database to use Solaris authentication.

      You must complete this step if you chose not to complete Step 2.

      The following sample entry enables Solaris authentication.

      # svrmgrl
      
       	connect internal;
       			create user ops$root identified by externally
       				default tablespace system quota 1m on system;
       			grant connect, resource to ops$root;
             			grant select on v_$sysstat to ops$root;
       			grant create session to ops$root;
       			grant create table to ops$root;
       	disconnect;
      
          exit;
  3. Configure SQL*Net V2 for Sun Cluster.


    Note -

    Create and update the tnsnames.ora and listener.ora files under /var/opt/oracle on all nodes.


    Sun Cluster HA for Oracle imposes no restrictions on the listener name--it can be any valid Oracle listener name.

    The following code sample identifies the lines in listener.ora that are updated.

    LISTENER =
     	(ADDRESS_LIST =
     			(ADDRESS =
     				(PROTOCOL = TCP)
     					(HOST = hostname) <- or, use logical host name
     				(PORT = 1527)
     			)
     	)
     .
     .
     SID_LIST_LISTENER =
     	.
     			.
     						(SID_NAME = SID) <- Database name, default is ORCL	

    The following sample identifies the lines in tnsnames.ora that are updated.

    service_name =
     	.
     			.
     						(ADDRESS = <- listener address
     								(HOST = server_name)	<- logical host name
     								(PORT = 1527) <- must match port in LISTENER.ORA
     						)
     				)
     				(CONNECT_DATA =
     						(SID = <SID>)) <---database name, default is ORCL

    Sun Cluster HA for Oracle opens the /var/opt/tnsnames.ora file. It scans the file to service name by matching SID = instance name and server name=logical host. The service_name obtained from tnsnames.ora is used by the Sun Cluster HA for Oracle remote fault monitor to connect to the server.

    Put the logical host name in place of the host name in the listener.ora file in the "HOST = host name" line.

    The following example shows how to update the listener.ora and tnsnames.ora files given the following Oracle instances.

    Table 5-1 Example Oracle Configuration

    Instance 

    Logical Host 

    Listener 

    ora8 

    hadbms3 

    LISTENER-ora8 

    ora7 

    hadbms4 

    LISTENER-ora7 

    The corresponding listener.ora entries would be:

    LISTENER-ora7 =
     	(ADDRESS_LIST =
     			(ADDRESS =
     				(PROTOCOL = TCP)
     				(HOST = hadbms4)
     				(PORT = 1530)
     			)
     		)
     SID_LIST_LISTENER-ora7 =
     	(SID_LIST =
     			(SID_DESC =
     				(SID_NAME = ora7)
     			)
     		)
     LISTENER-ora8 =
       (ADDRESS_LIST =
         (ADDRESS= (PROTOCOL=TCP) (HOST=hadbms3)(PORT=1806))
       )
     SID_LIST_LISTENER-ora8 =
       (SID_LIST =
          (SID_DESC =
     			(SID_NAME = ora8)
     		 )	
       )

    The corresponding tnsnames.ora entries would be:

    ora8 =
     (DESCRIPTION =
        (ADDRESS_LIST =
     			(ADDRESS = (PROTOCOL = TCP)
     			(HOST = hadbms3)
     			(PORT = 1806))
        	)   
     	(CONNECT_DATA = (SID = ora8))
     )
     ora7 =
     (DESCRIPTION =
       (ADDRESS_LIST =
             (ADDRESS =
     				(PROTOCOL = TCP)
     				(HOST = hadbms4)
     				(PORT = 1530))
       	)
       	(CONNECT_DATA = (
     			SID = ora7))
     )
  4. Verify that Sun Cluster and the cluster daemon are installed and running on all hosts.

    # hastat
    

    If they are not running already, start them by using the scadmin startnode command.

  5. Register and activate Sun Cluster HA for Oracle by using the hareg(1M) command.

    Run the hareg(1M) command on only one node.

    If the Oracle server is not yet registered, use the hareg(1M) command to register it. To register the data service only on the logical host, use the -h option and supply the logical host name:

    # hareg -s -r oracle [-h logicalhost]

    If the cluster is running already, use the hareg(1M) command to activate the Oracle data service:

    # hareg -y oracle
    
  6. Setup Sun Cluster HA for Oracle configuration data.

    Run the following command so that the instance will be monitored by Sun Cluster:

    # haoracle insert $ORACLE_SID logicalhost 60 10 120 300 \
     user/password /logicalhost/.../init$ORACLE_SID.ora listener 
    

    The previous command line includes the following:

    • haoracle insert - Command and subcommand

    • $ORACLE_SID - Name of the Oracle database instance

    • logicalhost - Logical host serving $ORACLE_SID (not the physical host)

    • 60 10 120 300 - These parameters specify a probe cycle time of 60 seconds, a connectivity probe cycle count of 10, a probe time out of 120 seconds, and a restart delay of 300 seconds.

    • user/password - These are the user and password to be used for fault monitoring. They must agree with the permission levels granted in Step 2. To use Solaris authentication, enter a slash (/) instead of the user name and password.

    • /logicalhost/.../init$ORACLE_SID.ora - This indicates the pfile to use to start up the database. This must be on a logical host's disk group.

    • listener - The SQL*Net V2 listener. The listener is started and monitored using this name. The default is LISTENER. This field is optional.

    See the haoracle(1M) man page for details on all options to haoracle(1M).

  7. Bring the database instance into service.

    Bring the Sun Cluster HA for Oracle database into service by executing the haoracle(1M) command. Monitoring for that instance will start automatically.

    # haoracle start $ORACLE_SID
    

    Note -

    If you did not start the Oracle instance before issuing the haoracle(1M) command, Sun Cluster will start the Oracle instance for you when you issue the command.