{"id":6167,"date":"2021-08-12T00:32:40","date_gmt":"2021-08-12T00:32:40","guid":{"rendered":"https:\/\/swiv.com.br\/restoring-the-spfile-from-memory\/"},"modified":"2026-05-27T20:02:30","modified_gmt":"2026-05-27T19:02:30","slug":"restoring-the-spfile-from-memory","status":"publish","type":"post","link":"https:\/\/swiv.com.br\/index.php\/2021\/08\/12\/restoring-the-spfile-from-memory\/","title":{"rendered":"Restoring the SPFILE from Memory"},"content":{"rendered":"\n<p>Este artigo abordar\u00e1 a recupera\u00e7\u00e3o do arquivo SPFILE de um banco de dados que ainda est\u00e1 em execu\u00e7\u00e3o, atrav\u00e9s dos valores usados em mem\u00f3ria.<\/p>\n\n\n\n<p>Vamos identificar o diret\u00f3rio e arquivo SPFILE usado em nosso ambiente:<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \\&quot;wp-block-syntaxhighlighter-code\\&quot;\"><pre class=\"brush: plain; title: ; notranslate\" title=\"\">\n&#x5B;oracle@oel8 ~]$ sqlplus \/ as sysdba\n \nSQL*Plus: Release 18.0.0.0.0 - Production on Wed Aug 11 21:15:22 2021\nVersion 18.13.0.0.0\n \nCopyright (c) 1982, 2018, Oracle.  All rights reserved.\n \n \nConnected to:\nOracle Database 18c Enterprise Edition Release 18.0.0.0.0 - Production\nVersion 18.13.0.0.0\n \nSQL&gt; show parameter SPFILE\n \nNAME                                 TYPE        VALUE\n------------------------------------ ----------- ------------------------------\nspfile                               string      \/oracle\/18.0.0\/product\/dbs\/spf\n                                                 ileRMANDB.ora\n<\/pre><\/div>\n\n\n<p>Deletando o arquivo:<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \\&quot;wp-block-syntaxhighlighter-code\\&quot;\"><pre class=\"brush: plain; title: ; notranslate\" title=\"\">\nSQL&gt; ! rm \/oracle\/18.0.0\/product\/dbs\/spfileRMANDB.ora\n<\/pre><\/div>\n\n\n<p>Apesar disso, o banco de dados ainda opera normalmente:<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \\&quot;wp-block-syntaxhighlighter-code\\&quot;\"><pre class=\"brush: plain; title: ; notranslate\" title=\"\">\nSQL&gt; SELECT COUNT(*) FROM DBA_OBJECTS ;\n \n  COUNT(*)\n----------\n     73798\n<\/pre><\/div>\n\n\n<p>Ao rodar um VALIDATE DATABASE, o problema \u00e9 identificado:<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \\&quot;wp-block-syntaxhighlighter-code\\&quot;\"><pre class=\"brush: plain; title: ; notranslate\" title=\"\">\nchannel ORA_DISK_1: starting validation of datafile\nchannel ORA_DISK_1: specifying datafile(s) for validation\nincluding current control file for validation\nRMAN-00571: ===========================================================\nRMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============\nRMAN-00571: ===========================================================\nRMAN-03009: failure of validate command on ORA_DISK_1 channel at 08\/11\/2021 21:21:32\nORA-01565: error in identifying file &#039;\/oracle\/18.0.0\/product\/dbs\/spfileRMANDB.ora&#039;\nORA-27037: unable to obtain file status\nLinux-x86_64 Error: 2: No such file or directory\nAdditional information: 7\n<\/pre><\/div>\n\n\n<p>Podemos recuperar o SPFILE com o comando abaixo, usando os valores em mem\u00f3ria. Apesar do SPFILE original n\u00e3o existir mais, n\u00e3o \u00e9 poss\u00edvel recuperar o arquivo com o mesmo nome original:<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \\&quot;wp-block-syntaxhighlighter-code\\&quot;\"><pre class=\"brush: plain; title: ; notranslate\" title=\"\">\nSQL&gt; CREATE SPFILE=&#039;\/oracle\/18.0.0\/product\/dbs\/spfileRMANDB.ora&#039; FROM MEMORY;\nCREATE SPFILE=&#039;\/oracle\/18.0.0\/product\/dbs\/spfileRMANDB.ora&#039; FROM MEMORY\n*\nERROR at line 1:\nORA-32002: cannot create SPFILE already being used by the instance\n<\/pre><\/div>\n\n\n<p>Desse modo, vamos criar um novo SPFILE com um nome diferente, conforme exemplo abaixo:<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \\&quot;wp-block-syntaxhighlighter-code\\&quot;\"><pre class=\"brush: plain; title: ; notranslate\" title=\"\">\nSQL&gt; CREATE SPFILE=&#039;\/oracle\/18.0.0\/product\/dbs\/spfileRMANDB.BRUNO&#039; FROM MEMORY;\n \nFile created.\n<\/pre><\/div>\n\n\n<p>A\u00ed, quando poss\u00edvel, basta baixarmos o banco de dados, renomearmos o SPFILE novo para o nome antigo, e subir a inst\u00e2ncia:<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \\&quot;wp-block-syntaxhighlighter-code\\&quot;\"><pre class=\"brush: plain; title: ; notranslate\" title=\"\">\nSQL&gt; SHU IMMEDIATE;\nDatabase closed.\nDatabase dismounted.\nORACLE instance shut down.\nSQL&gt; ! mv \/oracle\/18.0.0\/product\/dbs\/spfileRMANDB.BRUNO \/oracle\/18.0.0\/product\/dbs\/spfileRMANDB.ora\n \nSQL&gt; STARTUP;\nORACLE instance started.\n \nTotal System Global Area 1610612016 bytes\nFixed Size                  8658224 bytes\nVariable Size             520093696 bytes\nDatabase Buffers         1073741824 bytes\nRedo Buffers                8118272 bytes\nDatabase mounted.\nDatabase opened.\nSQL&gt; SHO PARAMETER SPFILE;\n \nNAME                                 TYPE        VALUE\n------------------------------------ ----------- ------------------------------\nspfile                               string      \/oracle\/18.0.0\/product\/dbs\/spf\n                                                 ileRMANDB.ora\n<\/pre><\/div>\n\n\n<p>Obs: Este procedimento foi criado pelo senhor Ahmed Baraka (www.ahmedbaraka.com) e foi apenas reproduzido por mim em um laborat\u00f3rio pessoal para fins de aprendizado.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Este artigo abordar\u00e1 a recupera\u00e7\u00e3o do arquivo SPFILE de um banco de dados que ainda est\u00e1 em execu\u00e7\u00e3o, atrav\u00e9s dos valores usados em mem\u00f3ria. Vamos identificar o diret\u00f3rio e arquivo SPFILE usado em nosso ambiente: Deletando o arquivo: Apesar disso, o banco de dados ainda opera normalmente: Ao rodar um VALIDATE DATABASE, o problema \u00e9 [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[3],"tags":[],"class_list":["post-6167","post","type-post","status-publish","format-standard","hentry","category-backup-recovery"],"_links":{"self":[{"href":"https:\/\/swiv.com.br\/index.php\/wp-json\/wp\/v2\/posts\/6167","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/swiv.com.br\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/swiv.com.br\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/swiv.com.br\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/swiv.com.br\/index.php\/wp-json\/wp\/v2\/comments?post=6167"}],"version-history":[{"count":1,"href":"https:\/\/swiv.com.br\/index.php\/wp-json\/wp\/v2\/posts\/6167\/revisions"}],"predecessor-version":[{"id":9062,"href":"https:\/\/swiv.com.br\/index.php\/wp-json\/wp\/v2\/posts\/6167\/revisions\/9062"}],"wp:attachment":[{"href":"https:\/\/swiv.com.br\/index.php\/wp-json\/wp\/v2\/media?parent=6167"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/swiv.com.br\/index.php\/wp-json\/wp\/v2\/categories?post=6167"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/swiv.com.br\/index.php\/wp-json\/wp\/v2\/tags?post=6167"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}