{"id":764,"date":"2015-11-30T16:34:19","date_gmt":"2015-11-30T16:34:19","guid":{"rendered":"http:\/\/haisins.epac.to\/wordpress\/?p=764"},"modified":"2015-11-30T16:34:19","modified_gmt":"2015-11-30T16:34:19","slug":"sysaux-table-shrink","status":"publish","type":"post","link":"http:\/\/haisins.synology.me\/wordpress\/?p=764","title":{"rendered":"SYSAUX Table Shrink"},"content":{"rendered":"<p><P><SPAN style=\"FONT-SIZE: 10pt; FONT-FAMILY: \ub9d1\uc740 \uace0\ub515; COLOR: black\">1. \uc2a4\ub0c5\uc0f7 \uc124\uc815 \ud655\uc778 <\/SPAN><\/P><br \/>\n<P><SPAN style=\"FONT-SIZE: 10pt; FONT-FAMILY: \ub9d1\uc740 \uace0\ub515; COLOR: black\">select * from dba_hist_wr_control ; <\/SPAN><\/P><br \/>\n<P>&nbsp; &nbsp;<\/P><br \/>\n<P><SPAN style=\"FONT-SIZE: 10pt; FONT-FAMILY: \ub9d1\uc740 \uace0\ub515; COLOR: black\">2. \ud604\uc7ac \uc2a4\ub0c5\uc0f7 \uc870\ud68c <\/SPAN><\/P><br \/>\n<P><SPAN style=\"FONT-SIZE: 10pt; FONT-FAMILY: \ub9d1\uc740 \uace0\ub515; COLOR: black\">col startup_time for a30 <\/SPAN><\/P><br \/>\n<P><SPAN style=\"FONT-SIZE: 10pt; FONT-FAMILY: \ub9d1\uc740 \uace0\ub515; COLOR: black\">col begin_interval_time for a30 <\/SPAN><\/P><br \/>\n<P><SPAN style=\"FONT-SIZE: 10pt; FONT-FAMILY: \ub9d1\uc740 \uace0\ub515; COLOR: black\">select snap_id, startup_time, begin_interval_time, snap_level from dba_hist_snapshot order by 3 ; <\/SPAN><\/P><br \/>\n<P>&nbsp; &nbsp;<\/P><br \/>\n<P><SPAN style=\"FONT-SIZE: 10pt; FONT-FAMILY: \ub9d1\uc740 \uace0\ub515; COLOR: black\">3. SYSAUX \uc0ac\uc6a9\ub7c9 \uc870\ud68c <\/SPAN><\/P><br \/>\n<P><SPAN style=\"FONT-SIZE: 10pt; FONT-FAMILY: \ub9d1\uc740 \uace0\ub515; COLOR: black\">select df.tablespace_name &#8220;Tablespace&#8221;, <\/SPAN><\/P><br \/>\n<P><SPAN style=\"FONT-SIZE: 10pt; FONT-FAMILY: \ub9d1\uc740 \uace0\ub515; COLOR: black\">round(df.TBS_byte \/1048576,2) &#8220;Total(MB)&#8221;, <\/SPAN><\/P><br \/>\n<P><SPAN style=\"FONT-SIZE: 10pt; FONT-FAMILY: \ub9d1\uc740 \uace0\ub515; COLOR: black\">round((df.TBS_byte &#8211; fs.Free_byte)\/1048576,2) &#8220;Used(MB)&#8221;, <\/SPAN><\/P><br \/>\n<P><SPAN style=\"FONT-SIZE: 10pt; FONT-FAMILY: \ub9d1\uc740 \uace0\ub515; COLOR: black\">round(fs.Free_byte \/1048576,2) &#8220;Free(MB)&#8221;, <\/SPAN><\/P><br \/>\n<P><SPAN style=\"FONT-SIZE: 10pt; FONT-FAMILY: \ub9d1\uc740 \uace0\ub515; COLOR: black\">round((fs.Free_byte\/df.TBS_byte) *100,0) &#8220;Free(%)&#8221;, <\/SPAN><\/P><br \/>\n<P><SPAN style=\"FONT-SIZE: 10pt; FONT-FAMILY: \ub9d1\uc740 \uace0\ub515; COLOR: black\">fs.pieces &#8220;Pieces&#8221;, <\/SPAN><\/P><br \/>\n<P><SPAN style=\"FONT-SIZE: 10pt; FONT-FAMILY: \ub9d1\uc740 \uace0\ub515; COLOR: black\">round(fs.Max_free \/1048576,2) &#8220;MaxFree(MB)&#8221;, <\/SPAN><\/P><br \/>\n<P><SPAN style=\"FONT-SIZE: 10pt; FONT-FAMILY: \ub9d1\uc740 \uace0\ub515; COLOR: black\">db.EXTENT_MANAGEMENT <\/SPAN><\/P><br \/>\n<P><SPAN style=\"FONT-SIZE: 10pt; FONT-FAMILY: \ub9d1\uc740 \uace0\ub515; COLOR: black\">from ( select tablespace_name, sum(bytes) TBS_byte <\/SPAN><\/P><br \/>\n<P><SPAN style=\"FONT-SIZE: 10pt; FONT-FAMILY: \ub9d1\uc740 \uace0\ub515; COLOR: black\">from dba_data_files group by tablespace_name ) df, <\/SPAN><\/P><br \/>\n<P><SPAN style=\"FONT-SIZE: 10pt; FONT-FAMILY: \ub9d1\uc740 \uace0\ub515; COLOR: black\">( select tablespace_name, max(bytes) Max_free, sum(bytes) Free_byte, count(*) pieces <\/SPAN><\/P><br \/>\n<P><SPAN style=\"FONT-SIZE: 10pt; FONT-FAMILY: \ub9d1\uc740 \uace0\ub515; COLOR: black\">from dba_free_space group by tablespace_name ) fs, <\/SPAN><\/P><br \/>\n<P><SPAN style=\"FONT-SIZE: 10pt; FONT-FAMILY: \ub9d1\uc740 \uace0\ub515; COLOR: black\">( select tablespace_name, initial_extent, next_extent,EXTENT_MANAGEMENT <\/SPAN><\/P><br \/>\n<P><SPAN style=\"FONT-SIZE: 10pt; FONT-FAMILY: \ub9d1\uc740 \uace0\ub515; COLOR: black\">from dba_tablespaces ) db <\/SPAN><\/P><br \/>\n<P><SPAN style=\"FONT-SIZE: 10pt; FONT-FAMILY: \ub9d1\uc740 \uace0\ub515; COLOR: black\">where df.tablespace_name = db.tablespace_name <\/SPAN><\/P><br \/>\n<P><SPAN style=\"FONT-SIZE: 10pt; FONT-FAMILY: \ub9d1\uc740 \uace0\ub515; COLOR: black\">and df.tablespace_name = fs.tablespace_name(+) <\/SPAN><\/P><br \/>\n<P><SPAN style=\"FONT-SIZE: 10pt; FONT-FAMILY: \ub9d1\uc740 \uace0\ub515; COLOR: black\">and df.tablespace_name = &#8216;SYSAUX&#8217; <\/SPAN><\/P><br \/>\n<P><SPAN style=\"FONT-SIZE: 10pt; FONT-FAMILY: \ub9d1\uc740 \uace0\ub515; COLOR: black\">order by 5 <\/SPAN><\/P><br \/>\n<P><SPAN style=\"FONT-SIZE: 10pt; FONT-FAMILY: \ub9d1\uc740 \uace0\ub515; COLOR: black\">\/ <\/SPAN><\/P><br \/>\n<P>&nbsp; &nbsp;<\/P><br \/>\n<P><SPAN style=\"FONT-SIZE: 10pt; FONT-FAMILY: \ub9d1\uc740 \uace0\ub515; COLOR: black\">4. v$SYSAUX_OCCUPANTS \uc870\ud68c <\/SPAN><\/P><br \/>\n<P><SPAN style=\"FONT-SIZE: 10pt; FONT-FAMILY: \ub9d1\uc740 \uace0\ub515; COLOR: black\">col OCCUPANT_NAME for a30 <\/SPAN><\/P><br \/>\n<P><SPAN style=\"FONT-SIZE: 10pt; FONT-FAMILY: \ub9d1\uc740 \uace0\ub515; COLOR: black\">col SCHEMA_NAME for a20 <\/SPAN><\/P><br \/>\n<P><SPAN style=\"FONT-SIZE: 10pt; FONT-FAMILY: \ub9d1\uc740 \uace0\ub515; COLOR: black\">select OCCUPANT_NAME,SCHEMA_NAME,SPACE_USAGE_KBYTES from v$sysaux_occupants order by 3 ; <\/SPAN><\/P><br \/>\n<P>&nbsp; &nbsp;<\/P><br \/>\n<P><SPAN style=\"FONT-SIZE: 10pt; FONT-FAMILY: \ub9d1\uc740 \uace0\ub515; COLOR: black\">5. SYSAUX SEGMENT \uc870\ud68c <\/SPAN><\/P><br \/>\n<P><SPAN style=\"FONT-SIZE: 10pt; FONT-FAMILY: \ub9d1\uc740 \uace0\ub515; COLOR: black\">col OWNER for a20 <\/SPAN><\/P><br \/>\n<P><SPAN style=\"FONT-SIZE: 10pt; FONT-FAMILY: \ub9d1\uc740 \uace0\ub515; COLOR: black\">col SEGMENT_NAME for a30 <\/SPAN><\/P><br \/>\n<P><SPAN style=\"FONT-SIZE: 10pt; FONT-FAMILY: \ub9d1\uc740 \uace0\ub515; COLOR: black\">col SEGMENT_TYPE for a20 <\/SPAN><\/P><br \/>\n<P><SPAN style=\"FONT-SIZE: 10pt; FONT-FAMILY: \ub9d1\uc740 \uace0\ub515; COLOR: black\">col TABLESPACE_NAME for a20 <\/SPAN><\/P><br \/>\n<P><SPAN style=\"FONT-SIZE: 10pt; FONT-FAMILY: \ub9d1\uc740 \uace0\ub515; COLOR: black\">select OWNER,SEGMENT_NAME,PARTITION_NAME,SEGMENT_TYPE,TABLESPACE_NAME,BYTES\/1024\/1024 &#8220;MB&#8221; from dba_segments where tablespace_name=&#8217;SYSAUX&#8217; order by 6 ; <\/SPAN><\/P><br \/>\n<P><SPAN style=\"FONT-SIZE: 10pt; FONT-FAMILY: \ub9d1\uc740 \uace0\ub515; COLOR: black\">##select OWNER,SEGMENT_NAME,PARTITION_NAME,SEGMENT_TYPE,TABLESPACE_NAME,BYTES\/1024\/1024 &#8220;MB&#8221; from dba_segments where tablespace_name=&#8217;SYS1&#8242; order by 6 ; <\/SPAN><\/P><br \/>\n<P>&nbsp; &nbsp;<\/P><br \/>\n<P><SPAN style=\"FONT-SIZE: 10pt; FONT-FAMILY: \ub9d1\uc740 \uace0\ub515; COLOR: black\">6. \uc2a4\ub0c5\uc0f7 min, max \uc870\ud68c <\/SPAN><\/P><br \/>\n<P><SPAN style=\"FONT-SIZE: 10pt; FONT-FAMILY: \ub9d1\uc740 \uace0\ub515; COLOR: black\">select min(snap_id), max(snap_id) from WRM$_SNAPSHOT ; <\/SPAN><\/P><br \/>\n<P>&nbsp; &nbsp;<\/P><br \/>\n<P><SPAN style=\"FONT-SIZE: 10pt; FONT-FAMILY: \ub9d1\uc740 \uace0\ub515; COLOR: black\">7. \uc2a4\ub0c5\uc0f7\uc774 \uc5c6\ub294 orphaned \ud589 \uc870\ud68c <\/SPAN><\/P><br \/>\n<P><SPAN style=\"FONT-SIZE: 10pt; FONT-FAMILY: \ub9d1\uc740 \uace0\ub515; COLOR: black\">##select count(*) From WRH$_LATCH_CHILDREN where snap_id &lt; 842 ; <\/SPAN><\/P><br \/>\n<P><SPAN style=\"FONT-SIZE: 10pt; FONT-FAMILY: \ub9d1\uc740 \uace0\ub515; COLOR: black\">select count(*) From WRH$_LATCH_CHILDREN where snap_id &lt; min(snap_id) ; <\/SPAN><\/P><br \/>\n<P>&nbsp; &nbsp;<\/P><br \/>\n<P><SPAN style=\"FONT-SIZE: 10pt; FONT-FAMILY: \ub9d1\uc740 \uace0\ub515; COLOR: black\">8. orphaned \uc0ad\uc81c, \uc0ac\uc774\uc988 \uccb4\ud06c <\/SPAN><\/P><br \/>\n<P>&nbsp; &nbsp;<\/P><br \/>\n<P><SPAN style=\"FONT-SIZE: 10pt; FONT-FAMILY: \ub9d1\uc740 \uace0\ub515; COLOR: black\">DELETE <\/SPAN><\/P><br \/>\n<P><SPAN style=\"FONT-SIZE: 10pt; FONT-FAMILY: \ub9d1\uc740 \uace0\ub515; COLOR: black\">FROM WRH$_LATCH_CHILDREN a <\/SPAN><\/P><br \/>\n<P><SPAN style=\"FONT-SIZE: 10pt; FONT-FAMILY: \ub9d1\uc740 \uace0\ub515; COLOR: black\">WHERE NOT EXISTS <\/SPAN><\/P><br \/>\n<P><SPAN style=\"FONT-SIZE: 10pt; FONT-FAMILY: \ub9d1\uc740 \uace0\ub515; COLOR: black\">(SELECT 1 <\/SPAN><\/P><br \/>\n<P><SPAN style=\"FONT-SIZE: 10pt; FONT-FAMILY: \ub9d1\uc740 \uace0\ub515; COLOR: black\">FROM wrm$_snapshot <\/SPAN><\/P><br \/>\n<P><SPAN style=\"FONT-SIZE: 10pt; FONT-FAMILY: \ub9d1\uc740 \uace0\ub515; COLOR: black\">WHERE snap_id = a.snap_id <\/SPAN><\/P><br \/>\n<P><SPAN style=\"FONT-SIZE: 10pt; FONT-FAMILY: \ub9d1\uc740 \uace0\ub515; COLOR: black\">AND dbid = a.dbid <\/SPAN><\/P><br \/>\n<P><SPAN style=\"FONT-SIZE: 10pt; FONT-FAMILY: \ub9d1\uc740 \uace0\ub515; COLOR: black\">AND instance_number = a.instance_number <\/SPAN><\/P><br \/>\n<P><SPAN style=\"FONT-SIZE: 10pt; FONT-FAMILY: \ub9d1\uc740 \uace0\ub515; COLOR: black\">); <\/SPAN><\/P><br \/>\n<P>&nbsp; &nbsp;<\/P><br \/>\n<P><SPAN style=\"FONT-SIZE: 10pt; FONT-FAMILY: \ub9d1\uc740 \uace0\ub515; COLOR: black\">9. \ud14c\uc774\ube14 \uc26c\ub9c1\ud06c, \uc0ac\uc774\uc988 \uccb4\ud06c <\/SPAN><\/P><br \/>\n<P><SPAN style=\"FONT-SIZE: 10pt; FONT-FAMILY: \ub9d1\uc740 \uace0\ub515; COLOR: black\">alter table WRH$_LATCH_CHILDREN shrink space ; <\/SPAN><\/P><br \/>\n<P><SPAN style=\"FONT-SIZE: 10pt; FONT-FAMILY: \ub9d1\uc740 \uace0\ub515; COLOR: black\">alter index WRH$_LATCH_CHILDREN_PK rebuild partition &#8216;partition_name&#8217; ; <\/SPAN><\/P><br \/>\n<P>&nbsp; &nbsp;<\/P><br \/>\n<P><SPAN style=\"FONT-SIZE: 10pt; FONT-FAMILY: \ub9d1\uc740 \uace0\ub515; COLOR: black\">10. \ud655\uc778 <\/SPAN><\/P><br \/>\n<P><SPAN style=\"FONT-SIZE: 10pt; FONT-FAMILY: \ub9d1\uc740 \uace0\ub515; COLOR: black\">select min(snap_id), max(snap_id) from WRM$_SNAPSHOT ; <\/SPAN><\/P><br \/>\n<P><SPAN style=\"FONT-SIZE: 10pt; FONT-FAMILY: \ub9d1\uc740 \uace0\ub515; COLOR: black\">select OWNER,SEGMENT_NAME,PARTITION_NAME,SEGMENT_TYPE,TABLESPACE_NAME,BYTES\/1024\/1024 &#8220;MB&#8221; from dba_segments where tablespace_name=&#8217;SYSAUX&#8217; order by 6 ; <\/SPAN><\/P><br \/>\n<P>&nbsp; &nbsp;<\/P><br \/>\n<P><SPAN style=\"FONT-SIZE: 10pt; FONT-FAMILY: \ub9d1\uc740 \uace0\ub515; COLOR: black\"><\/SPAN>&nbsp;<\/P><\/p>\n","protected":false},"excerpt":{"rendered":"<p>1. \uc2a4\ub0c5\uc0f7 \uc124\uc815 \ud655\uc778 select * from dba_hist_wr_control ; &nbsp; &nbsp; 2. \ud604\uc7ac \uc2a4\ub0c5\uc0f7 \uc870\ud68c col startup_time for a30 col begin_interval_time for a30 select snap_id, startup_time, begin_interval_time, snap_level from dba_hist_snapshot order by 3 ; &nbsp; &nbsp; 3. SYSAUX \uc0ac\uc6a9\ub7c9 \uc870\ud68c select df.tablespace_name &#8220;Tablespace&#8221;, round(df.TBS_byte \/1048576,2) &#8220;Total(MB)&#8221;, round((df.TBS_byte &#8211; fs.Free_byte)\/1048576,2) &#8220;Used(MB)&#8221;, round(fs.Free_byte \/1048576,2) &#8220;Free(MB)&#8221;, round((fs.Free_byte\/df.TBS_byte) *100,0) [&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":[9],"tags":[138,237,445,446],"jetpack_featured_media_url":"","amp_enabled":true,"_links":{"self":[{"href":"http:\/\/haisins.synology.me\/wordpress\/index.php?rest_route=\/wp\/v2\/posts\/764"}],"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=764"}],"version-history":[{"count":0,"href":"http:\/\/haisins.synology.me\/wordpress\/index.php?rest_route=\/wp\/v2\/posts\/764\/revisions"}],"wp:attachment":[{"href":"http:\/\/haisins.synology.me\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=764"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/haisins.synology.me\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=764"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/haisins.synology.me\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=764"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}