DEV Community

mmllllzcn
mmllllzcn

Posted on

GBase Database: How to Read Shared Memory Segment Classes with onstat -g seg

Today I learned an important detail about GBase Database(GBase 8s) memory monitoring: the class column in onstat -g seg identifies four different types of shared memory segments.

Understanding these classes helps DBAs investigate memory allocation, identify buffer pool segments, and verify process ownership before taking action.

Start with:

onstat -g seg
Enter fullscreen mode Exit fullscreen mode

The four segment classes are:

Class Meaning Purpose
R Resident Holds structures that remain resident in memory
V Virtual Virtual memory segment
B Buffer pool Contains database buffer pool memory
M Messages Used for message-related structures

Reading these four classes separately helps answer a practical question: which part of GBase Database is using the shared memory?

1. Understand the ID and PID Fields

The id and pid columns provide useful references for cross-checking operating system information.

  • id corresponds to the shared memory identifier (shmid) reported by ipcs -m.
  • pid can be cross-checked against operating system processes using ps -ef.

Run:

ipcs -m | head -20
ps -ef | grep oninit
Enter fullscreen mode Exit fullscreen mode

Both checks are important when investigating GBase Database shared memory issues.

Before attempting to remove a shared memory segment or interact with a process, confirm its ownership. Acting on the wrong segment or process can create serious problems in a production environment.

2. Don't Misread the Locked Segment Indicator

You may also see this message at the end of the output:

(* segment locked in memory)
Enter fullscreen mode Exit fullscreen mode

This indicates that the shared memory segment is locked in memory.

It is not, by itself, an error or an alert.

This is a small detail worth including in a GBase Database DBA checklist. Under pressure, unfamiliar output can easily be mistaken for an abnormal condition.

3. Cross-Check Three Outputs Before Taking Action

A practical way to investigate GBase Database shared memory is to compare three command outputs.

Step 1: Identify segment information

onstat -g seg
Enter fullscreen mode Exit fullscreen mode

Record the segment classes, IDs, and associated process information.

Step 2: Verify shared memory identifiers

ipcs -m
Enter fullscreen mode Exit fullscreen mode

Confirm that the reported shared memory IDs correspond to existing operating system segments.

Step 3: Verify process ownership

ps -ef | grep oninit
Enter fullscreen mode Exit fullscreen mode

Check whether the relevant process IDs belong to the expected GBase Database instance.

Only after these references are consistent should you proceed with further investigation.

If the IDs or process information do not match expectations, stop and investigate the discrepancy instead of guessing.

4. Identify Buffer Pool Memory Allocation

The B class represents the buffer pool segment.

This is particularly useful when checking whether the GBase Database buffer pool was allocated as expected during instance startup.

By identifying the B-class segment and examining its size, DBAs can compare the actual shared memory allocation with the configured buffer pool size.

This provides a practical starting point for investigating memory allocation differences.

5. Connect Segment Diagnostics with Machine-Level Resources

Shared memory problems do not always originate from database configuration.

In some cases, the operating system may not provide sufficient shared memory resources or semaphore capacity for the instance to start successfully.

This is where another diagnostic command becomes useful:

onstat -g osi
Enter fullscreen mode Exit fullscreen mode

Pay attention to:

  • System free memory
  • shmmax
  • shmids

Combining onstat -g osi with onstat -g seg helps narrow down GBase Database startup problems.

The distinction is important:

  • Machine layer: Does the operating system provide sufficient resources?
  • Segment layer: Were the expected shared memory segments allocated?
  • Process layer: Do the associated process identifiers match the expected database processes?

This layered approach helps DBAs identify where to investigate before changing database parameters or operating system settings.

Conclusion: Verify Ownership Before Changing Memory Resources

GBase Database(GBase 8s) exposes shared memory segment classes directly through onstat -g seg.

The key information is straightforward:

  • R, V, B, and M identify different segment classes.
  • id can be cross-checked with ipcs -m.
  • pid can be cross-checked with ps -ef.
  • (* segment locked in memory) is an informational indicator, not automatically an error.

For production database administration, the order matters: confirm ownership first, identify the anomaly second, and take action only after the evidence supports it.

Do you routinely cross-check ipcs -m when investigating GBase Database shared memory issues?

Top comments (0)