sgautil is a small Linux C utility for attaching Oracle SGA shared memory segments read-only and dumping bytes from a target virtual address in a hex/ASCII table.
The tool reads shared memory segment IDs and attach addresses from ./shminfo, attaches each segment with shmat(..., SHM_RDONLY), verifies the requested address range is inside one of the attached segments, and prints the requested bytes.
sgautil.c- command-line utility implementation.sgautil.h- SGA-related structure definitions and function declarations.Makefile- build and clean targets.shminfo- sample/input file containing shared memory IDs and attach addresses.
- Linux with System V shared memory support.
- A C compiler such as
gccorclang. - Permission to inspect the target shared memory segments.
makeThis creates the sgautil executable in the repository root.
To remove the binary:
make cleanCreate or update shminfo in the repository root. Each line should contain:
<shmid> <attach_address_hex>
Example:
0 0x60000000
1 0x60c00000
2 0x8fc00000
3 0x90400000
The utility uses this file to attach the listed segments before reading memory.
./sgautil <address_hex> <size_decimal> [columns]Arguments:
address_hex- target address to read, in hexadecimal.size_decimal- number of bytes to read, in decimal.columns- optional number of bytes per output row. Defaults to16.
Example:
./sgautil 0x60000000 128- The program attaches shared memory read-only.
- It exits if the requested address range is outside the attached shared memory ranges.
shminfovalues are environment-specific. Review them before running against a different database or host.