Sun Java System Application Server Enterprise Edition 8.1 2005Q2 High Availability Administration Guide

- Previous: Configuring HADB
- Next: Expanding HADB

# Managing HADB

You generally need to perform management operations when you replace or upgrade your network, hardware, operating system, or HADB software. The following sections explain various management operations:

- Managing Domains

- Managing Nodes

- Managing Databases

- Recovering from Session Data Corruption

## Managing Domains

You can perform the following operations on an HADB domain:

- Creating a Domain: For more information, see Creating a Management Domain

- Extending a Domain

- Deleting a Domain

- Listing Hosts in a Domain

- Removing Hosts from a Domain

See Security Options and General Options for a description of command options.

### Extending a Domain

Use `extenddomain` to add hosts to an existing management domain. The command syntax is:

    hadbm extenddomain
    [--adminpassword=password | --adminpasswordfile=file]
    [--agent=maurl]
    hostlist

IP addresses of HADB hosts must be IPv4 addresses.

For more information, see hadbm-extenddomain(1).

### Deleting a Domain

Use `deletedomain to` remove a management domain. The command syntax is:

    hadbm deletedomain
    [--adminpassword=password | --adminpasswordfile=file]
    [--agent=maurl]

For more information, see hadbm-deletedomain(1).

### Removing Hosts from a Domain

Use `reducedomain` to remove hosts from the management domain. The command syntax is:

    hadbm reducedomain
    [--adminpassword=password | --adminpasswordfile=file]
    [--agent=maurl]
    host_list

For more information, see hadbm-reducedomain(1).

### Listing Hosts in a Domain

Use `listdomain` to list all hosts defined in the management domain. The command syntax is:

    hadbm listdomain
    [--adminpassword=password | --adminpasswordfile=file]
    [--agent=maurl]

For more information, see hadbm-listdomain(1).

## Managing Nodes

You can perform the following operations on individual nodes:

- Starting a Node

- Stopping a Node

- Restarting a Node

### Starting a Node

You might need to manually start an HADB node that was stopped because its host was taken off-line for a hardware or software upgrade or replacement. Also, you might need to manually start a node if it fails to restart for some reason (other than a double failure). For more information on how to recover from double failures, see Clearing a database.

In most cases, you should first attempt to start the node using the `normal` start level. You must use the `repair` start level if the `normal` start level fails or times out.

To start a node in the database, use the `hadbm startnode` command. The syntax is:

    hadbm startnode
     [--adminpassword=password | --adminpasswordfile=file]
     [--agent=maurl]
     [--startlevel=level]
     nodeno
     [dbname]

The dbname operand specifies the database name. The default is `hadb`.

The nodeno operand specifies the number of the node to start. Use `hadbm status` to display the numbers of all nodes in a database.

For more information, see hadbm-startnode(1).

#### Start level option

The `hadbm startnode` command has one special option, `--startlevel` (short form `-l`), that specifies the level at which to start the node.

Node start levels are:

- normal (default): starts the node with the data found locally on the node (in the memory and in the data device file on the disk) and synchronizes it with the mirror for recent updates it missed.

- repair: forces the node to discard local data and copy it from its mirror.

- clear: reinitializes the devices for the node and forces a repair of data from its mirror node. Use when the device files need to be initialized, necessary if they are damaged or the disk that contained the device files is replaced.

See General Options for a description of other command options.

##### Example 3–6 Example of starting a node

    hadbm startnode 1

### Stopping a Node

You might need to stop a node to repair or upgrade the host machine’s hardware or software. To stop a node, use the `hadbm stopnode` command. The command syntax is:

    hadbm stopnode
    [--adminpassword=password | --adminpasswordfile=file]
    [--agent=maurl]
    [--no-repair]
    nodeno
    [dbname]

The nodeno operand specifies the number of the node to stop. The mirror node of this node number must be running. Use `hadbm status` to display the numbers of all nodes in a database.

The dbname operand specifies the database name. The default is `hadb`.

The `hadbm stopnode` command has one special option, `--no-repair` (short form `-R`) that indicates no spare node is to replace the stopped node. Without this option, a spare node starts up and takes over the functioning of the stopped node.

See General Options for a description of other command options. For more information, see hadbm-stopnode(1).

##### Example 3–7 Example of stopping a node

    hadbm stopnode 1

### Restarting a Node

You might have to restart a node if you notice unusual behavior such as excessive CPU consumption.

To restart a node in the database, use the `hadbm restartnode` command. The command syntax is:

    hadbm restartnode
    [--adminpassword=password | --adminpasswordfile=file]
    [--agent=maurl]
    [--startlevel=level]
    nodeno
    [dbname]

The dbname operand specifies the database name. The default is `hadb`.

The nodeno operand specifies the number of the node to restart. Use `hadbm status` to display the numbers of all nodes in a database.

The `hadbm restartnode` command has one special option, `--startlevel` (short form `-l`), that specifies the level at which to start the node. See Start level option for more information.

See General Options for a description of other command options. For more information, see hadbm-restartnode(1).

##### Example 3–8 Example of restarting a node

    hadbm restartnode 1

## Managing Databases

You can perform the following operations on HADB databases:

- Starting a Database

- Stopping a Database

- Restarting a Database

- Listing Databases

- Clearing a database

- Removing a Database

### Starting a Database

To start a database, use the `hadbm start` command. This command starts all nodes that were running before the database was stopped. Individually stopped (offline) nodes are not started when the database is started after a stop.

The command syntax is:

    hadbm start
    [--adminpassword=password | --adminpasswordfile=file]
    [--agent=maurl]
    [dbname]

