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 - 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…
When an application reports a "can't connect" error, the first step should not be to change network settings or query database accounts. Instead, begin by examining the instance using the `onstat -` command. This command reads instance information directly from shared memory, which does not require an active database connection—useful when applications cannot connect to the database.
It's a fast way for DBAs and on-call engineers to determine whether an instance is operating normally, undergoing recovery, or is in an administrative state.
Upon running `onstat -`, examine the instance state, uptime, shared memory usage, and checkpoint indicators. The first field identifies the instance name and its current state, which can be On-Line (normal operation), Quiescent (administrative state), or Fast Recovery (post-crash recovery). Each state requires a different troubleshooting approach. For instance, altering network settings while an instance is in Fast Recovery won't resolve the underlying issue.
Monitor the uptime value that follows "Up," which indicates how long the instance has been running. A sudden drop in uptime may signify an unexpected restart, which can erase in-memory statistics and relevant diagnostic evidence. If the uptime returns to a few seconds unexpectedly, investigate the restart history and maintenance records before proceeding.
The Kbytes field shows the shared memory allocated to the instance. A significant change in Kbytes between readings warrants investigation. However, a single reading is not sufficient to determine the cause; historical comparisons provide more context.
Checkpoint indicators such as (CKPT REQ) or (CKPT INP) may appear, indicating requested or ongoing checkpoints, respectively. While these indicators don't automatically mean an error, they describe checkpoint activity and should be interpreted in the context of the current workload.
If you encounter the error "shared memory not initialized for GBASEDBTSERVER 'gbase01'," this typically means the database instance hasn't been initialized or is not running. Before attempting a restart, verify the `GBASEDBTSERVER` environment variable to ensure it points to the correct instance. If the environment points to the wrong instance, correct it before restarting. Restarting without this confirmation can introduce unnecessary operational risk.
To streamline on-call operations, automate the initial health check using a small shell script. Save the script as `check_state.sh`, make it executable, and run it to display the instance status, capturing it with a timestamp. For example, save the output to `/tmp/state_2026-12-01_0915.txt`. Collecting multiple samples helps identify unexpected restarts, changes in shared memory usage, transitions between operating states, and recovery periods following an incident.
The primary value of `onstat -` is not just its speed but its consistency as a starting point when database connectivity fails. A practical troubleshooting sequence includes running `onstat -` as the `gbasedbt` user, confirming the instance name and state, checking uptime for unexpected restarts, comparing Kbytes with historical readings, inspecting checkpoint indicators, and verifying `GBASEDBTSERVER` if shared memory is not initialized.
Archive the output for future comparison. Only after confirming the instance state should you address listener configuration, network connectivity, database permissions, and application-level issues. Understanding the instance's actual state before taking action is crucial in effective GBase Database troubleshooting.
Rewritten by urgent.news; may contain errors — check the original.
Source: dev.to