土曜日, 7月 21, 2007

[PostgreSQL] pg_filedump

PostgreSQLのデータファイルをダンプするツールがRH社から公開されていた。無論RHDB用としてだが普通に(コミュニティ版PostgreSQLでも)使える様子。

clipped from sources.redhat.com

pg_filedump is a utility to format PostgreSQL heap, index, and control files into a human-readable form. You can format/dump the files several ways as well as dumping straight binary. This utility is intended to aid in the understanding of the internal contents of a PostgreSQL block.
 blog it

ちょっと使ってみたので出力を以下に貼り付けておきます。

[tf0054@domU pg_filedump-8.2]$ ./pg_filedump -f /var/tmp/8694215

*******************************************************************
* PostgreSQL File/Block Formatted Dump Utility - Version 8.2.0
*
* File: /var/tmp/8694215
* Options used: -f
*
* Dump created on: Sat Jul 21 03:53:38 2007
*******************************************************************

Block 0 ********************************************************
-----
Block Offset: 0x00000000 Offsets: Lower 44 (0x002c)
Block: Size 8192 Version 3 Upper 8176 (0x1ff0)
LSN: logid 6 recoff 0x74e17274 Special 8176 (0x1ff0)
Items: 6 Free Space: 8132
Length (including item array): 44

BTree Meta Data: Magic (0x00053162) Version (2)
Root: Block (1) Level (0)
FastRoot: Block (1) Level (0)

0000: 06000000 7472e174 01000000 2c00f01f ....tr.t....,...
0010: f01f0320 62310500 02000000 01000000 ... b1..........
0020: 00000000 01000000 00000000 00000000 ................
0030: 00000000 00000000 00000000 00000000 ................
0040: 00000000 ....

-----
BTree Index Section:
Flags: 0x0008 (META)
Blocks: Previous (0) Next (0) Level (0) CycleId (0)

1ff0: 00000000 00000000 00000000 08000000 ................


Block 1 ********************************************************
-----
Block Offset: 0x00002000 Offsets: Lower 44 (0x002c)
Block: Size 8192 Version 3 Upper 8104 (0x1fa8)
LSN: logid 6 recoff 0x74e17ca4 Special 8176 (0x1ff0)
Items: 6 Free Space: 8060
Length (including item array): 44

0000: 06000000 a47ce174 01000000 2c00a81f .....|.t....,...
0010: f01f0320 e49f1800 d89f1800 cc9f1800 ... ............
0020: c09f1800 b49f1800 a89f1800 ............

------
Item 1 -- Length: 12 Offset: 8164 (0x1fe4) Flags: USED
1fe4: 00000000 01000c00 01000000 ............

Item 2 -- Length: 12 Offset: 8152 (0x1fd8) Flags: USED
1fd8: 00000000 02000c00 02000000 ............

Item 3 -- Length: 12 Offset: 8140 (0x1fcc) Flags: USED
1fcc: 00000000 03000c00 03000000 ............

Item 4 -- Length: 12 Offset: 8128 (0x1fc0) Flags: USED
1fc0: 00000000 04000c00 04000000 ............

Item 5 -- Length: 12 Offset: 8116 (0x1fb4) Flags: USED
1fb4: 00000000 05000c00 05000000 ............

Item 6 -- Length: 12 Offset: 8104 (0x1fa8) Flags: USED
1fa8: 00000000 06000c00 06000000 ............


-----
BTree Index Section:
Flags: 0x0003 (LEAF|ROOT)
Blocks: Previous (0) Next (0) Level (0) CycleId (0)

1ff0: 00000000 00000000 00000000 03000000 ................


*** End of File Encountered. Last Block Read: 1 ***
[tf0054@domU pg_filedump-8.2]$

Oracleで"alter system dump datafile"と同レベルまでは行っているように思われます。すばらしい。

0 コメント:

Twitter Updates

 
.