DEV Community

mmllllzcn
mmllllzcn

Posted on

TIL: How to Detect a GBase Database Restart with `onstat -`

A small but useful detail in database monitoring: the uptime value in onstat - output can reveal an unexpected instance restart.

Run:

onstat -

# Example output:
gbase01: On-Line -- Up 00:00:13 -- 165364 Kbytes
Enter fullscreen mode Exit fullscreen mode

If yesterday's output showed Up 3 days but today's shows Up 00:00:13, the instance has restarted in between.

Before changing configuration or investigating application errors, check what happened to the database instance.

1. Use Uptime to Detect Instance Restarts

The Up field reports how long the instance has been running.

A sudden drop in uptime is an important operational signal because a restart changes the runtime environment:

  • Shared memory is initialized again.
  • Buffer pool contents are rebuilt.
  • Cumulative runtime statistics start over.

This matters when comparing historical performance readings. For example, a sudden change in cache statistics may reflect a restart and a new measurement period rather than an entirely new performance problem.

For GBase Database (GBase 8s), checking uptime alongside performance statistics helps avoid misleading conclusions.

2. Don't Ignore Kbytes and Instance State

The same onstat - output also reports memory information through Kbytes.

A significant change between consecutive readings deserves investigation. Compare it with historical records and check whether a restart or configuration change occurred.

The instance state is equally important:

  • On-Line: Normal operating state.
  • Quiescent: Quiet administrative state, often associated with maintenance.
  • Fast Recovery: The instance is recovering after a crash.

One common mistake is restarting an instance immediately after seeing Quiescent.

This state does not automatically indicate a failure. Check whether planned maintenance or administrative work is underway before taking action.

You may also encounter:

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

Neither indicator is automatically an error.

A useful troubleshooting order is: check the instance state, investigate recent changes, and then decide whether further action is necessary.

3. Why Restart Detection Matters for Performance Monitoring

An instance restart is more than a change in uptime.

It also changes the context in which performance statistics should be interpreted.

Suppose yesterday's monitoring report showed a stable cache hit rate, but today's reading looks significantly different.

Before concluding that database performance has deteriorated, check whether the instance restarted.

Some statistics are cumulative since startup. After a restart, their counters begin a new measurement period.

Without checking uptime, comparing today's readings with yesterday's can lead to incorrect performance conclusions.

For DBAs and on-call engineers, combining restart detection with historical performance monitoring is a simple way to improve diagnostic accuracy.

4. Archive onstat - Output for Change Tracking

A practical habit is to save every health-check output with a timestamp.

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

For example:

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

Collecting these records regularly helps you:

  • Identify unexpected instance restarts.
  • Compare uptime across monitoring periods.
  • Track changes in reported memory usage.
  • Correlate state transitions with maintenance and change records.
  • Preserve evidence for incident reviews.

After a week, you can compare historical readings instead of relying on someone's memory of what the system looked like before an incident.

Conclusion

The Up field may look like a minor detail in onstat - output, but it provides valuable information for GBase Database monitoring and restart detection.

A database health check should answer two questions:

  1. What is the instance state right now?
  2. What has changed since the previous check?

For production DBAs, the second question is often just as important as the first.

Do you archive your onstat - outputs, or discard them after checking the instance?

Top comments (0)