DEV Community

mmllllzcn
mmllllzcn

Posted on

GBase Database Instance Status: How to Read `onstat -` Output

When an application reports "can't connect," don't immediately start changing network settings or checking database accounts.

Start with:

onstat -
Enter fullscreen mode Exit fullscreen mode

In GBase Database (GBase 8s), this command reads instance information directly from shared memory. It does not require an active database connection, making it particularly useful when applications cannot connect to the database.

For DBAs and on-call engineers, onstat - is one of the quickest ways to determine whether an instance is running normally, undergoing recovery, or in an administrative state.

Let's break down what to look for.

1. Run onstat - and Identify the Instance State

Execute the command as the gbasedbt user:

onstat -

# Example output:
gbase01: On-Line -- Up 3 days 06:13:19 -- 165364 Kbytes
Enter fullscreen mode Exit fullscreen mode

Four details in this output deserve attention.

Instance Name and Running State

The first field identifies the instance, followed by its current operating state.

Three states are particularly important:

State Meaning Recommended action
On-Line Normal operating state Continue checking connectivity, listeners, and permissions
Quiescent Quiet administrative state Check whether maintenance or administrative operations are in progress
Fast Recovery Recovering after a crash Monitor recovery and wait for the instance to become available

These states require different troubleshooting approaches.

For example, changing network settings while an instance is still in Fast Recovery will not solve the underlying availability problem.

Uptime: Detect Unexpected Restarts

The value following Up shows how long the instance has been running.

Compare two readings:

Yesterday: Up 3 days 06:13:19
Today:     Up 00:00:13
Enter fullscreen mode Exit fullscreen mode

A sudden drop in uptime indicates that the instance has restarted.

This matters because a restart changes the runtime context and resets many in-memory statistics. If an incident occurred before the restart, some diagnostic evidence may no longer be available.

When uptime unexpectedly returns to a few seconds, check the restart history and maintenance records before proceeding.

Kbytes: Check Instance Memory Usage

The Kbytes field reports the shared memory allocated to the instance.

For example:

165364 Kbytes
Enter fullscreen mode Exit fullscreen mode

A significant change between consecutive readings deserves investigation.

Compare historical outputs to determine whether the change is associated with a restart, configuration change, or another instance-level event.

One reading alone rarely explains the cause. Historical comparison provides more useful context.

Checkpoint Indicators

You may also encounter these indicators:

  • (CKPT REQ) – A checkpoint has been requested.
  • (CKPT INP) – A checkpoint is currently in progress.

Neither indicator automatically means the instance has encountered an error. They describe checkpoint activity and should be interpreted in the context of the current workload.

2. Understand the Shared Memory Initialization Error

Sometimes onstat - returns:

shared memory not initialized for GBASEDBTSERVER 'gbase01'
Enter fullscreen mode Exit fullscreen mode

This generally indicates one of two situations:

  1. The specified database instance has not been initialized or is not running.
  2. Your current environment is pointing to an instance that does not have initialized shared memory.

The second situation is easy to overlook.

Before attempting to restart the database, check the environment variable:

echo $GBASEDBTSERVER
Enter fullscreen mode Exit fullscreen mode

Compare its value with the instance name shown in the error message.

If the environment points to the wrong instance, correct the environment first. Restarting a database without confirming the target instance can introduce unnecessary operational risk.

3. Automate the Initial Health Check

For on-call operations, you can wrap the command in a small shell script:

#!/bin/bash

echo "=== GBase Database Instance Status ==="
date
onstat -
Enter fullscreen mode Exit fullscreen mode

Save it as check_state.sh and make it executable:

chmod +x check_state.sh
./check_state.sh
Enter fullscreen mode Exit fullscreen mode

To archive each reading with a timestamp:

onstat - > /tmp/state_$(date +%F_%H%M).txt
Enter fullscreen mode Exit fullscreen mode

For example, the generated filename might look like:

/tmp/state_2026-12-01_0915.txt
Enter fullscreen mode Exit fullscreen mode

Collecting several samples throughout the day makes it easier to identify:

  • Unexpected instance restarts.
  • Changes in shared memory usage.
  • Transitions between operating states.
  • Recovery periods following an incident.

If one sample reports Fast Recovery, comparing the surrounding records can also help establish when recovery started and when the instance returned to normal operation.

4. Build a Consistent GBase Database Troubleshooting Routine

The main value of onstat - is not simply that it returns information quickly. It's that it gives engineers a consistent starting point when database connectivity fails.

A practical troubleshooting sequence looks like this:

  1. Run onstat - as the gbasedbt user.
  2. Confirm the instance name and operating state.
  3. Check uptime for unexpected restarts.
  4. Compare Kbytes with historical readings.
  5. Inspect checkpoint indicators if present.
  6. If shared memory is not initialized, verify GBASEDBTSERVER.
  7. Archive the output for future comparison.

Only after confirming the instance state should you move on to listener configuration, network connectivity, database permissions, and application-level troubleshooting.

Conclusion

Effective GBase Database troubleshooting starts with understanding the actual state of the instance, not immediately changing configuration.

The onstat - command provides a quick view of instance status, uptime, shared memory usage, and checkpoint activity without requiring a database connection.

For DBAs and system administrators, making this command part of the regular health-check routine can reduce unnecessary troubleshooting steps and preserve valuable operational evidence.

When a connection alert appears, the first question should be simple:

What state is the database instance actually in?

Top comments (0)