{"id":75,"date":"2015-03-30T10:48:00","date_gmt":"2015-03-30T13:48:00","guid":{"rendered":"http:\/\/maxoracle.com\/2015\/03\/30\/tamanho-de-uma-tabela\/"},"modified":"2015-03-30T10:48:00","modified_gmt":"2015-03-30T13:48:00","slug":"tamanho-de-uma-tabela","status":"publish","type":"post","link":"https:\/\/www.soudba.com.br\/?p=75","title":{"rendered":"Tamanho de uma tabela"},"content":{"rendered":"<p>Ola pessoal,<\/p>\n<p>venho a mostrar a voces como temos o tamanho de uma tabela e de seus indices<\/p>\n<div style=\"background-color:white;margin-bottom:1em;margin-top:1em;text-align:justify;\"><span style=\"font-family:Arial;\"><span style=\"font-size:13.333333015442px;\">\u2013 Tamanho de Cada Tabela<\/span><\/span><\/div>\n<div style=\"background-color:white;margin-bottom:1em;margin-top:1em;text-align:justify;\"><span style=\"font-family:Arial;\"><span style=\"font-size:13.333333015442px;\"><br \/><\/span><\/span><\/div>\n<div style=\"background-color:white;margin-bottom:1em;margin-top:1em;text-align:justify;\"><span style=\"font-family:Arial;\"><span style=\"font-size:13.333333015442px;\">SELECT substr(owner,1,15) owner,segment_type,&nbsp;<\/span><\/span><\/div>\n<div style=\"background-color:white;margin-bottom:1em;margin-top:1em;text-align:justify;\"><span style=\"font-family:Arial;\"><span style=\"font-size:13.333333015442px;\">substr(tablespace_name,1,15) tablespace_name,&nbsp;<\/span><\/span><\/div>\n<div style=\"background-color:white;margin-bottom:1em;margin-top:1em;text-align:justify;\"><span style=\"font-family:Arial;\"><span style=\"font-size:13.333333015442px;\">round(sum(bytes\/1024\/1024),2) as Tamanho_MB&nbsp;<\/span><\/span><\/div>\n<div style=\"background-color:white;margin-bottom:1em;margin-top:1em;text-align:justify;\"><span style=\"font-family:Arial;\"><span style=\"font-size:13.333333015442px;\">FROM dba_segments<\/span><\/span><\/div>\n<div style=\"background-color:white;margin-bottom:1em;margin-top:1em;text-align:justify;\"><span style=\"font-family:Arial;\"><span style=\"font-size:13.333333015442px;\">WHERE owner = &#8216;SANKHYA&#8217;<\/span><\/span><\/div>\n<div style=\"background-color:white;margin-bottom:1em;margin-top:1em;text-align:justify;\"><span style=\"font-family:Arial;\"><span style=\"font-size:13.333333015442px;\">AND segment_type = &#8216;TABLE&#8217;<\/span><\/span><\/div>\n<div style=\"background-color:white;margin-bottom:1em;margin-top:1em;text-align:justify;\"><span style=\"font-family:Arial;\"><span style=\"font-size:13.333333015442px;\">AND segment_name like &#8216;TSILGT%&#8217;<\/span><\/span><\/div>\n<div style=\"background-color:white;margin-bottom:1em;margin-top:1em;text-align:justify;\"><span style=\"font-family:Arial;\"><span style=\"font-size:13.333333015442px;\">GROUP BY owner,segment_type, tablespace_name, segment_name<\/span><\/span><\/div>\n<div style=\"background-color:white;margin-bottom:1em;margin-top:1em;text-align:justify;\"><span style=\"font-family:Arial;\"><span style=\"font-size:13.333333015442px;\">union all<\/span><\/span><\/div>\n<div style=\"background-color:white;margin-bottom:1em;margin-top:1em;text-align:justify;\"><span style=\"font-family:Arial;\"><span style=\"font-size:13.333333015442px;\">SELECT substr(owner,1,15) owner,segment_type,&nbsp;<\/span><\/span><\/div>\n<div style=\"background-color:white;margin-bottom:1em;margin-top:1em;text-align:justify;\"><span style=\"font-family:Arial;\"><span style=\"font-size:13.333333015442px;\">substr(tablespace_name,1,15) tablespace_name,&nbsp;<\/span><\/span><\/div>\n<div style=\"background-color:white;margin-bottom:1em;margin-top:1em;text-align:justify;\"><span style=\"font-family:Arial;\"><span style=\"font-size:13.333333015442px;\">round(sum(bytes\/1024\/1024),2) as Tamanho_MB&nbsp;<\/span><\/span><\/div>\n<div style=\"background-color:white;margin-bottom:1em;margin-top:1em;text-align:justify;\"><span style=\"font-family:Arial;\"><span style=\"font-size:13.333333015442px;\">FROM dba_segments<\/span><\/span><\/div>\n<div style=\"background-color:white;margin-bottom:1em;margin-top:1em;text-align:justify;\"><span style=\"font-family:Arial;\"><span style=\"font-size:13.333333015442px;\">WHERE owner = &#8216;SANKHYA&#8217;<\/span><\/span><\/div>\n<div style=\"background-color:white;margin-bottom:1em;margin-top:1em;text-align:justify;\"><span style=\"font-family:Arial;\"><span style=\"font-size:13.333333015442px;\">AND segment_type = &#8216;INDEX&#8217;<\/span><\/span><\/div>\n<div style=\"background-color:white;margin-bottom:1em;margin-top:1em;text-align:justify;\"><span style=\"font-family:Arial;\"><span style=\"font-size:13.333333015442px;\">AND segment_name in (<\/span><\/span><\/div>\n<div style=\"background-color:white;margin-bottom:1em;margin-top:1em;text-align:justify;\"><span style=\"font-family:Arial;\"><span style=\"font-size:13.333333015442px;\">select index_name&nbsp;<\/span><\/span><\/div>\n<div style=\"background-color:white;margin-bottom:1em;margin-top:1em;text-align:justify;\"><span style=\"font-family:Arial;\"><span style=\"font-size:13.333333015442px;\">from dba_indexes&nbsp;<\/span><\/span><\/div>\n<div style=\"background-color:white;margin-bottom:1em;margin-top:1em;text-align:justify;\"><span style=\"font-family:Arial;\"><span style=\"font-size:13.333333015442px;\">where table_name = &#8216;TSILGT&#8217;<\/span><\/span><\/div>\n<div style=\"background-color:white;margin-bottom:1em;margin-top:1em;text-align:justify;\"><span style=\"font-family:Arial;\"><span style=\"font-size:13.333333015442px;\">and owner = &#8216;SANKHYA&#8217;)<\/span><\/span><\/div>\n<div style=\"background-color:white;margin-bottom:1em;margin-top:1em;text-align:justify;\"><\/div>\n<div style=\"background-color:white;margin-bottom:1em;margin-top:1em;text-align:justify;\"><span style=\"font-family:Arial;\"><span style=\"font-size:13.333333015442px;\">GROUP BY owner,segment_type, tablespace_name, segment_name;<\/span><\/span><\/div>\n<div style=\"text-align:justify;\"><\/div>\n<div style=\"background-color:white;margin-bottom:1em;margin-top:1em;text-align:justify;\"><span style=\"font-family:Arial;\"><span style=\"font-size:13.333333015442px;\">SELECT owner, tablespace_name, segment_name,<\/span><\/span><\/div>\n<div style=\"background-color:white;margin-bottom:1em;margin-top:1em;text-align:justify;\"><span style=\"font-family:Arial;\"><span style=\"font-size:13.333333015442px;\">round(sum(bytes\/1024\/1024),2) as Tamanho_MB \u2013, extents as Num_extents<\/span><\/span><\/div>\n<div style=\"background-color:white;margin-bottom:1em;margin-top:1em;text-align:justify;\"><span style=\"font-family:Arial;\"><span style=\"font-size:13.333333015442px;\">FROM dba_segments<\/span><\/span><\/div>\n<div style=\"background-color:white;margin-bottom:1em;margin-top:1em;text-align:justify;\"><span style=\"font-family:Arial;\"><span style=\"font-size:13.333333015442px;\">WHERE owner = &#8216;SCOTT&#8217;<\/span><\/span><\/div>\n<div style=\"background-color:white;margin-bottom:1em;margin-top:1em;text-align:justify;\"><span style=\"font-family:Arial;\"><span style=\"font-size:13.333333015442px;\">AND segment_type = &#8216;TABLE&#8217;<\/span><\/span><\/div>\n<div style=\"background-color:white;margin-bottom:1em;margin-top:1em;text-align:justify;\"><span style=\"font-family:Arial;\"><span style=\"font-size:13.333333015442px;\">\u2014 AND segment_name like &#8216;DEPT%&#8217;<\/span><\/span><\/div>\n<div style=\"background-color:white;margin-bottom:1em;margin-top:1em;text-align:justify;\"><span style=\"font-family:Arial;\"><span style=\"font-size:13.333333015442px;\">GROUP BY owner, tablespace_name, segment_name<\/span><\/span><\/div>\n<div style=\"background-color:white;margin-bottom:1em;margin-top:1em;text-align:justify;\"><span style=\"font-family:Arial;\"><span style=\"font-size:13.333333015442px;\"><br \/><\/span><\/span><\/div>\n<div style=\"background-color:white;margin-bottom:1em;margin-top:1em;text-align:justify;\"><span style=\"font-family:Arial;\"><span style=\"font-size:13.333333015442px;\">\u2013 Tamanho das Tabelas Por Usu\u00e1rio<\/span><\/span><\/div>\n<div style=\"background-color:white;margin-bottom:1em;margin-top:1em;text-align:justify;\"><span style=\"font-family:Arial;\"><span style=\"font-size:13.333333015442px;\"><br \/><\/span><\/span><\/div>\n<div style=\"background-color:white;margin-bottom:1em;margin-top:1em;text-align:justify;\"><span style=\"font-family:Arial;\"><span style=\"font-size:13.333333015442px;\">SELECT owner, round(sum(bytes\/1024\/1024),2) as Tamanho_MB \u2013, extents as Num_extents<\/span><\/span><\/div>\n<div style=\"background-color:white;margin-bottom:1em;margin-top:1em;text-align:justify;\"><span style=\"font-family:Arial;\"><span style=\"font-size:13.333333015442px;\">FROM dba_segments<\/span><\/span><\/div>\n<div style=\"background-color:white;margin-bottom:1em;margin-top:1em;text-align:justify;\"><span style=\"font-family:Arial;\"><span style=\"font-size:13.333333015442px;\">GROUP BY owner<\/span><\/span><\/div>\n<div style=\"background-color:white;margin-bottom:1em;margin-top:1em;text-align:justify;\"><sp\nan style=\"font-family:Arial;\"><span style=\"font-size:13.333333015442px;\"><br \/><\/span><\/span><\/div>\n<div style=\"background-color:white;margin-bottom:1em;margin-top:1em;text-align:justify;\"><span style=\"font-family:Arial;\"><span style=\"font-size:13.333333015442px;\">\u2013 Tamanho Total das Tabelas<\/span><\/span><\/div>\n<div style=\"background-color:white;margin-bottom:1em;margin-top:1em;text-align:justify;\"><span style=\"font-family:Arial;\"><span style=\"font-size:13.333333015442px;\"><br \/><\/span><\/span><\/div>\n<div style=\"background-color:white;margin-bottom:1em;margin-top:1em;text-align:justify;\"><span style=\"font-family:Arial;\"><span style=\"font-size:13.333333015442px;\">SELECT round(sum(bytes\/1024\/1024),2) as Tamanho_MB \u2013, extents as Num_extents<\/span><\/span><\/div>\n<div style=\"background-color:white;margin-bottom:1em;margin-top:1em;text-align:justify;\"><span style=\"font-family:Arial;\"><span style=\"font-size:13.333333015442px;\">FROM dba_segments<\/span><\/span><\/div>\n<div style=\"background-color:white;margin-bottom:1em;margin-top:1em;text-align:justify;\"><span style=\"font-family:Arial;\"><span style=\"font-size:13.333333015442px;\"><br \/><\/span><\/span><\/div>\n<div style=\"background-color:white;margin-bottom:1em;margin-top:1em;text-align:justify;\"><span style=\"font-family:Arial;\"><span style=\"font-size:13.333333015442px;\">\u2013 % de Uso das TableSpaces<\/span><\/span><\/div>\n<div style=\"background-color:white;margin-bottom:1em;margin-top:1em;text-align:justify;\"><span style=\"font-family:Arial;\"><span style=\"font-size:13.333333015442px;\"><br \/><\/span><\/span><\/div>\n<div style=\"background-color:white;margin-bottom:1em;margin-top:1em;text-align:justify;\"><span style=\"font-family:Arial;\"><span style=\"font-size:13.333333015442px;\">SELECT a.TABLESPACE_NAME &#8220;TableSpace Name&#8221;,<\/span><\/span><\/div>\n<div style=\"background-color:white;margin-bottom:1em;margin-top:1em;text-align:justify;\"><span style=\"font-family:Arial;\"><span style=\"font-size:13.333333015442px;\">round(a.BYTES\/1024\/1024) &#8220;MB Allocated&#8221;,<\/span><\/span><\/div>\n<div style=\"background-color:white;margin-bottom:1em;margin-top:1em;text-align:justify;\"><span style=\"font-family:Arial;\"><span style=\"font-size:13.333333015442px;\">round((a.BYTES-nvl(b.BYTES, 0)) \/ 1024 \/ 1024) &#8220;MB Used&#8221;,<\/span><\/span><\/div>\n<div style=\"background-color:white;margin-bottom:1em;margin-top:1em;text-align:justify;\"><span style=\"font-family:Arial;\"><span style=\"font-size:13.333333015442px;\">nvl(round(b.BYTES \/ 1024 \/ 1024), 0) &#8220;MB Free&#8221;,<\/span><\/span><\/div>\n<div style=\"background-color:white;margin-bottom:1em;margin-top:1em;text-align:justify;\"><span style=\"font-family:Arial;\"><span style=\"font-size:13.333333015442px;\">round(((a.BYTES-nvl(b.BYTES, 0))\/a.BYTES)*100,2) &#8220;Pct Used&#8221;,<\/span><\/span><\/div>\n<div style=\"background-color:white;margin-bottom:1em;margin-top:1em;text-align:justify;\"><span style=\"font-family:Arial;\"><span style=\"font-size:13.333333015442px;\">round((1-((a.BYTES-nvl(b.BYTES,0))\/a.BYTES))*100,2) &#8220;Pct Free&#8221;<\/span><\/span><\/div>\n<div style=\"background-color:white;margin-bottom:1em;margin-top:1em;text-align:justify;\"><span style=\"font-family:Arial;\"><span style=\"font-size:13.333333015442px;\">FROM (SELECT TABLESPACE_NAME,<\/span><\/span><\/div>\n<div style=\"background-color:white;margin-bottom:1em;margin-top:1em;text-align:justify;\"><span style=\"font-family:Arial;\"><span style=\"font-size:13.333333015442px;\">sum(BYTES) BYTES<\/span><\/span><\/div>\n<div style=\"background-color:white;margin-bottom:1em;margin-top:1em;text-align:justify;\"><span style=\"font-family:Arial;\"><span style=\"font-size:13.333333015442px;\">FROM dba_data_files<\/span><\/span><\/div>\n<div style=\"background-color:white;margin-bottom:1em;margin-top:1em;text-align:justify;\"><span style=\"font-family:Arial;\"><span style=\"font-size:13.333333015442px;\">GROUP BY TABLESPACE_NAME) a,<\/span><\/span><\/div>\n<div style=\"background-color:white;margin-bottom:1em;margin-top:1em;text-align:justify;\"><span style=\"font-family:Arial;\"><span style=\"font-size:13.333333015442px;\">(SELECT TABLESPACE_NAME,<\/span><\/span><\/div>\n<div style=\"background-color:white;margin-bottom:1em;margin-top:1em;text-align:justify;\"><span style=\"font-family:Arial;\"><span style=\"font-size:13.333333015442px;\">sum(BYTES) BYTES<\/span><\/span><\/div>\n<div style=\"background-color:white;margin-bottom:1em;margin-top:1em;text-align:justify;\"><span style=\"font-family:Arial;\"><span style=\"font-size:13.333333015442px;\">FROM sys.dba_free_space<\/span><\/span><\/div>\n<div style=\"background-color:white;margin-bottom:1em;margin-top:1em;text-align:justify;\"><span style=\"font-family:Arial;\"><span style=\"font-size:13.333333015442px;\">GROUP BY TABLESPACE_NAME) b<\/span><\/span><\/div>\n<div style=\"background-color:white;margin-bottom:1em;margin-top:1em;text-align:justify;\"><span style=\"font-family:Arial;\"><span style=\"font-size:13.333333015442px;\">WHERE a.TABLESPACE_NAME = b.TABLESPACE_NAME (+)<\/span><\/span><\/div>\n<div style=\"background-color:white;margin-bottom:1em;margin-top:1em;text-align:justify;\"><span style=\"font-family:Arial;\"><span style=\"font-size:13.333333015442px;\">ORDER BY ((a.BYTES-b.BYTES)\/a.BYTES);<\/span><\/span><\/div>\n<div style=\"background-color:white;font-family:'Lucida Grande', 'Lucida Sans Unicode', Arial, sans-serif;font-size:11.663999557495px;margin-bottom:1em;margin-top:1em;text-align:justify;\"><\/div>\n","protected":false},"excerpt":{"rendered":"<p>Ola pessoal, venho a mostrar a voces como temos o tamanho de uma tabela e de seus indices \u2013 Tamanho de Cada Tabela SELECT substr(owner,1,15) owner,segment_type,&nbsp; substr(tablespace_name,1,15) tablespace_name,&nbsp; round(sum(bytes\/1024\/1024),2) as Tamanho_MB&nbsp; FROM dba_segments WHERE owner = &#8216;SANKHYA&#8217; AND segment_type = &hellip; <a href=\"https:\/\/www.soudba.com.br\/?p=75\">Continue lendo <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-75","post","type-post","status-publish","format-standard","hentry","category-sem-categoria"],"_links":{"self":[{"href":"https:\/\/www.soudba.com.br\/index.php?rest_route=\/wp\/v2\/posts\/75","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.soudba.com.br\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.soudba.com.br\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.soudba.com.br\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.soudba.com.br\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=75"}],"version-history":[{"count":0,"href":"https:\/\/www.soudba.com.br\/index.php?rest_route=\/wp\/v2\/posts\/75\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.soudba.com.br\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=75"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.soudba.com.br\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=75"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.soudba.com.br\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=75"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}