oid2name 是一个实用程序,作为contrib 模块提供,可将数据目录中的OID和filenodes转换为人类可读的值。它需要一个正在运行且一致的数据库才能运行(因此,作为取证工具的实用性不大)。
oid2name 在 PostgreSQL 7.1 中被添加。
变更历史
- PostgreSQL 9.3
- 现在设置
fallback_application_name(提交 17676c78)
- 现在设置
- PostgreSQL 8.3
- 移除
-P选项 (提交 4192f2d8)
- 移除
- PostgreSQL 7.1
- 已添加 (提交 2c591cb8)
示例
列出数据库
$ oid2name -U postgres -d postgres -p 5432
All databases:
Oid Database Name Tablespace
----------------------------------
11788 postgres pg_default
16385 test pg_default
11787 template0 pg_default
1 template1 pg_default
postgres=# CREATE TABLE filenode_test (id INT); CREATE TABLE postgres=# SELECT oid, relfilenode FROM pg_class WHERE relname='filenode_test'; oid | relfilenode -------+------------- 16453 | 16453 (1 row) postgres=# VACUUM FULL filenode_test ; VACUUM postgres=# SELECT oid, relfilenode FROM pg_class WHERE relname='filenode_test'; oid | relfilenode -------+------------- 16453 | 16456 (1 row)
使用 oid2name 从 OID (选项 -o) 和/或 filenode (选项 -f) 中提取表名
$ oid2name -U postgres -d postgres -p 5432 -o 16453
From database "postgres":
Filenode Table Name
-------------------------
16456 filenode_test
$ oid2name -U postgres -d postgres -p 5432 -f 16456
From database "postgres":
Filenode Table Name
-------------------------
16456 filenode_test
使用 -x 选项显示其他详细信息
$ oid2name -U postgres -d postgres -p 5432 -o 16453 -x
From database "postgres":
Filenode Table Name Oid Schema Tablespace
----------------------------------------------------
16456 filenode_test 16453 public pg_default
PostgreSQL文档(PostgreSQL documentation)包含了一些进一步的有用示例,包括从数据目录中选择文件名进行操作的shell命令。
参考资料
- PostgreSQL文档: oid2name
分类
反馈
在此处提交关于“oid2name”的任何评论、建议或更正。