{"id":3988,"date":"2021-04-21T07:54:17","date_gmt":"2021-04-21T07:54:17","guid":{"rendered":"https:\/\/swiv.com.br\/performing-failover-to-a-standby-using-the-broker\/"},"modified":"2026-05-27T20:02:32","modified_gmt":"2026-05-27T19:02:32","slug":"performing-failover-to-a-standby-using-the-broker","status":"publish","type":"post","link":"https:\/\/swiv.com.br\/index.php\/2021\/04\/21\/performing-failover-to-a-standby-using-the-broker\/","title":{"rendered":"Performing Failover to a Standby using the Broker"},"content":{"rendered":"\n<p>A opera\u00e7\u00e3o de Failover em um ambiente Data Guard \u00e9 a resposta a um evento de falha, ou seja, uma situa\u00e7\u00e3o n\u00e3o planejada, ocorrendo devido indisponibilidade do Primary. Como consequ\u00eancia, o Standby passa a operar como Primary (no modo maximum performance), e caso queiramos mudar esse modo para outro valor, \u00e9 necess\u00e1rio antes realizar o &#8220;reinstate&#8221; do primary antigo, ou criar um novo standby database.<\/p>\n\n\n\n<p>Para esse artigo, vamos simular de maneira controlada esse evento. Checando o ambiente primary,standby e que o Redo Apply (por ser um physical standby) est\u00e1 operando normalmente:<\/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@fornix1 ~]$ dgmgrl sys\/oracle@CORTEX\nDGMGRL for Linux: Release 19.0.0.0.0 - Production on Tue Apr 20 20:30:39 2021\nVersion 19.3.0.0.0\n \nCopyright (c) 1982, 2019, Oracle and\/or its affiliates.  All rights reserved.\n \nWelcome to DGMGRL, type &quot;help&quot; for information.\nConnected to &quot;cortex&quot;\nConnected as SYSDBA.\nDGMGRL&gt; SHOW CONFIGURATION;\n \nConfiguration - cortex\n \n  Protection Mode: MaxPerformance\n  Members:\n  cortex   - Primary database\n    cortexdr - Physical standby database\n \nFast-Start Failover:  Disabled\n \nConfiguration Status:\nSUCCESS   (status updated 12 seconds ago)\n \nDGMGRL&gt; SHOW DATABASE CORTEX\n \nDatabase - cortex\n \n  Role:               PRIMARY\n  Intended State:     TRANSPORT-ON\n  Instance(s):\n    cortex\n \nDatabase Status:\nSUCCESS\n \nDGMGRL&gt; SHOW DATABASE CORTEXDR;\n \nDatabase - cortexdr\n \n  Role:               PHYSICAL STANDBY\n  Intended State:     APPLY-ON\n  Transport Lag:      0 seconds (computed 0 seconds ago)\n  Apply Lag:          0 seconds (computed 0 seconds ago)\n  Average Apply Rate: 1.00 KByte\/s\n  Real Time Query:    OFF\n  Instance(s):\n    CORTEXDR\n \nDatabase Status:\nSUCCESS\n \nDGMGRL&gt;\n<\/pre><\/div>\n\n\n<p>Para simular o evento de falha, vamos logar no banco primary e realizar um shutdown abort:<\/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@fornix1 ~]$ sqlplus \/ as sysdba\n \nSQL*Plus: Release 19.0.0.0.0 - Production on Tue Apr 20 20:34:31 2021\nVersion 19.3.0.0.0\n \nCopyright (c) 1982, 2019, Oracle.  All rights reserved.\n \n \nConnected to:\nOracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production\nVersion 19.3.0.0.0\n \nSQL&gt; SELECT INSTANCE_NAME,STATUS FROM V$INSTANCE;\n \nINSTANCE_NAME    STATUS\n---------------- ------------\ncortex           OPEN\n \nSQL&gt; SHU ABORT;\nORACLE instance shut down.\nSQL&gt; !ps -ef | grep pmon\ngrid      3398     1  0 04:45 ?        00:00:02 asm_pmon_+ASM\noracle   31763 31728  0 20:34 pts\/1    00:00:00 \/bin\/bash -c ps -ef | grep pmon\noracle   31765 31763  0 20:34 pts\/1    00:00:00 grep pmon\n<\/pre><\/div>\n\n\n<p>Uma vez identificado a falha, e antes de realizar o failover, podemos verificar se o standby est\u00e1 apto para esta opera\u00e7\u00e3o com o comando abaixo:<\/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@fornix2 ~]$ dgmgrl sys\/oracle@CORTEXDR\nDGMGRL for Linux: Release 19.0.0.0.0 - Production on Tue Apr 20 20:35:59 2021\nVersion 19.3.0.0.0\n \nCopyright (c) 1982, 2019, Oracle and\/or its affiliates.  All rights reserved.\n \nWelcome to DGMGRL, type &quot;help&quot; for information.\nConnected to &quot;cortexDR&quot;\nConnected as SYSDBA.\nDGMGRL&gt; VALIDATE DATABASE VERBOSE CORTEXDR;\n \n  Database Role:     Physical standby database\n  Primary Database:  cortex\n    Warning: primary database was not reachable\n \n  Ready for Switchover:  No\n  Ready for Failover:    Yes (Primary Not Running)\n \n  Flashback Database Status:\n    cortex  :  Unknown\n    cortexdr:  On\n \n  Capacity Information:\n    Database  Instances        Threads\n    cortex    Unknown          Unknown\n    cortexdr  1                1\n \n  Managed by Clusterware:\n    cortex  :  Unknown\n    cortexdr:  YES\n    Validating static connect identifier for the primary database cortex...\nORA-01017: invalid username\/password; logon denied\n \n    Warning: Ensure primary database&#039;s StaticConnectIdentifier property\n    is configured properly so that the primary database can be restarted\n    by DGMGRL after switchover\n \n  Temporary Tablespace File Information:\n    cortex TEMP Files:    Unknown\n    cortexdr TEMP Files:  1\n \n  Data file Online Move in Progress:\n    cortex:    Unknown\n    cortexdr:  No\n \n  Standby Apply-Related Information:\n    Apply State:      Running\n    Apply Lag:        0 seconds (computed 91 seconds ago)\n    Apply Delay:      0 minutes\n \n  Transport-Related Information:\n    Transport On:  No\n    Gap Status:    Unknown\n    Transport Lag:  0 seconds (computed 91 seconds ago)\n    Transport Status:  Success\n \n  Log Files Cleared:\n    cortex Standby Redo Log Files:    Unknown\n    cortexdr Online Redo Log Files:   Unknown\n    cortexdr Standby Redo Log Files:  Unknown\n \n  Apply-Related Property Settings:\n    Property                        cortex Value             cortexdr Value\n    DelayMins                       0                        0\n    ApplyParallel                   AUTO                     AUTO\n    ApplyInstances                  0                        0\n \n  Transport-Related Property Settings:\n    Property                        cortex Value             cortexdr Value\n    LogShipping                     ON                       ON\n    LogXptMode                      ASYNC                    ASYNC\n    Dependency                      &amp;lt;empty&gt;                  &amp;lt;empty&gt;\n    DelayMins                       0                        0\n    Binding                         optional                 optional\n    MaxFailure                      0                        0\n    ReopenSecs                      300                      20\n    NetTimeout                      30                       20\n    RedoCompression                 DISABLE                  DISABLE\n<\/pre><\/div>\n\n\n<p>Uma vez pronto, podemos realizar o failover:<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \\&quot;wp-block-syntaxhighlighter-code\\&quot;\"><pre class=\"brush: plain; title: ; notranslate\" title=\"\">\nDGMGRL&gt; FAILOVER TO CORTEXDR;\nPerforming failover NOW, please wait...\nFailover succeeded, new primary is &quot;cortexdr&quot;\n<\/pre><\/div>\n\n\n<p>Checando nova configura\u00e7\u00e3o:<\/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@fornix2 trace]$ dgmgrl sys\/oracle@CORTEXDR\nDGMGRL for Linux: Release 19.0.0.0.0 - Production on Tue Apr 20 20:44:10 2021\nVersion 19.3.0.0.0\n \nCopyright (c) 1982, 2019, Oracle and\/or its affiliates.  All rights reserved.\n \nWelcome to DGMGRL, type &quot;help&quot; for information.\nConnected to &quot;CORTEXDR&quot;\nConnected as SYSDBA.\nDGMGRL&gt; SHOW CONFIGURATION;\n \nConfiguration - cortex\n \n  Protection Mode: MaxPerformance\n  Members:\n  cortexdr - Primary database\n    cortex   - Physical standby database (disabled)\n      ORA-16661: the standby database needs to be reinstated\n \nFast-Start Failover:  Disabled\n \nConfiguration Status:\nSUCCESS   (status updated 19 seconds ago)\n \nDGMGRL&gt; SHOW DATABASE CORTEX;\n \nDatabase - cortex\n \n  Role:               PHYSICAL STANDBY\n  Intended State:     APPLY-ON\n  Transport Lag:      (unknown)\n  Apply Lag:          (unknown)\n  Average Apply Rate: (unknown)\n  Real Time Query:    OFF\n  Instance(s):\n    cortex\n \nDatabase Status:\nDISABLED - ORA-16661: the standby database needs to be reinstated\n \nDGMGRL&gt; SHOW DATABASE CORTEXDR;\n \nDatabase - cortexdr\n \n  Role:               PRIMARY\n  Intended State:     TRANSPORT-ON\n  Instance(s):\n    CORTEXDR\n \nDatabase Status:\nSUCCESS\n<\/pre><\/div>\n\n\n<h2 class=\"wp-block-heading\">Performing Primary Database Reinstate<\/h2>\n\n\n\n<p>Montando o primary database antigo:<\/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@fornix1 ~]$ sqlplus \/ as sysdba\n \nSQL*Plus: Release 19.0.0.0.0 - Production on Tue Apr 20 20:51:39 2021\nVersion 19.3.0.0.0\n \nCopyright (c) 1982, 2019, Oracle.  All rights reserved.\n \nConnected to an idle instance.\n \nSQL&gt; startup mount;\nORACLE instance started.\n \nTotal System Global Area 2583690520 bytes\nFixed Size                  8899864 bytes\nVariable Size             553648128 bytes\nDatabase Buffers         2013265920 bytes\nRedo Buffers                7876608 bytes\nDatabase mounted.\nSQL&gt;\n<\/pre><\/div>\n\n\n<p>Conectando no novo primary database, e realizando a opera\u00e7\u00e3o de reinstate do primary antigo:<\/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@fornix2 trace]$ dgmgrl sys\/oracle@CORTEXDR\nDGMGRL for Linux: Release 19.0.0.0.0 - Production on Tue Apr 20 20:55:27 2021\nVersion 19.3.0.0.0\n \nCopyright (c) 1982, 2019, Oracle and\/or its affiliates.  All rights reserved.\n \nWelcome to DGMGRL, type &quot;help&quot; for information.\nConnected to &quot;CORTEXDR&quot;\nConnected as SYSDBA.\nDGMGRL&gt; REINSTATE DATABASE CORTEX;\nReinstating database &quot;cortex&quot;, please wait...\nReinstatement of database &quot;cortex&quot; succeeded\n<\/pre><\/div>\n\n\n<p>Checando nova configura\u00e7\u00e3o:<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \\&quot;wp-block-syntaxhighlighter-code\\&quot;\"><pre class=\"brush: plain; title: ; notranslate\" title=\"\">\nDGMGRL&gt; SHOW CONFIGURATION;\n \nConfiguration - cortex\n \n  Protection Mode: MaxPerformance\n  Members:\n  cortexdr - Primary database\n    cortex   - Physical standby database\n \nFast-Start Failover:  Disabled\n \nConfiguration Status:\nSUCCESS   (status updated 36 seconds ago)\n \nDGMGRL&gt; SHOW DATABASE CORTEX;\n \nDatabase - cortex\n \n  Role:               PHYSICAL STANDBY\n  Intended State:     APPLY-ON\n  Transport Lag:      0 seconds (computed 1 second ago)\n  Apply Lag:          0 seconds (computed 1 second ago)\n  Average Apply Rate: 44.00 KByte\/s\n  Real Time Query:    OFF\n  Instance(s):\n    cortex\n \nDatabase Status:\nSUCCESS\n \nDGMGRL&gt; SHOW DATABASE CORTEXDR;\n \nDatabase - cortexdr\n \n  Role:               PRIMARY\n  Intended State:     TRANSPORT-ON\n  Instance(s):\n    CORTEXDR\n \nDatabase Status:\nSUCCESS\n<\/pre><\/div>\n\n\n<p>A partir daqui, se quisermos voltar o ambiente na condi\u00e7\u00e3o original, podemos realizar um switchover conforme abaixo:<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \\&quot;wp-block-syntaxhighlighter-code\\&quot;\"><pre class=\"brush: plain; title: ; notranslate\" title=\"\">\nDGMGRL&gt; VALIDATE DATABASE CORTEX;\n \n  Database Role:     Physical standby database\n  Primary Database:  cortexdr\n \n  Ready for Switchover:  Yes\n  Ready for Failover:    Yes (Primary Running)\n \n  Managed by Clusterware:\n    cortexdr:  YES\n    cortex  :  YES\n \n  Log Files Cleared:\n    cortexdr Standby Redo Log Files:  Cleared\n    cortex Online Redo Log Files:     Not Cleared\n    cortex Standby Redo Log Files:    Available\n \n  Transport-Related Property Settings:\n    Property                        cortexdr Value           cortex Value\n    ReopenSecs                      20                       300\n    NetTimeout                      20                       30\n \nDGMGRL&gt; SWITCHOVER TO CORTEX;\nPerforming switchover NOW, please wait...\nOperation requires a connection to database &quot;cortex&quot;\nConnecting ...\nConnected to &quot;cortex&quot;\nConnected as SYSDBA.\nNew primary database &quot;cortex&quot; is opening...\nOracle Clusterware is restarting database &quot;cortexdr&quot; ...\nConnected to an idle instance.\nConnected to an idle instance.\nConnected to an idle instance.\nConnected to an idle instance.\nConnected to an idle instance.\nConnected to &quot;cortexDR&quot;\nConnected to &quot;cortexDR&quot;\nSwitchover succeeded, new primary is &quot;cortex&quot;\nDGMGRL&gt;\n<\/pre><\/div>\n\n\n<p>Ambiente operando nas condi\u00e7\u00f5es originais:<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \\&quot;wp-block-syntaxhighlighter-code\\&quot;\"><pre class=\"brush: plain; title: ; notranslate\" title=\"\">\nDGMGRL&gt; SHOW CONFIGURATION;\n \nConfiguration - cortex\n \n  Protection Mode: MaxPerformance\n  Members:\n  cortex   - Primary database\n    cortexdr - Physical standby database\n \nFast-Start Failover:  Disabled\n \nConfiguration Status:\nSUCCESS   (status updated 2 second ago)\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>A opera\u00e7\u00e3o de Failover em um ambiente Data Guard \u00e9 a resposta a um evento de falha, ou seja, uma situa\u00e7\u00e3o n\u00e3o planejada, ocorrendo devido indisponibilidade do Primary. Como consequ\u00eancia, o Standby passa a operar como Primary (no modo maximum performance), e caso queiramos mudar esse modo para outro valor, \u00e9 necess\u00e1rio antes realizar o [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[5],"tags":[],"class_list":["post-3988","post","type-post","status-publish","format-standard","hentry","category-high-availability"],"_links":{"self":[{"href":"https:\/\/swiv.com.br\/index.php\/wp-json\/wp\/v2\/posts\/3988","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=3988"}],"version-history":[{"count":1,"href":"https:\/\/swiv.com.br\/index.php\/wp-json\/wp\/v2\/posts\/3988\/revisions"}],"predecessor-version":[{"id":9162,"href":"https:\/\/swiv.com.br\/index.php\/wp-json\/wp\/v2\/posts\/3988\/revisions\/9162"}],"wp:attachment":[{"href":"https:\/\/swiv.com.br\/index.php\/wp-json\/wp\/v2\/media?parent=3988"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/swiv.com.br\/index.php\/wp-json\/wp\/v2\/categories?post=3988"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/swiv.com.br\/index.php\/wp-json\/wp\/v2\/tags?post=3988"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}