{"id":819,"date":"2020-06-26T16:42:05","date_gmt":"2020-06-26T20:42:05","guid":{"rendered":"https:\/\/increasec.com\/?p=819"},"modified":"2020-06-26T16:42:05","modified_gmt":"2020-06-26T20:42:05","slug":"vmware-vcenter-script-to-reduce-storage-seat-size","status":"publish","type":"post","link":"https:\/\/increasec.com\/?p=819","title":{"rendered":"VmWare vCenter script to reduce \/storage\/seat size"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">root@Joker [ ~ ]# \/opt\/vmware\/vpostgres\/current\/bin\/psql -d VCDB -U postgres<br>psql.bin (9.6.16 (VMware Postgres 9.6.16.0-15334897 release))<br>Type &#8220;help&#8221; for help.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">VCDB=# CREATE OR REPLACE FUNCTION event_full_cleanup_p ()<br>VCDB-# returns void as $$<br>VCDB$# DECLARE<br>VCDB$# event_partition VARCHAR (200);<br>VCDB$# BEGIN<br>VCDB$# TRUNCATE TABLE VPX_EVENT_PARTITION_LOOKUP;<br>VCDB$# &#8211;Truncate partitions<br>VCDB$# FOR part IN 1..92<br>VCDB$# LOOP<br>VCDB$# event_partition = &#8216;TRUNCATE TABLE VPX_EVENT_&#8217; || CAST(part AS TEXT) || &#8216; CASCADE &#8216;;<br>VCDB$# EXECUTE event_partition;<br>VCDB$# event_partition = &#8216;TRUNCATE TABLE VPX_EVENT_ARG_&#8217; || CAST(part AS TEXT) || &#8216; CASCADE &#8216;;<br>VCDB$# EXECUTE event_partition;<br>VCDB$# event_partition = &#8216;ANALYZE VPX_EVENT_&#8217; || CAST(part AS TEXT);<br>VCDB$# EXECUTE event_partition;<br>VCDB$# event_partition = &#8216;ANALYZE VPX_EVENT_ARG_&#8217; || CAST(part AS TEXT);<br>VCDB$# EXECUTE event_partition;<br>VCDB$# END LOOP;<br>VCDB$# TRUNCATE TABLE VPX_ENTITY_LAST_EVENT;<br>VCDB$# END<br>VCDB$# $$language plpgsql;<br>CREATE FUNCTION<br>VCDB=# select event_full_cleanup_p();<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">event_full_cleanup_p<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">(1 row)<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">VCDB=# \\q<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">This obv comes with no warantee or guarantee<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">it reduced our \/storage\/seat size from <\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\/dev\/mapper\/seat_vg-seat 9.8G <strong>8.7G<\/strong> 513M 95% \/storage\/seat<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">to<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\/dev\/mapper\/seat_vg-seat 9.8G <strong>2.5G<\/strong> 6.8G 27% \/storage\/seat<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">the \/storage\/seat directory gets filled rather quickly if you run vCenter 6.7u3 unpatched for any length of time.  <\/p>\n","protected":false},"excerpt":{"rendered":"<p>root@Joker [ ~ ]# \/opt\/vmware\/vpostgres\/current\/bin\/psql -d VCDB -U postgrespsql.bin (9.6.16 (VMware Postgres 9.6.16.0-15334897 release))Type &#8220;help&#8221; for help. VCDB=# CREATE OR REPLACE FUNCTION event_full_cleanup_p ()VCDB-# returns void as $$VCDB$# DECLAREVCDB$# event_partition&#8230;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[125,124],"class_list":["post-819","post","type-post","status-publish","format-standard","hentry","category-uncategorised","tag-vcenter","tag-vmware"],"_links":{"self":[{"href":"https:\/\/increasec.com\/index.php?rest_route=\/wp\/v2\/posts\/819","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/increasec.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/increasec.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/increasec.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/increasec.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=819"}],"version-history":[{"count":1,"href":"https:\/\/increasec.com\/index.php?rest_route=\/wp\/v2\/posts\/819\/revisions"}],"predecessor-version":[{"id":820,"href":"https:\/\/increasec.com\/index.php?rest_route=\/wp\/v2\/posts\/819\/revisions\/820"}],"wp:attachment":[{"href":"https:\/\/increasec.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=819"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/increasec.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=819"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/increasec.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=819"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}