Sun Cluster 2.2 Software Installation Guide

Creating a Sybase SQL Server and Setting Up Sun Cluster HA for Sybase

Use the procedures in this section to create and configure the initial Sybase SQL Server and databases in a Sun Cluster configuration. If you are creating and configuring additional databases, perform only the procedure described in "How to Create a Sybase SQL Server and Databases".

How to Prepare Multihost Disks for Sybase SQL Servers and Databases
  1. Make sure Sun Cluster is started and the node owns the disk groups.

    To start up the cluster, use scadmin(1M) command, as root. This command starts the cluster and assigns ownership of the disk group to the node you specify.


    # scadmin startcluster physicalhost clustername
    

    If the cluster already exists and the node is in the cluster, use the following command to ensure ownership of the disk group:


    # haswitch physicalhost logicalhost
    

  2. Configure the disk devices for use by your volume manager.


    Caution - Caution -

    While Sybase supports raw I/O to both raw physical devices and raw metadevices (mirrored or non-mirrored), Sun Cluster only supports raw Sybase I/O on raw mirrored volumes or metadevices. You cannot use devices such as /dev/rdsk/c1t1d1s2 to contain Sybase data under Sun Cluster.


    If you are using Solstice DiskSuite to set up raw mirrored metadevices, perform the following steps:

    1. Change the owner, group, and mode of each of the raw mirrored metadevices. (If you are not using raw mirrored metadevices, skip this step.)

      Instructions for creating mirrored metadevices are provided in Appendix B, Configuring Solstice DiskSuite.

    2. Type the following commands for each metadevice.


      # chown sybase_id /dev/md/disk_group/rdsk/dn
      # chgrp dba_id /dev/md/disk_group/rdsk/dn
      # chmod 600 /dev/md/disk_group/rdsk/dn
      

If you are using VxVM, refer to Appendix C, Configuring VERITAS Volume Manager, and to your VxVM documentation for information on setting up your disk devices.

How to Create a Sybase SQL Server and Databases

These are the high-level steps to create a Sybase SQL Server and databases:

These are the detailed steps to create a Sybase SQL Server and databases.

  1. Log in as user sybase.

    You must be defined as user sybase to run the Sybase commands.

  2. Prepare the Sybase environment using the following command. In csh:


    # setenv SYBASE base_dir
    

  3. If you will place the Sybase installation directory on the local disk, prepare database configuration files using the following steps.

    1. Use the sybinit command to create the RUN_sqlserver and (optional) RUN_backupserver files in the Sybase installation directory.

    2. Place the Sybase installation directory on the local disk.

    3. Use the rcp(1) command to copy the RUN_ files to all other potential masters of the logical host.

    4. Update the $SYBASE/interfaces file on those potential masters with entries for the new servers.

    5. Place all transaction logs, databases, the server.cfg file, the server.krg file, and the errorlog file on the local disk.

    6. Use the rcp(1) command to copy the files in Step e to the other potential masters.

    7. If you use the sp_configure store procedure to modify configuration settings or to edit the configuration file directly, use rcp(1) to copy the server.cfg file to the other potential masters.

  4. If you will place the Sybase installation directory on the multihost disk (the logical host), prepare database configuration files using the following steps.

    1. Use the sybinit command to create the RUN_sqlserver and (optional) RUN_backupserver files in the Sybase installation directory.

    2. Place the Sybase installation directory on the multihost disk.

    3. Place all transaction logs, databases, the server.cfg file, the server.krg file, and the errorlog file on the multihost disk.

    4. Use rcp(1) to copy the Sybase interfaces file to /var/opt/sybase/interfaces on all potential masters.

  5. Set up the Sybase SQL Server using the sybinit command.


    Note -

    With Sun Cluster, there can be no more than one SQL Server for each backup server.


    You must use the logical host name when defining the database device. Later, when installing Sybase on the other potential masters, add identical lines to the interfaces file through sybinit.

  6. Create the database and place it on the logical host.

  7. Add the name of your backup server to the sysservers database.

    If the name of your backup server is anything other than the default, SYB_BACKUP, then you must add it to the sysservers database using the following command:


    # sp_addserver <backup_server_name>
    

    If you do not add a backup server name to the sysservers database, then you must use the backup server name SYB_BACKUP.

How to Set Up Sun Cluster HA for Sybase

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

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

  1. Make entries for the names of all SQL Servers.

    You must include the server names associated with your databases in the /var/opt/sybase/sybtab file on all nodes running Sun Cluster HA for Sybase. You must keep this file current on all nodes running Sun Cluster HA for Sybase for a failover to succeed. Update the file manually as SQL Servers are added or removed.

    Entries in the /var/opt/sybase/sybtab file have the following format:


    sql_server:sybase_homedir
    


    Note -

    The Sun Cluster HA for Sybase fault monitor does not monitor backup servers. Therefore, do not make separate entries for backup servers in the /var/opt/sybase/sybtab file.


  2. Log in with the user ID of the RUN_sqlserver file and start the SQL Server.

    If the SQL Server is not running already, start it with the following command:


    # startserver -f $SYBASE/install/RUN_sqlserver
    

  3. (Optional) Create a login and password to be used for fault monitoring.

    Create a Sybase login "new_login_name" with sa_role to start and stop the server.


    Note -

    Skip this step if you want to use the sa login for fault monitoring.


    # isql -Usa -P -S sql_server_name
    	>sp_addlogin new_login_name, password
    	>go
    	>sp_role "grant", "sa_role", new_login_name
    	>go
    	>exit


  4. Verify the $SYBASE/interfaces file.

    If Sybase is installed on the local disks, verify that $SYBASE/interfaces refers to a logical host, not a physical host. If Sybase is installed on the multihost disks, verify that the interfaces file exists under /var/opt/sybase on the local disks and that it is identical to the file $SYBASE/interfaces on the multihost disks.


    Note -

    If you install the Sybase SQL server on the multihost disks (logical host), you must install the Sybase clients in the /var/opt/sybase directories on all nodes capable of mastering the disks. If you install the Sybase SQL server on the local disks, you do not need to install Sybase clients.


  5. Verify that Sun Cluster and the cluster daemon are installed and running on all nodes.


    # hastat
    

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

  6. Register and activate Sun Cluster HA for Sybase using the hareg(1M) command.

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

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


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

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


    # hareg -y sybase
    

  7. Bring Sybase under control of Sun Cluster HA for Sybase using the following command.


    # hasybase insert sqlserver logicalhost 60 10 120 300 user/password \
    
    $SYBASE/install/RUN_sqlserver backupserver $SYBASE/install/RUN_backupserver
    

    The above command line includes the following:

    • hasybase insert - Command and subcommand

    • sqlserver - Name of the SQL Server

    • logicalhost - Logical host serving sql_server (not the physical host)

    • 60 10 120 300 - Parameters which specify a probe cycle time of 60 seconds, a connectivity probe cycle count of 10 seconds, a probe timeout of 120 seconds, and a restart delay of 300 seconds

    • user/password - Login name created in Step 3 and password to be used for fault monitoring

    • $SYBASE/install/RUN_sqlserver - File used to start the SQL Server

    • backupserver (optional) - Name of the backup server

    • $SYBASE/install/RUN_backupserver (optional) - File used to start the backup server

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

  8. Bring the Sybase Server into service.

    Bring the SQL Server into service by running the hasybase(1M) command. Monitoring for that SQL Server will start automatically. See the hasybase(1M) man page for additional details.


    # hasybase start sql_server
    


    Note -

    If you did not start the Sybase SQL Server before issuing the hasybase(1M) command, then issuing it now will cause Sun Cluster to start the SQL Server.