postgresql oid2name解析数据目录文件

postgresql oid2name解析数据目录文件,第1张

概述cd /usr/lib/postgresql/9.3/bin ./oid2name --help oid2name helps examining the file structure used by PostgreSQL. Usage:  oid2name [OPTION]... Options:  -d DBNAME      database to connect to  -f FILENO

cd /usr/lib/postgresql/9.3/bin

./oID2name --help

oID2name helps examining the file structure used by Postgresql.


Usage:

oID2name [OPTION]...


Options:

-d DBname database to connect to

-f fileNODE show info for table with given file node

-H HOSTname database server host or socket directory

-i show indexes and sequences too

-o OID show info for table with given OID

-p PORT database server port number

-q quIEt (don't show headers)

-s show all tablespaces

-S show system objects too

-t table show info for named table

-U name connect as specifIEd database user

-V,--version output version information,then exit

-x extended (show additional columns)

-?,--help show this help,then exit


The default action is to show all database OIDs.


使用

列出所有库

postgres@db1:/usr/lib/postgresql/9.3/bin$ ./oID2name

All databases:

OID Database name tablespace

---------------------------------------

16387 a pg_default

16388 b pg_default

16389 c pg_default

16477 d pg_default

32700 empty-next-release pg_default

12042 postgres pg_default

12037 template0 pg_default

1 template1 pg_default


列出所有表空间

postgres@db1:/usr/lib/postgresql/9.3/bin$ ./oID2name -s

All tablespaces:

OID tablespace name

-----------------------

1663 pg_default

1664 pg_global


进入数据目录

cd /var/lib/postgresql/9.3/main/base/12037

postgres@db1:~/9.3/main/base/12037$ ls -ltr | tail -n 8

-rw------- 1 postgres postgres 16384 Oct 31 15:28 11904

-rw------- 1 postgres postgres 24576 Oct 31 15:28 11886_fsm

-rw------- 1 postgres postgres 8192 Oct 31 15:28 11879

-rw------- 1 postgres postgres 0 Oct 31 15:28 11861

-rw------- 1 postgres postgres 8192 Oct 31 15:28 11857_vm

-rw------- 1 postgres postgres 8192 Oct 31 15:28 11827

-rw------- 1 postgres postgres 516096 Oct 31 15:28 11797

-rw------- 1 postgres postgres 8192 Oct 31 15:28 11791


查看11791的文件是什么

postgres@db1:~/9.3/main/base/12037$ cd -

/usr/lib/postgresql/9.3/bin

postgres@db1:/usr/lib/postgresql/9.3/bin$ ./oID2name -d a -f 11791

From database "a":

filenode table name

-------------------------------------

11791 pg_user_mapPing_oID_index

显示更多的信息

postgres@db1:/usr/lib/postgresql/9.3/bin$ ./oID2name -d a -f 11791 -x

From database "a":

filenode table name OID Schema tablespace

------------------------------------------------------------------

11791 pg_user_mapPing_oID_index 174 pg_catalog pg_default

根据 oID 查对表信息

postgres@db1:/usr/lib/postgresql/9.3/bin$ psql -d a -c "select oID,relname from pg_class where relname='pg_user_mapPing_oID_index'"

oID | relname

-----+---------------------------

174 | pg_user_mapPing_oID_index

(1 row)


postgres@db1:/usr/lib/postgresql/9.3/bin$ ./oID2name -d a -o 174

From database "a":

filenode table name

-------------------------------------

11791 pg_user_mapPing_oID_index

总结

以上是内存溢出为你收集整理的postgresql oid2name解析数据目录文件全部内容,希望文章能够帮你解决postgresql oid2name解析数据目录文件所遇到的程序开发问题。

如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。

欢迎分享,转载请注明来源:内存溢出

原文地址:https://54852.com/sjk/1177545.html

(0)
打赏 微信扫一扫微信扫一扫 支付宝扫一扫支付宝扫一扫
上一篇 2022-06-02
下一篇2022-06-02

发表评论

登录后才能评论

评论列表(0条)

    保存