1 개요[ | ]
- oid2name
- 관리자가 PostgreSQL에 의해 사용되는 파일 구조를 조사하는 유틸리티
- PostgreSQL 데이터 디렉토리 내의 OID와 파일노드를 조회하는 명령어
- PostgreSQL에 접근하지 않고 데이터베이스 리스트와 oid확인[1]
Synopsis
Bash
Copy
oid2name [option...]
2 실행예시[ | ]
기본 (Database의 Oid 확인)
Console
Copy
$ oid2name
All databases:
Oid Database Name Tablespace
----------------------------------
16386 database1 pg_default
18094 databasetmp pg_default
12780 postgres pg_default
12772 template0 pg_default
1 template1 pg_default
18101 xidtest1 pg_default
-s (Tablespace의 Oid 확인)
Console
Copy
$ oid2name -s
All tablespaces:
Oid Tablespace Name
------------------------
1663 pg_default
1664 pg_global
16387 tablespace01
-x (상세), -d (Database 지정)
Console
Copy
$ oid2name -x -d database1
From database "database1":
Filenode Table Name Oid Schema Tablespace
-------------------------------------------------
18098 r 18098 public pg_default
18017 t1 18017 public pg_default
16586 t1 16586 scm01 pg_default
16609 t1 16609 u0 pg_default
17552 t11 17552 public pg_default
18020 t1_pkey 18020 public pg_default
16934 t1_rireki 16934 public pg_default
16598 t2 16598 user01 pg_default
18022 t2 18022 public pg_default
18025 t2_pkey 18025 public pg_default
- → 위 예시에서는 Filenode와 Oid가 같지만, 항상 그런 것은 아니다.
-t (Table 지정, 여러 개 지정 가능, %로 LIKE 검색)
Console
Copy
$ oid2name -d database1 -t t1% -t t2% -x
Filenode Table Name Oid Schema Tablespace
-------------------------------------------------
18017 t1 18017 public pg_default
16586 t1 16586 scm01 pg_default
16609 t1 16609 u0 pg_default
17552 t11 17552 public pg_default
18020 t1_pkey 18020 public pg_default
16934 t1_rireki 16934 public pg_default
16598 t2 16598 user01 pg_default
18022 t2 18022 public pg_default
18025 t2_pkey 18025 public pg_default
3 같이 보기[ | ]
4 참고[ | ]
- https://www.postgresql.org/docs/current/oid2name.html
- https://github.com/postgres/postgres/blob/master/contrib/oid2name/oid2name.c
- ↑ oid는 각 데이터베이스의 탑레벨(<path to database dir>/data/base) 디렉토리임
편집자 John Jeong Jmnote
로그인하시면 댓글을 쓸 수 있습니다.