{"id":799,"date":"2013-08-06T17:18:28","date_gmt":"2013-08-06T09:18:28","guid":{"rendered":"http:\/\/j178.mtgbb.com\/?p=799"},"modified":"2013-08-06T17:18:28","modified_gmt":"2013-08-06T09:18:28","slug":"how-do-i-calculate-tables-size-in-oracle","status":"publish","type":"post","link":"https:\/\/j178.mtgbb.com\/?p=799","title":{"rendered":"How do I calculate tables size in Oracle"},"content":{"rendered":"<p>\u8cc7\u6599\u4f86\u6e90: <a href=\"http:\/\/stackoverflow.com\/questions\/264914\/how-do-i-calculate-tables-size-in-oracle\" title=\"\u9019\u88e1\" target=\"_blank\">\u9019\u88e1<\/a><\/p>\n<pre lang=\"oracle8\">\r\nSELECT owner,\r\n       table_name,\r\n       trunc(SUM(tb_bytes) \/ 1024 \/ 1024) meg,\r\n       trunc(SUM(idx_bytes) \/ 1024 \/ 1024) idx_meg,\r\n       trunc(SUM(lob_bytes) \/ 1024 \/ 1024) lob_meg,\r\n       trunc(SUM(lob_idx_bytes) \/ 1024 \/ 1024) lob_idx_meg\r\n  FROM (SELECT segment_name table_name,\r\n               owner,\r\n               bytes        tb_bytes,\r\n               0            idx_bytes,\r\n               0            lob_bytes,\r\n               0            lob_idx_bytes\r\n          FROM dba_segments\r\n         WHERE segment_type = 'TABLE'\r\n               AND owner IN ('XX', 'APPS', 'GIB')\r\n        UNION ALL\r\n        SELECT i.table_name, i.owner, 0, s.bytes, 0, 0\r\n          FROM dba_indexes i, dba_segments s\r\n         WHERE s.segment_name = i.index_name\r\n               AND s.owner = i.owner\r\n               AND s.segment_type = 'INDEX'\r\n               AND i.owner IN ('XX', 'APPS', 'GIB')\r\n        UNION ALL\r\n        SELECT l.table_name, l.owner, 0, 0, s.bytes, 0\r\n          FROM dba_lobs l, dba_segments s\r\n         WHERE s.segment_name = l.segment_name\r\n               AND s.owner = l.owner\r\n               AND s.segment_type = 'LOBSEGMENT'\r\n               AND l.owner IN ('XX', 'APPS', 'GIB')\r\n        UNION ALL\r\n        SELECT l.table_name, l.owner, 0, 0, 0, s.bytes\r\n          FROM dba_lobs l, dba_segments s\r\n         WHERE s.segment_name = l.index_name\r\n               AND s.owner = l.owner\r\n               AND s.segment_type = 'LOBINDEX'\r\n               AND l.owner IN ('XX', 'APPS', 'GIB'))\r\n-- WHERE owner IN upper('&owner')\r\n GROUP BY table_name, owner\r\nHAVING SUM(tb_bytes) \/ 1024 \/ 1024 > 5 \/* Ignore really small tables *\/\r\n ORDER BY SUM(tb_bytes) DESC;\r\n<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>\u8cc7\u6599\u4f86\u6e90: \u9019\u88e1 SELECT owner, table_name, trunc(SUM(tb_bytes)  &hellip;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[12],"tags":[],"class_list":["post-799","post","type-post","status-publish","format-standard","hentry","category-database"],"_links":{"self":[{"href":"https:\/\/j178.mtgbb.com\/index.php?rest_route=\/wp\/v2\/posts\/799","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/j178.mtgbb.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/j178.mtgbb.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/j178.mtgbb.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/j178.mtgbb.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=799"}],"version-history":[{"count":0,"href":"https:\/\/j178.mtgbb.com\/index.php?rest_route=\/wp\/v2\/posts\/799\/revisions"}],"wp:attachment":[{"href":"https:\/\/j178.mtgbb.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=799"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/j178.mtgbb.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=799"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/j178.mtgbb.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=799"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}