The dbname operand specifies the database name. The default is `hadb`.

See General Options for a description of command options. For more information, see hadbm-start(1).

##### Example 3–9 Example of starting a database

    hadbm start

### Stopping a Database

When you stop and start a database in separate operations, data is unavailable while it is stopped. To keep data available, you can restart a database as described in Restarting a Database.

Stop a database to:

- Remove the database.

- Perform system maintenance that affects all HADB nodes.

Before stopping a database, either stop dependent Application Server instances that are using the database, or configure them to use a Persistence Type other than `ha`.

When you stop the database, all the running nodes in the database are stopped and the status of the database becomes Stopped. For more information about database states, see Getting the Status of HADB.

To stop a database, use the `hadbm stop` command. The command syntax is:

    hadbm stop
    [--adminpassword=password | --adminpasswordfile= file]
    [--agent=maurl]
    [dbname]

The dbname operand specifies the database name. The default is `hadb`.

See General Options for a description of command options. For more information, see hadbm-stop(1).

##### Example 3–10 Example of stopping a database

    hadbm stop

### Restarting a Database

You might want to restart a database if you notice strange behavior (for example consistent timeout problems). In some cases, a restart may solve the problem.

When you restart a database, y, the database and its data remain available. When you stop and start HADB in separate operations, data and database services are unavailable while HADB is stopped. This is because by default `hadbm restart` performs a rolling restart of nodes: it stops and starts the nodes one by one. In contrast, `hadbm stop` stops all nodes simultaneously.

To restart a database, use the `hadbm restart` command. The command syntax is:

    hadbm restart
    [--adminpassword=password | --adminpasswordfile=file]
    [--agent=maurl]
    [--no-rolling]
    [dbname]

The dbname operand specifies the database name. The default is `hadb`.

This command has one special option, `--no-rolling` (short form `-g`), that specifies to restart all nodes at once, which causes loss of service. Without this option, this command restarts each of the nodes in the database to the current state or a better state.

See General Options for a description of other command options. For more information, see hadbm-restart(1).

For example:

    hadbm restart

### Listing Databases

To list all the databases in an HADB instance, use the `hadbm list` command. The command syntax is:

    hadbm list
    [--agent=maurl]
    [--adminpassword=password | --adminpasswordfile=file]

See General Options for a description of command options. For more information, see hadbm-list(1).

### Clearing a database

Clear a database when:

- The `hadbm status` command reveals that the database is non-operational or if See Getting the Status of HADB.

- Multiple nodes do not respond and are in waiting state for a long time.

- Recovering from session data corruption. See Recovering from Session Data Corruption

The `hadbm clear` command stops the database nodes, clears the database devices, then starts the nodes. This command erases the Application Server schema data store in HADB, including tables, user names, and passwords. After running `hadbm clear`, use `asadmin configure-ha-cluster` to recreate the data schema, reconfigure the JDBC connection pool, and reload the session persistence store.

The command syntax is:

    hadbm clear  [--fast]  [--spares=number]
    [--dbpassword=password | --dbpasswordfile= file]
    [--adminpassword=password | --adminpasswordfile= file]
    [--agent=maurl]
    [dbname]

The dbname operand specifies the database name. The default is `hadb`.

The following table describes the special `hadbm clear` command options. See General Options for a description of other options.

For more information, see hadbm-clear(1).

Table 3–12 `hadbm clear` Options

Option | Description | Default
--- | --- | ---
--fast -F | Skips device initialization while initializing the database. Do not use if the disk storage device is corrupted. | Not applicable
--spares= number -s | Number of spare nodes the reinitialized database will have. Must be even and less than the number of nodes in the database. | Previous number of spares

For example:

    hadbm clear --fast --spares=2 --dbpassword secret123

### Removing a Database

To remove an existing database, use the `hadbm delete` command. This command deletes the database’s configuration files, device files, and history files, and frees shared memory resources. The database you want to remove must exist and must be stopped. See Stopping a Database.

The command syntax is:

    hadbm delete
    [--adminpassword=password | --adminpasswordfile=file]
    [--agent=maurl]
    [dbname]

The dbname operand specifies the database name. The default is `hadb`.

See General Options for a description of command options. For more information, see hadbm-delete(1).

##### Example 3–11 Example of removing a database

The command:

    hadbm delete

deletes the default database, `hadb`.

## Recovering from Session Data Corruption

The following are indications that session data may be corrupted:

- Error messages appear in the Application Server system log (`server.log`) every time an application tries to save session state.

- Error messages in the server log indicate that the session could not be found or could not be loaded during session activation.

- Sessions that are activated after previously being passivated contain empty or incorrect session data.

- When an instance fails, failed-over sessions contain empty or incorrect session data.

- When an instance fails, instances that try to load a failed-over session cause an error in the server log indicating the session could not be found or could not be loaded.

### To bring the session store back to a consistent state

If you determine that the session store has been corrupted, bring it back to a consistent state by following this procedure:

1. Clear the session store.

   Determine if this action corrects the problem. If it does, then stop. If not—for example, if you continue to see errors in the server log—then continue.

2. Re-initialize the data space on all the nodes and clear the data in the database.

   See Clearing a database .

   Determine if this action corrects the problem. If it does, then stop. If not—for example, if you continue to see errors in the server log—then continue.

3. Delete and then recreate the database.

   See Removing a Database and Creating a Database

- Previous: Configuring HADB
- Next: Expanding HADB

- © 2010, Oracle Corporation and/or its affiliates