Physical File Parsing Tool - gs_filedump

Function Introduction

gs_filedump is a tool used to parse physical files of the openGauss database, including control files and mapping files, and format their contents into human-readable form. It provides various options to specify block size, range, segments, TOAST, and item interpretation methods. This tool typically does not require the database to be running and can directly dump data from data files.

Prerequisites

Ensure that the database directory exists and the path is correct.

Syntax

gs_filedump [-abcdfhikuxy] [-r relfilenode] [-T reltoastrelid] [-R startblock [endblock]] [-D attrlist] [-S blocksize] [-s segsize] [-n segnumber] FILENAME

Parameter Description

ParameterDescription
-aDisplay absolute addresses (block header information is always relative)
-bDisplay binary block images within the specified range (disables all formatting options)
-dDisplay formatted block content dump (disables all other formatting options)
-DColumn types of the parsed table, separated by commas,
Supported types: bigint, bigserial, bool, char, charN, date, float, float4, float8, int,
json, macaddr, name, numeric, oid, real, serial, smallint, smallserial, text,
time, timestamp, timestamptz, timetz, uuid, varchar, varcharN, xid, xml
~ ignores all remaining attributes in the tuple
-fDisplay formatted block content dump and explanation
-hDisplay help information
-iDisplay detailed information of parsed entries
-kVerify block checksums
-oDo not dump old values
-RSpecify the block range to parse (blocks are indexed starting from 0)
[startblock]: starting block
[endblock]: ending block
If only the starting block is provided, a single block will be formatted
-sForce segment size to [segsize]
-uDecode blocks stored with ustore storage type
-tDump TOAST files (supports astore and ustore storage engines)
-vOutput additional information about TOAST relations
-nForce segment number to [segnumber]
-SForce block size to [blocksize]
-xForce interpretation of block items as index item format
-yForce interpretation of block items as heap item format

When specifying a segmented storage table, the file path must be specified as '{filedir}/1'

ParameterDescription
-rSpecify the relfilenode [relfilenode] of the table
-TSpecify the relfilenode [reltoastrelid] of the table's pg_toast
The parameter -t will not be supported
ParameterDescription
-cInterpret the listed file as a control file
-fDisplay formatted content dump and explanation
-SForce block size to [blocksize]

Additional Features

ParameterDescription
-mInterpret the file as a pg_filenode.map file and print its contents (all other options will be ignored)

Usage Examples

  • Parse a ustore engine table.
gs_filedump -u -ot -D int,timestamp,time,timetz,~  $PGDATA/base/15938/16384
  • Parse a segment table.
 gs_filedump -o -r 4161 -T 4162 -D int,smallint,bigint,~  $PGDATA/base/15938/1
  • Parse control file.
gs_filedump -c $PGDATA/global/pg_control
  • Parse map file.
gs_filedump -m $PGDATA/global/pg_filenode.map

Others

You can use the auxiliary tool gs_desc to obtain table structure information and recommended query commands.

Feedback
编组 3备份
    openGauss 2025-10-31 07:42:18
    cancel