How can i view and read files in PostgreSQL "data\base" directory. I try to use "pg_ctl" to import this directory to my server as a database but It failed. i try to make a tar archive and restore it using pgadmin, but it return toc heading error. I know that each folder in "data/base" is a database OID and each file is a table and relative data. these files like a binary or dat file like this:(16384/1174)
€ëÌ 0 ðð b1 0ëÌ Ô ð àŸ ÐŸ ÀŸ °Ÿ Ÿ Ÿ €Ÿ pŸ Ÿ PŸ @Ÿ 0Ÿ Ÿ Ÿ Ÿ ðž àž Ðž Àž °ž ž ž €ž pž
ž Pž @ž 0ž ž ž ž ð à Ð À ° € p P @ 0 ðœ àœ Ðœ Àœ °œ œ œ €œ pœ
œ Pœ @œ 0œ œ œ œ ð› à› Ð› À› °› › › €› p› `› P› @› 0› › › › ðš àš Ðš Àš °š š
Is there any way to view and read?? I want to retrieve tables and data in it. I searched a lot and not found any true solution. please help. thanks a lot.
neither
pg_ctl
. norpgAdmin
, nor any SQL client can work with database files themselves. If you want to read the file, you sould study the page structure (link below) and how to use that knowledge. So answering Is there any way to view and read?? yes, basically you quote contents in your question. But you can't use it to costruct table or index data. Unless you backingeneer the postgres. Or try to hack it to make it think your16384/1174
file is existing relation - both are out of SO scope I believe.below some reference on the structure, that you try to read
https://www.postgresql.org/docs/current/static/storage-page-layout.html
and further: