Sun Java System Application Server Enterprise Edition 8.2 High Availability Administration Guide

Creating a Database

Use the hadbm create command to create a database manually.

Before you use this command to create a database, create the management domain and register the HADB package. If you have not performed these two steps when you run hadbm create , it implicitly performs them. Although this might seem like less work, failures in any of the commands can make debugging difficult. Besides, hadbm create is not atomic, that is, if one of the implicit commands fails, the commands that executed successfully will not be rolled back. Therefore, it is best to create the database only after creating the domain and registering the HADB package.

For example, if hadbm createdomain and hadbm registerpackage execute successfully but hadbm create database fails, the changes made by hadbm createdomain and hadbm registerpackage will persist.

ProcedureTo create a database

  1. Create the management domain.

    For more information, see Creating a Management Domain

  2. Register the HADB package.

    For more information, see Registering HADB Packages for more information.

  3. Use the hadbm create command to create the database.

    For information on command syntax, see the following section.

hadbm create Command Syntax

hadbm create [--package=name] [--packagepath=path] [--historypath=path] [--devicepath=path] [--datadevices=number ] [--portbase=number] [--spares=number] [--set=attr-val-list] [--agent=maurl] [--no-cleanup] [ --no-clear ] [ --devicesize =size] [--dbpassword=password | --dbpasswordfile=file ] --hosts=host list [--adminpassword=password | --adminpasswordfile=file | --no-adminauthentication ] [dbname]

The dbname operand specifies the database name, which must be unique. To make sure the database name is unique, use the hadbm list command to list existing database names. Use the default database name unless you need to create multiple databases. For example, to create multiple clusters with independent databases on the same set of HADB machines, use a separate database name for each cluster.

The hadbm create command writes error messages to the console, not log files.

Table 3–7 describes the special hadbm create command options. See General Options for a description of additional command options.

Table 3–7 hadbm create Options

Option(Short Form) 

Description 

Default 

--datadevices= number

-a 

Number of data devices on each node, between one and eight inclusive. Data devices are numbered starting at 0. 

--devicepath= path

-d 

Path to the devices. There are four devices: 

  • DataDevice

  • NiLogDevice (node internal log device)

  • RelalgDevice (relational algebra query device)

  • NoManDevice (node manager device).

    This path must exist and be writable. To set this path differently for each node or each device, see Setting Heterogeneous Device Paths

Solaris and Linux: /var/opt/SUNWhadb

Windows: C:\Sun\AppServer\SUNWhadb\vers, where vers is the HADB version number.

Default is specified by ma.server.dbdevicepath in management agent configuration file. For more details, see Configuration File

--devicesize= size

-z 

Device size for each node. For more information, see Specifying Device Size.

Increase the device size as described in Adding Storage Space to Existing Nodes

1024MB 

Maximum size is lesser of maximum operating system file size or 256 GB. Minimum size is: 

(4 x LogbufferSize + 16MB) / n

Where n is the number of data devices given by the option --datadevices.

--historypath= path

-t 

Path to the history files. This path must already exist and be writable. 

For more information on history files, see Clearing and Archiving History Files

Default is specified by ma.server.dbhistorypath in management agent configuration file. For details, see Configuration File

Solaris and Linux:/var/opt/SUNWhadb

On Windows: REPLACEDIR (replaced by the actual URL at runtime.) 

--hosts= hostlist

-H 

Comma-separated list of host names or IP addresses (IPv4 only) for the nodes in the database. Use IP addresses to avoid dependence on DNS lookups. Host names must be absolute. You cannot use localhost or 127.0.0.1 as a host name. Host names

See Specifying Hosts for more information.

None 

--package=name -k

Name of the HADB package (version). If the package is not found, a default package is registered. 

This option is deprecated. Use the hadbm registerpackage command to register a package in the domain. 

None 

--packagepath=path-L

Path to the HADB software package. Use only if the package is not registered in the domain. 

This option is deprecated. Use the hadbm registerpackage command to register a package in the domain. 

None 

--portbase= number

-b 

Port base number used for node 0. Successive nodes are automatically assigned port base numbers in steps of 20 from this number. Each node uses its port base number and the next five consecutively numbered ports. 

To run several databases on the same machine, have a plan for allocating port numbers explicitly. 

15200 

--spares= number

-s 

Number of spare nodes. This number must be even and must be less than the number of nodes specified in the --hosts option.

--set=attr-val-list

-S 

Comma-separated list of database configuration attributes in name =value format. For explanations of database configuration attributes, see Clearing and Archiving History Files

None 


Example 3–3 Example of creating a database

The following command is an example of creating a database:

hadbm create --spares 2 --devicesize 1024  --hosts n0,n1,n2,n3,n4,n5

Specifying Hosts

Use the --hosts option to specify a comma-separated list of host names or IP addresses for the nodes in the database. The hadbm create command creates one node for each host name (or IP address) in the list. The number of nodes must be even. Use duplicate host names to create multiple nodes on the same machine with different port numbers. Make sure that nodes on the same machine are not mirror nodes, and not from different DRUs..

Nodes are numbered starting at zero in the order listed in this option. The first mirrored pair are nodes zero (0) and one (1), the second two (2) and three (3), and so on. Odd numbered nodes are in one DRU, even numbered nodes in the other. With --spares option, spare nodes are those with the highest numbers.

For information about configuring double network interfaces, see Configuring Network Redundancy

Specifying Device Size

Specify the device size using the --devicesize option. The recommended device size is:

(4x / nd + 4l/d) / 0.99 

Where

Setting Heterogeneous Device Paths

To set a different device path for each node or service, use the -- set option of hadbm create. There are four types of devices: the DataDevice, the NiLogDevice (node internal log device), the RelalgDevice (relational algebra query device), and the NoManDevice (node manager device). The syntax for each name =value pair is as follows, where -devno is required only if the device is DataDevice:

node-nodeno.device-devno.Devicepath

For example:

--set Node-0.DataDevice-0.DevicePath=/disk0,
Node-1.DataDevice-0.DevicePath=/disk 1

You can also set a heterogeneous path to history files, as follows:

node-nodeno.historypath=path

For information on history files, see Clearing and Archiving History Files

Any device path that is not set for a particular node or device defaults to the --devicepath value.


Note –

Change device paths and location of history files using hadbm set and hadbm addnodes commands.


Troubleshooting

If you have difficulty creating a database, check the following: