{"id":315,"date":"2013-01-12T16:53:31","date_gmt":"2013-01-12T08:53:31","guid":{"rendered":"http:\/\/www.yallonking.com\/?p=315"},"modified":"2013-01-12T18:06:06","modified_gmt":"2013-01-12T10:06:06","slug":"scripts%ef%bc%9a%e6%9f%a5%e7%9c%8b%e6%95%b0%e6%8d%ae%e5%ba%93%e5%8e%86%e5%8f%b2%e5%a2%9e%e9%95%bf%e6%83%85%e5%86%b5","status":"publish","type":"post","link":"http:\/\/www.yallonking.com\/?p=315","title":{"rendered":"scripts:\u67e5\u770b\u6570\u636e\u5e93\u5386\u53f2\u589e\u957f\u60c5\u51b5"},"content":{"rendered":"<p>\u67e5\u770b\u6570\u636e\u5e93\u5386\u53f2\u589e\u957f\u60c5\u51b5<br \/>\n\u6b64\u5904\u662f\u901a\u8fc7\u8ba1\u7b97\u6570\u636e\u5e93\u6240\u6709\u8868\u7a7a\u95f4\u7684\u5386\u53f2\u589e\u957f\u60c5\u51b5\u6765\u8ba1\u7b97\u6570\u636e\u5e93\u5386\u53f2\u60c5\u51b5\u3002<br \/>\n--\u4e0d\u542bundo\u548ctemp<br \/>\n<coolcode lang=\"sql\"><br \/>\nwith tmp as<br \/>\n(select rtime,<br \/>\n                       sum(tablespace_usedsize_kb) tablespace_usedsize_kb,<br \/>\n                       sum(tablespace_size_kb) tablespace_size_kb<br \/>\n                  from (select rtime,<br \/>\n                               e.tablespace_id,<br \/>\n                               (e.tablespace_usedsize) * (f.block_size) \/ 1024 tablespace_usedsize_kb,<br \/>\n                               (e.tablespace_size) * (f.block_size) \/ 1024 tablespace_size_kb<br \/>\n                          from dba_hist_tbspc_space_usage e,<br \/>\n                               dba_tablespaces            f,<br \/>\n                               v$tablespace               g<br \/>\n                         where e.tablespace_id = g.TS#<br \/>\n                           and f.tablespace_name = g.NAME<br \/>\n                           and f.contents not in ('TEMPORARY','UNDO'))<br \/>\n                 group by rtime)<br \/>\n       select tmp.rtime,<br \/>\n              tablespace_usedsize_kb,<br \/>\n              tablespace_size_kb,<br \/>\n              (tablespace_usedsize_kb -<br \/>\n              LAG(tablespace_usedsize_kb, 1, NULL) OVER(ORDER BY tmp.rtime)) AS DIFF_KB<br \/>\n         from tmp,<br \/>\n              (select max(rtime) rtime<br \/>\n                 from tmp<br \/>\n                group by substr(rtime, 1, 10)) t2<br \/>\n        where t2.rtime = tmp.rtime;<br \/>\n<\/coolcode><br \/>\n--\u542bundo\u548ctemp<br \/>\n<coolcode lang=\"sql\"><br \/>\nwith tmp as<br \/>\n(select min(rtime) rtime,<br \/>\n                       sum(tablespace_usedsize_kb) tablespace_usedsize_kb,<br \/>\n                       sum(tablespace_size_kb) tablespace_size_kb<br \/>\n                  from (select rtime,<br \/>\n                               e.tablespace_id,<br \/>\n                               (e.tablespace_usedsize) * (f.block_size) \/ 1024 tablespace_usedsize_kb,<br \/>\n                               (e.tablespace_size) * (f.block_size) \/ 1024 tablespace_size_kb<br \/>\n                          from dba_hist_tbspc_space_usage e,<br \/>\n                               dba_tablespaces            f,<br \/>\n                               v$tablespace               g<br \/>\n                         where e.tablespace_id = g.TS#<br \/>\n                           and f.tablespace_name = g.NAME)<br \/>\n                 group by rtime)<br \/>\n       select tmp.rtime,<br \/>\n              tablespace_usedsize_kb,<br \/>\n              tablespace_size_kb,<br \/>\n              (tablespace_usedsize_kb -<br \/>\n              LAG(tablespace_usedsize_kb, 1, NULL) OVER(ORDER BY tmp.rtime)) AS DIFF_KB<br \/>\n         from tmp,<br \/>\n              (select min(rtime) rtime<br \/>\n                 from tmp<br \/>\n                group by substr(rtime, 1, 10)) t2 where t2.rtime = tmp.rtime<br \/>\n<\/coolcode><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u67e5\u770b\u6570\u636e\u5e93\u5386\u53f2\u589e\u957f\u60c5\u51b5 \u6b64\u5904\u662f\u901a\u8fc7\u8ba1\u7b97\u6570\u636e\u5e93\u6240\u6709\u8868\u7a7a\u95f4\u7684\u5386\u53f2\u589e\u957f\u60c5\u51b5\u6765\u8ba1\u7b97\u6570\u636e\u5e93\u5386\u53f2\u60c5\u51b5\u3002 &#8211;\u4e0d\u542bundo\u548c [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[9],"tags":[],"_links":{"self":[{"href":"http:\/\/www.yallonking.com\/index.php?rest_route=\/wp\/v2\/posts\/315"}],"collection":[{"href":"http:\/\/www.yallonking.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/www.yallonking.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/www.yallonking.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/www.yallonking.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=315"}],"version-history":[{"count":3,"href":"http:\/\/www.yallonking.com\/index.php?rest_route=\/wp\/v2\/posts\/315\/revisions"}],"predecessor-version":[{"id":371,"href":"http:\/\/www.yallonking.com\/index.php?rest_route=\/wp\/v2\/posts\/315\/revisions\/371"}],"wp:attachment":[{"href":"http:\/\/www.yallonking.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=315"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/www.yallonking.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=315"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/www.yallonking.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=315"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}