<ruby id="bdb3f"></ruby>

    <p id="bdb3f"><cite id="bdb3f"></cite></p>

      <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
        <p id="bdb3f"><cite id="bdb3f"></cite></p>

          <pre id="bdb3f"></pre>
          <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

          <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
          <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

          <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                <ruby id="bdb3f"></ruby>

                ThinkChat2.0新版上線,更智能更精彩,支持會話、畫圖、視頻、閱讀、搜索等,送10W Token,即刻開啟你的AI之旅 廣告
                # oid2name ## Name oid2name?--? 解析PostgreSQL 數據目錄里的 OID和文件節點 ## Synopsis `oid2name` [`_選項_`...] ## 描述 oid2nameoid2name 是一個幫助管理員檢查PostgreSQL使用的文件結構的工具程序。要使用 這個工具,你必須熟悉數據庫文件結構,在第58章描述 [Chapter 58](#calibre_link-1510). > **Note:** "oid2name" 很有歷史了,但是實際上有相當的誤導,,因為大多數你使用它的時候, 你將真正和的‘filenode numbers’(他們的文件名在數據庫目錄中是可見的)連接。 請確保你明白表的OID和表filenodes之間的區別 oid2name 連接到一個目標數據庫并且提取OID,文件節點,和/或表名信息 你也可以展示數據庫的OID和表空間的OID ## 選項 oid2name接收下面的命令行參數: `-f` `_filenode_` 展示文件節點是 `_filenode_`的表的信息 `-i` 在這個列表中包含索引和序列 `-o` `_oid_` 展示OID是 `_oid_`的表的信息 `-q` 省略表頭(對腳本很有用) `-s` 展示表空間的OID `-S` 包含在( `information_schema`, `pg_toast` and `pg_catalog` schemas)里的系統對象 `-t` `_tablename_pattern_` 展示匹配`_tablename_pattern_`的表信息 `-V``--version` 打印 oid2name 版本并退出. `-x` 列出每一個被展示的對象的更多信息: tablespace name, schema name, and OID `-?` `--help` 顯示關于 oid2name命令行的幫助信息和參數,并退出 oid2name在連接的時候也接受下面的命令行參數: `-d` `_database_` 連接哪臺數據庫 `-H` `_host_` 數據庫服務器的地址 `-p` `_port_` 數據庫服務器的端口 `-U` `_username_` 連接數據庫的用戶 `-P` `_password_` 密碼(但是不建議這么做,因為把密碼放在命令行存在安全隱患) 要展示特定的表, 選擇要展示的數據庫使用 `-o`, `-f` 和/或 `-t`. `-o` 需要一個 OID, `-f` 需要一個 filenode, `-t` 需要一個表名 (事實上,它是一個 `LIKE` 模式的, 所以你可以使用類似 `foo%`的參數). 只要你喜歡,你可以使用更多的選項,列表將包含所有的匹配這些選項的對象. 但是請注意這些選項只能展示`-d`指派的數據庫里的對象. 如果你沒有提供`-o`, `-f` or `-t`中的任何參數, 但是給了 `-d`參數, 它將列出以`-d`指派的數據庫的所有的表. 在這種模式下,`-S` 和 `-i`選項控制著列表的顯示內容. 如果你也沒有指定 `-d` 它將展示數據庫列表的 OID. 或者你可以通過`-s` 參數去得到表空間的列表 ## 注意 oid2name需要一個正在運行的且系統的catalogs沒有被破壞的數據庫服務器,因此,從遭受災難性破壞的數據庫中恢復數據,將會很有限。 ## 例子 ``` $ # 數據庫服務器上都有哪些數據庫? $ oid2name All databases: Oid Database Name Tablespace ---------------------------------- 17228 alvherre pg_default 17255 regression pg_default 17227 template0 pg_default 1 template1 pg_default $ oid2name -s All tablespaces: Oid Tablespace Name ------------------------- 1663 pg_default 1664 pg_global 155151 fastdisk 155152 bigdisk $ # 好,讓我們進入alvherre數據庫的目錄 $ cd $PGDATA/base/17228 $ # 獲取缺省表空間的前十個數據庫對象,并且以size排序 $ ls -lS * | head -10 -rw------- 1 alvherre alvherre 136536064 sep 14 09:51 155173 -rw------- 1 alvherre alvherre 17965056 sep 14 09:51 1155291 -rw------- 1 alvherre alvherre 1204224 sep 14 09:51 16717 -rw------- 1 alvherre alvherre 581632 sep 6 17:51 1255 -rw------- 1 alvherre alvherre 237568 sep 14 09:50 16674 -rw------- 1 alvherre alvherre 212992 sep 14 09:51 1249 -rw------- 1 alvherre alvherre 204800 sep 14 09:51 16684 -rw------- 1 alvherre alvherre 196608 sep 14 09:50 16700 -rw------- 1 alvherre alvherre 163840 sep 14 09:50 16699 -rw------- 1 alvherre alvherre 122880 sep 6 17:51 16751 $ #我想知道155173這個文件是什么 $ oid2name -d alvherre -f 155173 From database "alvherre": Filenode Table Name ---------------------- 155173 accounts $ # 你也可以請求更多的對象 $ oid2name -d alvherre -f 155173 -f 1155291 From database "alvherre": Filenode Table Name ------------------------- 155173 accounts 1155291 accounts_pkey $ #你可以混合這些選項,通過-x獲取更多的詳細信息 $ oid2name -d alvherre -t accounts -f 1155291 -x From database "alvherre": Filenode Table Name Oid Schema Tablespace ------------------------------------------------------ 155173 accounts 155173 public pg_default 1155291 accounts_pkey 1155291 public pg_default $ # 展示每個數據庫對象所占的磁盤空間 $ du [0-9]* | > while read SIZE FILENODE > do > echo "$SIZE `oid2name -q -d alvherre -i -f $FILENODE`" > done 16 1155287 branches_pkey 16 1155289 tellers_pkey 17561 1155291 accounts_pkey ... $ # 和上面一樣,但是按照大小排序 $ du [0-9]* | sort -rn | while read SIZE FN > do > echo "$SIZE `oid2name -q -d alvherre -f $FN`" > done 133466 155173 accounts 17561 1155291 accounts_pkey 1177 16717 pg_proc_proname_args_nsp_index ... $ # 如果你想看表空間里有什么,使用 pg_tblspc 目錄 $ cd $PGDATA/pg_tblspc $ oid2name -s All tablespaces: Oid Tablespace Name ------------------------- 1663 pg_default 1664 pg_global 155151 fastdisk 155152 bigdisk $ #數據庫在 "fastdisk"表空間都有什么? ? $ ls -d 155151/* 155151/17228/ 155151/PG_VERSION $ # 這個數據庫 17228 又是什么? $ oid2name All databases: Oid Database Name Tablespace ---------------------------------- 17228 alvherre pg_default 17255 regression pg_default 17227 template0 pg_default 1 template1 pg_default $ # 讓我們看看這個數據庫在表空間里都有什么 $ cd 155151/17228 $ ls -l total 0 -rw------- 1 postgres postgres 0 sep 13 23:20 155156 $ # 這個是一個很不錯的小表,但是它是什么表呢? $ oid2name -d alvherre -f 155156 From database "alvherre": Filenode Table Name ---------------------- 155156 foo ``` ## 作者 B. Palmer `&lt;[bpalmer@crimelabs.net](mailto:bpalmer@crimelabs.net)&gt;`
                  <ruby id="bdb3f"></ruby>

                  <p id="bdb3f"><cite id="bdb3f"></cite></p>

                    <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
                      <p id="bdb3f"><cite id="bdb3f"></cite></p>

                        <pre id="bdb3f"></pre>
                        <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

                        <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
                        <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

                        <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                              <ruby id="bdb3f"></ruby>

                              哎呀哎呀视频在线观看