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

- Previous: Managing Nodes
- Next: Recovering from Session Data Corruption

## 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`.

- Previous: Managing Nodes
- Next: Recovering from Session Data Corruption

- © 2010, Oracle Corporation and/or its affiliates