{"id":653,"date":"2015-11-18T05:02:30","date_gmt":"2015-11-18T05:02:30","guid":{"rendered":"http:\/\/haisins.epac.to\/wordpress\/?p=653"},"modified":"2015-11-18T05:02:30","modified_gmt":"2015-11-18T05:02:30","slug":"%ec%9d%bc%eb%b3%84-range-%ed%8c%8c%ed%8b%b0%ec%85%98%ec%9d%84-%ec%9e%90%eb%8f%99%ed%99%94-%ea%b4%80%eb%a6%ac-%ed%95%98%eb%8a%94-%ec%8a%a4%ed%81%ac%eb%a6%bd%ed%8a%b8","status":"publish","type":"post","link":"http:\/\/haisins.synology.me\/wordpress\/?p=653","title":{"rendered":"\uc77c\ubcc4 Range \ud30c\ud2f0\uc158\uc744 \uc790\ub3d9\ud654 \uad00\ub9ac \ud558\ub294 \uc2a4\ud06c\ub9bd\ud2b8"},"content":{"rendered":"<p>MAX \ud30c\ud2f0\uc158\uc744 \uc0ac\uc6a9\ud558\uba74 \uc778\ub371\uc2a4\ub3c4 \ub9ac\ube4c\ub4dc\ud574\uc57c\ud558\uace0, &nbsp;SPLIT\ud574\uc57c \ud558\uace0.. \uace8\uce58\uc544\ud515\ub2c8\ub2e4.<\/p>\n<p>\uc0c8\ub85c\uc6b4 partition\uc744 add\ub9cc \ud558\ub294 \ubc29\uc2dd\uc73c\ub85c\uc758 \uc804\ud658\uc774 \ud544\uc694\ud569\ub2c8\ub2e4.<\/p>\n<p>\uc77c\ubcc4\ub85c \uc544\ub798 \ud504\ub85c\uc2dc\uc838\ub97c crontab\uc5d0\uc11c \ud638\ucd9c\ub9cc \ud558\uba74 \uc544~\uc8fc \uac04\ub2e8\ud558\uac8c \uc77c\ubcc4 \ud30c\ud2f0\uc158\uc744 \uad00\ub9ac\ud560 \uc218 \uc788\uc2b5\ub2c8\ub2e4.<\/p>\n<p>\uac00\ub054 \uc0dd\uc131\uc774 \uc2e4\ud328\ub420 \ub54c\uac00 \uc788\ub294\ub370 \uc774\uac83\uae4c\uc9c0 \uace0\ub824\ud574\uc11c. &nbsp;\uc2dc\uac04\ub2e8\uc704\ub85c \uc544\ub798 \ud504\ub85c\uc2dc\uc838\ub97c \ub3cc\ub9ac\uba74 \uc54c\uc544\uc11c \uc624\ub298\ub85c\ubd80\ud130 10\uc77c\uc774\ud6c4\uae4c\uc9c0,&nbsp;<\/p>\n<p>\uc624\ub298\ub85c\ubd80\ud130 15\uc77c \uc774\uc804\uae4c\uc9c0 \ucd1d 25\uc77c\uc758 \ud30c\ud2f0\uc158\uc744 \ud56d\uc0c1 \uc720\uc9c0\uc2dc\ucf1c\uc90d\ub2c8\ub2e4.<\/p>\n<p><\/p>\n<p>CREATE OR REPLACE procedure proc_partitions<\/p>\n<p>(<\/p>\n<p>&nbsp;out_resultcode &nbsp; out varchar2, &nbsp; &#8212; \uc791\uc5c5\uacb0\uacfc \ucf54\ub4dc.<\/p>\n<p>&nbsp;out_sqlerrmsg &nbsp; &nbsp;out varchar2 &nbsp; &nbsp; &#8212; \uc624\ub958\uc2dc oracle \uc5d0\ub7ec\ucf54\ub4dc\/\uba54\uc2dc\uc9c0.<\/p>\n<p>)<\/p>\n<p>is<\/p>\n<p>&nbsp;\/*************************************************************************************\/<\/p>\n<p>&nbsp;\/* \ud30c\ud2f0\uc154\ub2dd\ub41c \ud14c\uc774\ube14\ub4e4\uc744 \ubd88\ub7ec\uc640\uc11c SPLIT SCRIPT\ub97c \ub9cc\ub4e4\uace0 \uc774\ub97c \ucee4\uc11c\uc5d0 \uc800\uc7a5\ud55c\ub2e4 &nbsp; &nbsp; &nbsp; &nbsp;*\/<\/p>\n<p>&nbsp;\/*************************************************************************************\/<\/p>\n<p>&nbsp;cursor c_part_tables<\/p>\n<p>&nbsp;is<\/p>\n<p>&nbsp;select * from (<\/p>\n<p>&nbsp; select table_name, &nbsp;<\/p>\n<p>&nbsp; &nbsp; &nbsp; decode(ordval, 1, &#8216;alter table &#8216;||table_name||&#8217; add partition P&#8217;||npart||&#8217; VALUES LESS THAN (&#8221;&#8217;||ndt||&#8221;&#8217;)&#8217;) addscript,&nbsp;<\/p>\n<p>&nbsp; &nbsp; &nbsp; &#8216;alter table &#8216;||table_name||&#8217; drop partition P&#8217;||bdt||decode(table_name,&#8217;WORKLIST&#8217;,&#8217; update global indexes&#8217;) &nbsp;dropscript, ndt, bdt, npart<\/p>\n<p>&nbsp; &nbsp; from( &nbsp; &nbsp;<\/p>\n<p>&nbsp; &nbsp;select table_name, len, decode(len,8,TO_CHAR(to_date(replace(max(partition_name),&#8217;P&#8217;,&#8221;),&#8217;yyyymmdd&#8217;)+1,&#8217;yyyymmdd&#8217;)) npart,&nbsp;<\/p>\n<p>&nbsp; &nbsp; &nbsp; decode(len,8,TO_CHAR(to_date(replace(max(partition_name),&#8217;P&#8217;,&#8221;),&#8217;yyyymmdd&#8217;)+2,&#8217;yyyymmdd&#8217;)) ndt,<\/p>\n<p>&nbsp; &nbsp; &nbsp; decode(len,8,TO_CHAR(to_date(replace(max(partition_name),&#8217;P&#8217;,&#8221;),&#8217;yyyymmdd&#8217;)-23,&#8217;yyyymmdd&#8217;)) bdt,<\/p>\n<p>&nbsp; &nbsp; &nbsp; row_number() over (partition by table_name, len order by decode(len,8,TO_CHAR(to_date(replace(partition_name,&#8217;P&#8217;,&#8221;),&#8217;yyyymmdd&#8217;)-10,&#8217;yyyymmdd&#8217;)) desc) ordval &nbsp; &nbsp;<\/p>\n<p>&nbsp; &nbsp; from (&nbsp;<\/p>\n<p>&nbsp; &nbsp; &nbsp; select table_name, length(replace(partition_name,&#8217;P&#8217;,&#8221;)) len,<\/p>\n<p>&nbsp; &nbsp; &nbsp; &nbsp; partition_name&nbsp;<\/p>\n<p>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;from user_tab_partitions&nbsp;<\/p>\n<p>&nbsp; &nbsp; &nbsp;where length(replace(partition_name,&#8217;P&#8217;,&#8221;)) is not null<\/p>\n<p>&nbsp; &nbsp; &nbsp; &nbsp;and partition_name like &#8216;P2%&#8217;<\/p>\n<p>&nbsp; &nbsp; &nbsp; &nbsp; )<\/p>\n<p>&nbsp; &nbsp; &nbsp; &nbsp;where len = 8<\/p>\n<p>&nbsp; &nbsp; group by table_name, len, decode(len,8,TO_CHAR(to_date(replace(partition_name,&#8217;P&#8217;,&#8221;),&#8217;yyyymmdd&#8217;)-10,&#8217;yyyymmdd&#8217;)) &nbsp; &nbsp;<\/p>\n<p>&nbsp; &nbsp;) &nbsp;<\/p>\n<p>&nbsp; &nbsp;where ndt &lt; to_char(sysdate+10,&#8217;yyyymmdd&#8217;)&nbsp;<\/p>\n<p>&nbsp;) ;<\/p>\n<p><\/p>\n<p>v_sql varchar2(4000);&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>begin<\/p>\n<p>&nbsp;for c_part in c_part_tables()<\/p>\n<p>&nbsp;loop<\/p>\n<p><\/p>\n<p>&nbsp; begin<\/p>\n<p>&nbsp; &nbsp;v_sql := c_part.addscript;<\/p>\n<p>&nbsp; &nbsp;execute immediate v_sql;<\/p>\n<p>&nbsp; exception<\/p>\n<p>&nbsp; &nbsp;when others then<\/p>\n<p>&nbsp; &nbsp; &nbsp;v_sql := &#8221;; &nbsp; &nbsp;&nbsp;<\/p>\n<p>&nbsp; end; &nbsp;<\/p>\n<p>&nbsp; begin &nbsp; &nbsp;<\/p>\n<p>&nbsp; &nbsp;v_sql := c_part.dropscript;<\/p>\n<p>&nbsp; &nbsp;execute immediate v_sql;<\/p>\n<p>&nbsp; exception<\/p>\n<p>&nbsp; &nbsp;when others then<\/p>\n<p>&nbsp; &nbsp; &nbsp;v_sql := &#8221;; &nbsp; &nbsp;&nbsp;<\/p>\n<p>&nbsp; end; &nbsp;<\/p>\n<p>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<\/p>\n<p>&nbsp;end loop;&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>exception<\/p>\n<p>&nbsp; &nbsp; &nbsp;when others then<\/p>\n<p>&nbsp; &nbsp; &nbsp; &nbsp; out_resultcode := -1;<\/p>\n<p>&nbsp; &nbsp; &nbsp; &nbsp; out_sqlerrmsg := sqlerrm||&#8217; (&#8216;||sqlcode||&#8217;)&#8217;;<\/p>\n<p>end proc_partitions;<\/p>\n<p>\/<\/p>\n<p><\/p>\n","protected":false},"excerpt":{"rendered":"<p>MAX \ud30c\ud2f0\uc158\uc744 \uc0ac\uc6a9\ud558\uba74 \uc778\ub371\uc2a4\ub3c4 \ub9ac\ube4c\ub4dc\ud574\uc57c\ud558\uace0, &nbsp;SPLIT\ud574\uc57c \ud558\uace0.. \uace8\uce58\uc544\ud515\ub2c8\ub2e4. \uc0c8\ub85c\uc6b4 partition\uc744 add\ub9cc \ud558\ub294 \ubc29\uc2dd\uc73c\ub85c\uc758 \uc804\ud658\uc774 \ud544\uc694\ud569\ub2c8\ub2e4. \uc77c\ubcc4\ub85c \uc544\ub798 \ud504\ub85c\uc2dc\uc838\ub97c crontab\uc5d0\uc11c \ud638\ucd9c\ub9cc \ud558\uba74 \uc544~\uc8fc \uac04\ub2e8\ud558\uac8c \uc77c\ubcc4 \ud30c\ud2f0\uc158\uc744 \uad00\ub9ac\ud560 \uc218 \uc788\uc2b5\ub2c8\ub2e4. \uac00\ub054 \uc0dd\uc131\uc774 \uc2e4\ud328\ub420 \ub54c\uac00 \uc788\ub294\ub370 \uc774\uac83\uae4c\uc9c0 \uace0\ub824\ud574\uc11c. &nbsp;\uc2dc\uac04\ub2e8\uc704\ub85c \uc544\ub798 \ud504\ub85c\uc2dc\uc838\ub97c \ub3cc\ub9ac\uba74 \uc54c\uc544\uc11c \uc624\ub298\ub85c\ubd80\ud130 10\uc77c\uc774\ud6c4\uae4c\uc9c0,&nbsp; \uc624\ub298\ub85c\ubd80\ud130 15\uc77c \uc774\uc804\uae4c\uc9c0 \ucd1d 25\uc77c\uc758 \ud30c\ud2f0\uc158\uc744 \ud56d\uc0c1 \uc720\uc9c0\uc2dc\ucf1c\uc90d\ub2c8\ub2e4. CREATE OR REPLACE procedure proc_partitions [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_bbp_topic_count":0,"_bbp_reply_count":0,"_bbp_total_topic_count":0,"_bbp_total_reply_count":0,"_bbp_voice_count":0,"_bbp_anonymous_reply_count":0,"_bbp_topic_count_hidden":0,"_bbp_reply_count_hidden":0,"_bbp_forum_subforum_count":0,"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"spay_email":""},"categories":[3],"tags":[312,313,314,315,316,317],"jetpack_featured_media_url":"","amp_enabled":true,"_links":{"self":[{"href":"http:\/\/haisins.synology.me\/wordpress\/index.php?rest_route=\/wp\/v2\/posts\/653"}],"collection":[{"href":"http:\/\/haisins.synology.me\/wordpress\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/haisins.synology.me\/wordpress\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/haisins.synology.me\/wordpress\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/haisins.synology.me\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=653"}],"version-history":[{"count":0,"href":"http:\/\/haisins.synology.me\/wordpress\/index.php?rest_route=\/wp\/v2\/posts\/653\/revisions"}],"wp:attachment":[{"href":"http:\/\/haisins.synology.me\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=653"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/haisins.synology.me\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=653"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/haisins.synology.me\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=653"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}