{"id":2400,"date":"2021-03-06T17:22:23","date_gmt":"2021-03-06T17:22:23","guid":{"rendered":"https:\/\/swiv.com.br\/preparing-and-creating-physical-standby-database\/"},"modified":"2026-05-27T20:02:52","modified_gmt":"2026-05-27T19:02:52","slug":"preparing-and-creating-physical-standby-database","status":"publish","type":"post","link":"https:\/\/swiv.com.br\/index.php\/2021\/03\/06\/preparing-and-creating-physical-standby-database\/","title":{"rendered":"Preparing and creating Physical Standby Database"},"content":{"rendered":"\n<p>Ajustando o bash_profile do ambiente Standby:<\/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 ~]$ cat .bash_profile\n# .bash_profile\n \n# Get the aliases and functions\nif &#x5B; -f ~\/.bashrc ]; then\n        . ~\/.bashrc\nfi\n \n# User specific environment and startup programs\n \nPATH=$PATH:$HOME\/.local\/bin:$HOME\/bin\n \nexport PATH\n \nORACLE_SID=CORTEXDR; export ORACLE_SID\nJAVA_HOME=\/usr\/bin\/java; export JAVA_HOME\nORACLE_BASE=\/oracle\/19.3.0\/base; export ORACLE_BASE\nORACLE_HOME=\/oracle\/19.3.0\/product; export ORACLE_HOME\nORACLE_TERM=xterm; export ORACLE_TERM\nTNS_ADMIN=$ORACLE_HOME\/network\/admin; export TNS_ADMIN\nPATH=.:${JAVA_HOME}\/bin:${PATH}:$HOME\/bin:$ORACLE_HOME\/bin\nPATH=${PATH}:\/usr\/bin:\/bin:\/usr\/local\/bin\nexport PATH\nexport TEMP=\/tmp\nexport TMPDIR=\/tmp\numask 022\n&#x5B;oracle@fornix2 ~]$\n<\/pre><\/div>\n\n\n<p>Criando diret\u00f3rios dentro do ASM (diskgroup de dados):<\/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;grid@fornix2 ~]$ asmcmd\nASMCMD&gt; ls\nDG_DATA\/\nDG_FRA\/\nDG_GRID\/\nDG_RECO\/\nASMCMD&gt; cd DG_DATA\/\nASMCMD&gt; mkdir CORTEX\nASMCMD&gt; mkdir CORTEXDR\nASMCMD&gt; ls\nCORTEX\/\nCORTEXDR\/\nASMCMD&gt;\n<\/pre><\/div>\n\n\n<p>Criando um arquivo pfile com o usu\u00e1rio oracle, utilizando apenas o par\u00e2metro DB_NAME:<\/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 dbs]$ cd $ORACLE_HOME\/dbs\n&#x5B;oracle@fornix2 dbs]$ cat initCORTEXDR.ora\nDB_NAME=CORTEX\n&#x5B;oracle@fornix2 dbs]$\n<\/pre><\/div>\n\n\n<p>Logando no ambiente primary, e copiando o password file para o ambiente standby:<\/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 dbs]$ scp orapwcortex oracle@fornix2:\/oracle\/19.3.0\/product\/dbs\/orapwCORTEXDR\noracle@fornix2&#039;s password:\norapwcortex                                                                                         100% 2048     1.3MB\/s   00:00\n&#x5B;oracle@fornix1 dbs]$\n<\/pre><\/div>\n\n\n<p>Configurando o arquivo tnsnames.ora do standby usando como refer\u00eancia o do primary:<\/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 admin]$ cp tnsnames.ora tnsnames.ora.old\n&#x5B;oracle@fornix2 admin]$\n<\/pre><\/div>\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 dbs]$ cd $ORACLE_HOME\/network\/admin\n&#x5B;oracle@fornix1 admin]$ scp tnsnames.ora oracle@fornix2:\/oracle\/19.3.0\/product\/network\/admin\noracle@fornix2&#039;s password:\ntnsnames.ora                                                                                        100%  825   326.2KB\/s   00:00\n&#x5B;oracle@fornix1 admin]$\n<\/pre><\/div>\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 admin]$ cat tnsnames.ora\n# tnsnames.ora Network Configuration File: \/oracle\/19.3.0\/product\/network\/admin\/tnsnames.ora\n# Generated by Oracle configuration tools.\n \nCORTEX =\n  (DESCRIPTION =\n    (ADDRESS = (PROTOCOL = TCP)(HOST = fornix1.localdomain)(PORT = 1521))\n    (CONNECT_DATA =\n      (SERVER = DEDICATED)\n      (SERVICE_NAME = cortex.localdomain)\n    )\n  )\n \nLISTENER_LISTENER =\n  (ADDRESS = (PROTOCOL = TCP)(HOST = fornix1.localdomain)(PORT = 1521))\n \n \nCORTEXDR =\n  (DESCRIPTION =\n    (ADDRESS = (PROTOCOL = TCP)(HOST = fornix2.localdomain)(PORT = 1522))\n    (CONNECT_DATA =\n      (SERVER = DEDICATED)\n      (SERVICE_NAME = cortexDR.localdomain)\n    )(UR=A)\n  )\n \n \nRMANDB =\n  (DESCRIPTION =\n    (ADDRESS = (PROTOCOL = TCP)(HOST = oel8.localdomain)(PORT = 1521))\n    (CONNECT_DATA =\n      (SERVER = DEDICATED)\n      (SERVICE_NAME = RMANDB)\n    )\n  )\n&#x5B;oracle@fornix2 admin]$\n<\/pre><\/div>\n\n\n<p>Checando se o arquivo sqlnet.ora est\u00e1 devidamente configurado:<\/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 admin]$ cat sqlnet.ora\n# sqlnet.ora Network Configuration File: \/oracle\/19.3.0\/product\/network\/admin\/sqlnet.ora\n# Generated by Oracle configuration tools.\n \nNAMES.DIRECTORY_PATH= (TNSNAMES, EZCONNECT)\n \n&#x5B;oracle@fornix2 admin]$\n<\/pre><\/div>\n\n\n<p>Para evitar poss\u00edveis problemas no momento de realizar o restore do banco, \u00e9 indicado registrar de maneira est\u00e1tica o database no listener:<\/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;grid@fornix2 admin]$ cat listener.ora\n#Backup file is  \/grid\/19.3.0\/base\/crsdata\/fornix2\/output\/listener.ora.bak.fornix2.grid line added by Agent\nLISTENER=(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=IPC)(KEY=LISTENER))))            # line added by Agent\nENABLE_GLOBAL_DYNAMIC_ENDPOINT_LISTENER=ON              # line added by Agent\nVALID_NODE_CHECKING_REGISTRATION_LISTENER=ON            # line added by Agent\n \nLISTENERDR =\n  (DESCRIPTION_LIST =\n   (DESCRIPTION =\n    (ADDRESS = (PROTOCOL = TCP) (HOST = fornix2.localdomain) (PORT = 1522))\n     (ADDRESS = (PROTOCOL = IPC) (KEY = EXTPROC1522))\n    )\n   )\n \nSID_LIST_LISTENERDR=\n   (SID_LIST=\n     (SID_DESC=\n        (GLOBAL_DBNAME=CORTEXDR.localdomain)\n        (SID_NAME=CORTEXDR)\n        (ORACLE_HOME=\/oracle\/19.3.0\/product)\n     )\n   )\n&#x5B;grid@fornix2 admin]$ lsnrctl start LISTENERDR\n \nLSNRCTL for Linux: Version 19.0.0.0.0 - Production on 06-MAR-2021 11:20:02\n \nCopyright (c) 1991, 2019, Oracle.  All rights reserved.\n \nStarting \/grid\/19.3.0\/product\/bin\/tnslsnr: please wait...\n \nTNSLSNR for Linux: Version 19.0.0.0.0 - Production\nSystem parameter file is \/grid\/19.3.0\/product\/network\/admin\/listener.ora\nLog messages written to \/grid\/19.3.0\/base\/diag\/tnslsnr\/fornix2\/listenerdr\/alert\/log.xml\nListening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=fornix2.localdomain)(PORT=1522)))\nListening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1522)))\n \nConnecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=fornix2.localdomain)(PORT=1522)))\nSTATUS of the LISTENER\n------------------------\nAlias                     LISTENERDR\nVersion                   TNSLSNR for Linux: Version 19.0.0.0.0 - Production\nStart Date                06-MAR-2021 11:20:02\nUptime                    0 days 0 hr. 0 min. 1 sec\nTrace Level               off\nSecurity                  ON: Local OS Authentication\nSNMP                      OFF\nListener Parameter File   \/grid\/19.3.0\/product\/network\/admin\/listener.ora\nListener Log File         \/grid\/19.3.0\/base\/diag\/tnslsnr\/fornix2\/listenerdr\/alert\/log.xml\nListening Endpoints Summary...\n  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=fornix2.localdomain)(PORT=1522)))\n  (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1522)))\nServices Summary...\nService &quot;CORTEXDR.localdomain&quot; has 1 instance(s).\n  Instance &quot;CORTEXDR&quot;, status UNKNOWN, has 1 handler(s) for this service...\nThe command completed successfully\n&#x5B;grid@fornix2 admin]$ lsnrctl service LISTENERDR\n \nLSNRCTL for Linux: Version 19.0.0.0.0 - Production on 06-MAR-2021 11:20:51\n \nCopyright (c) 1991, 2019, Oracle.  All rights reserved.\n \nConnecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=fornix2.localdomain)(PORT=1522)))\nServices Summary...\nService &quot;CORTEXDR.localdomain&quot; has 1 instance(s).\n  Instance &quot;CORTEXDR&quot;, status UNKNOWN, has 1 handler(s) for this service...\n    Handler(s):\n      &quot;DEDICATED&quot; established:0 refused:0\n         LOCAL SERVER\nThe command completed successfully\n&#x5B;grid@fornix2 admin]$\n<\/pre><\/div>\n\n\n<p>Criando os diret\u00f3rios de dump no standby:<\/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 admin]$ cd $ORACLE_BASE\/admin\n&#x5B;oracle@fornix2 admin]$ mkdir CORTEXDR\n&#x5B;oracle@fornix2 admin]$ cd CORTEXDR\/\n&#x5B;oracle@fornix2 CORTEXDR]$ mkdir adump\n&#x5B;oracle@fornix2 CORTEXDR]$ mkdir cdump\n<\/pre><\/div>\n\n\n<p>Subindo a inst\u00e2ncia no standby:<\/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 CORTEXDR]$ sqlplus \/ as sysdba\n \nSQL*Plus: Release 19.0.0.0.0 - Production on Sat Mar 6 11:23:49 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 nomount;\nORACLE instance started.\n \nTotal System Global Area  243268216 bytes\nFixed Size                  8895096 bytes\nVariable Size             180355072 bytes\nDatabase Buffers           50331648 bytes\nRedo Buffers                3686400 bytes\nSQL&gt; select instance_name,status from v$instance;\n \nINSTANCE_NAME    STATUS\n---------------- ------------\nCORTEXDR         STARTED\n \nSQL&gt;\n<\/pre><\/div>\n\n\n<p>Chamando o RMAN:<\/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 dbs]$ rman target sys\/oracle@CORTEX AUXILIARY sys\/oracle@CORTEXDR;\n \nRecovery Manager: Release 19.0.0.0.0 - Production on Sat Mar 6 12:07:32 2021\nVersion 19.3.0.0.0\n \nCopyright (c) 1982, 2019, Oracle and\/or its affiliates.  All rights reserved.\n \nconnected to target database: CORTEX (DBID=548968087)\nconnected to auxiliary database: CORTEX (not mounted)\n \nRMAN&gt;\n<\/pre><\/div>\n\n\n<p>O bloco abaixo permitir\u00e1 o duplicate do banco para o standby. Note que o par\u00e2metro nofilenamecheck se encontra nele pois o nome dos diskgroups que abrigar\u00e3o os arquivos s\u00e3o os mesmos da origem:<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \\&quot;wp-block-syntaxhighlighter-code\\&quot;\"><pre class=\"brush: plain; title: ; notranslate\" title=\"\">\nrun { \nallocate channel ch1 type disk; \nallocate channel ch2 type disk; \nallocate auxiliary channel ch3 type disk; \nDUPLICATE TARGET DATABASE FOR STANDBY FROM ACTIVE DATABASE SPFILE \nset &#039;db_unique_name&#039;=&#039;cortexDR&#039; \nset control_files=&#039;+DG_DATA\/CORTEXDR\/control.ctl&#039; \nset db_create_file_dest=&#039;+DG_DATA&#039; \nset db_create_online_log_dest_1=&#039;+DG_FRA&#039; \nset db_create_online_log_dest_2=&#039;+DG_DATA&#039; \nset db_recovery_file_dest=&#039;+DG_FRA&#039; \nset DB_RECOVERY_FILE_DEST_SIZE=&#039;1G&#039; \nset audit_file_dest=&#039;\/oracle\/19.3.0\/base\/admin\/CORTEXDR\/adump&#039; \nset core_dump_dest=&#039;\/oracle\/19.3.0\/base\/admin\/CORTEXDR\/cdump&#039; nofilenamecheck; }\n<\/pre><\/div>\n\n\n<p>Execu\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=\"\">\nRMAN&gt; run {\nallocate channel ch1 type disk;\nallocate channel ch2 type disk;\nallocate auxiliary channel ch3 type disk;\n2&gt; 3&gt; 4&gt; 5&gt; DUPLICATE TARGET DATABASE FOR STANDBY FROM ACTIVE DATABASE SPFILE\nset &#039;db_unique_name&#039;=&#039;cortexDR&#039;\nset control_files=&#039;+DG_DATA\/CORTEXDR\/control.ctl&#039;\nset db_create_file_dest=&#039;+DG_DATA&#039;\nset db_create_online_log_dest_1=&#039;+DG_FRA&#039;\nset db_create_online_log_dest_2=&#039;+DG_DATA&#039;\nset db_recovery_file_dest=&#039;+DG_FRA&#039;\nset DB_RECOVERY_FILE_DEST_SIZE=&#039;1G&#039;\nset audit_file_dest=&#039;\/oracle\/19.3.0\/base\/admin\/CORTEXDR\/adump&#039;\nset core_dump_dest=&#039;\/oracle\/19.3.0\/base\/admin\/CORTEXDR\/cdump&#039; nofilenamecheck; }6&gt; 7&gt; 8&gt; 9&gt; 10&gt; 11&gt; 12&gt; 13&gt; 14&gt;\n \nusing target database control file instead of recovery catalog\nallocated channel: ch1\nchannel ch1: SID=84 device type=DISK\n \nallocated channel: ch2\nchannel ch2: SID=119 device type=DISK\n \nallocated channel: ch3\nchannel ch3: SID=38 device type=DISK\n \nStarting Duplicate Db at 06-MAR-21\n \ncontents of Memory Script:\n{\n   backup as copy reuse\n   passwordfile auxiliary format  &#039;\/oracle\/19.3.0\/product\/dbs\/orapwCORTEXDR&#039;   targetfile\n &#039;+DG_DATA\/CORTEX\/PARAMETERFILE\/spfile.265.1039034301&#039; auxiliary format\n &#039;\/oracle\/19.3.0\/product\/dbs\/spfileCORTEXDR.ora&#039;   ;\n   sql clone &quot;alter system set spfile= &#039;&#039;\/oracle\/19.3.0\/product\/dbs\/spfileCORTEXDR.ora&#039;&#039;&quot;;\n}\nexecuting Memory Script\n \nStarting backup at 06-MAR-21\nFinished backup at 06-MAR-21\n \nsql statement: alter system set spfile= &#039;&#039;\/oracle\/19.3.0\/product\/dbs\/spfileCORTEXDR.ora&#039;&#039;\n \ncontents of Memory Script:\n{\n   sql clone &quot;alter system set  db_unique_name =\n &#039;&#039;cortexDR&#039;&#039; comment=\n &#039;&#039;&#039;&#039; scope=spfile&quot;;\n   sql clone &quot;alter system set  control_files =\n &#039;&#039;+DG_DATA\/CORTEXDR\/control.ctl&#039;&#039; comment=\n &#039;&#039;&#039;&#039; scope=spfile&quot;;\n   sql clone &quot;alter system set  db_create_file_dest =\n &#039;&#039;+DG_DATA&#039;&#039; comment=\n &#039;&#039;&#039;&#039; scope=spfile&quot;;\n   sql clone &quot;alter system set  db_create_online_log_dest_1 =\n &#039;&#039;+DG_FRA&#039;&#039; comment=\n &#039;&#039;&#039;&#039; scope=spfile&quot;;\n   sql clone &quot;alter system set  db_create_online_log_dest_2 =\n &#039;&#039;+DG_DATA&#039;&#039; comment=\n &#039;&#039;&#039;&#039; scope=spfile&quot;;\n   sql clone &quot;alter system set  db_recovery_file_dest =\n &#039;&#039;+DG_FRA&#039;&#039; comment=\n &#039;&#039;&#039;&#039; scope=spfile&quot;;\n   sql clone &quot;alter system set  DB_RECOVERY_FILE_DEST_SIZE =\n 1G comment=\n &#039;&#039;&#039;&#039; scope=spfile&quot;;\n   sql clone &quot;alter system set  audit_file_dest =\n &#039;&#039;\/oracle\/19.3.0\/base\/admin\/CORTEXDR\/adump&#039;&#039; comment=\n &#039;&#039;&#039;&#039; scope=spfile&quot;;\n   sql clone &quot;alter system set  core_dump_dest =\n &#039;&#039;\/oracle\/19.3.0\/base\/admin\/CORTEXDR\/cdump&#039;&#039; comment=\n &#039;&#039;&#039;&#039; scope=spfile&quot;;\n   shutdown clone immediate;\n   startup clone nomount;\n}\nexecuting Memory Script\n \nsql statement: alter system set  db_unique_name =  &#039;&#039;cortexDR&#039;&#039; comment= &#039;&#039;&#039;&#039; scope=spfile\n \nsql statement: alter system set  control_files =  &#039;&#039;+DG_DATA\/CORTEXDR\/control.ctl&#039;&#039; comment= &#039;&#039;&#039;&#039; scope=spfile\n \nsql statement: alter system set  db_create_file_dest =  &#039;&#039;+DG_DATA&#039;&#039; comment= &#039;&#039;&#039;&#039; scope=spfile\n \nsql statement: alter system set  db_create_online_log_dest_1 =  &#039;&#039;+DG_FRA&#039;&#039; comment= &#039;&#039;&#039;&#039; scope=spfile\n \nsql statement: alter system set  db_create_online_log_dest_2 =  &#039;&#039;+DG_DATA&#039;&#039; comment= &#039;&#039;&#039;&#039; scope=spfile\n \nsql statement: alter system set  db_recovery_file_dest =  &#039;&#039;+DG_FRA&#039;&#039; comment= &#039;&#039;&#039;&#039; scope=spfile\n \nsql statement: alter system set  DB_RECOVERY_FILE_DEST_SIZE =  1G comment= &#039;&#039;&#039;&#039; scope=spfile\n \nsql statement: alter system set  audit_file_dest =  &#039;&#039;\/oracle\/19.3.0\/base\/admin\/CORTEXDR\/adump&#039;&#039; comment= &#039;&#039;&#039;&#039; scope=spfile\n \nsql statement: alter system set  core_dump_dest =  &#039;&#039;\/oracle\/19.3.0\/base\/admin\/CORTEXDR\/cdump&#039;&#039; comment= &#039;&#039;&#039;&#039; scope=spfile\n \nOracle instance shut down\n \nconnected to auxiliary database (not started)\nOracle instance started\n \nTotal System Global Area    2583690520 bytes\n \nFixed Size                     8899864 bytes\nVariable Size                553648128 bytes\nDatabase Buffers            2013265920 bytes\nRedo Buffers                   7876608 bytes\nallocated channel: ch3\nchannel ch3: SID=45 device type=DISK\nduplicating Online logs to Oracle Managed File (OMF) location\nduplicating Datafiles to Oracle Managed File (OMF) location\n \ncontents of Memory Script:\n{\n   backup as copy current controlfile for standby auxiliary format  &#039;+DG_DATA\/CORTEXDR\/control.ctl&#039;;\n}\nexecuting Memory Script\n \nStarting backup at 06-MAR-21\nchannel ch1: starting datafile copy\ncopying standby control file\noutput file name=\/oracle\/19.3.0\/product\/dbs\/snapcf_cortex.f tag=TAG20210306T122236\nchannel ch1: datafile copy complete, elapsed time: 00:00:03\nFinished backup at 06-MAR-21\n \ncontents of Memory Script:\n{\n   sql clone &#039;alter database mount standby database&#039;;\n}\nexecuting Memory Script\n \nsql statement: alter database mount standby database\n \ncontents of Memory Script:\n{\n   set newname for clone tempfile  1 to new;\n   switch clone tempfile all;\n   set newname for clone datafile  1 to new;\n   set newname for clone datafile  3 to new;\n   set newname for clone datafile  4 to new;\n   set newname for clone datafile  5 to new;\n   set newname for clone datafile  7 to new;\n   backup as copy reuse\n   datafile  1 auxiliary format new\n   datafile  3 auxiliary format new\n   datafile  4 auxiliary format new\n   datafile  5 auxiliary format new\n   datafile  7 auxiliary format new\n   ;\n   sql &#039;alter system archive log current&#039;;\n}\nexecuting Memory Script\n \nexecuting command: SET NEWNAME\n \nrenamed tempfile 1 to +DG_DATA in control file\n \nexecuting command: SET NEWNAME\n \nexecuting command: SET NEWNAME\n \nexecuting command: SET NEWNAME\n \nexecuting command: SET NEWNAME\n \nexecuting command: SET NEWNAME\n \nStarting backup at 06-MAR-21\nchannel ch1: starting datafile copy\ninput datafile file number=00001 name=+DG_DATA\/CORTEX\/DATAFILE\/system.256.1039033445\nchannel ch2: starting datafile copy\ninput datafile file number=00005 name=+DG_DATA\/CORTEX\/DATAFILE\/soe.266.1065506205\noutput file name=+DG_DATA\/CORTEXDR\/DATAFILE\/system.259.1066479769 tag=TAG20210306T122248\nchannel ch1: datafile copy complete, elapsed time: 00:00:55\nchannel ch1: starting datafile copy\ninput datafile file number=00003 name=+DG_DATA\/CORTEX\/DATAFILE\/sysaux.257.1039033519\noutput file name=+DG_DATA\/CORTEXDR\/DATAFILE\/soe.258.1066479771 tag=TAG20210306T122248\nchannel ch2: datafile copy complete, elapsed time: 00:00:56\nchannel ch2: starting datafile copy\ninput datafile file number=00004 name=+DG_DATA\/CORTEX\/DATAFILE\/undotbs1.258.1039033555\noutput file name=+DG_DATA\/CORTEXDR\/DATAFILE\/undotbs1.256.1066479825 tag=TAG20210306T122248\nchannel ch2: datafile copy complete, elapsed time: 00:00:25\nchannel ch2: starting datafile copy\ninput datafile file number=00007 name=+DG_DATA\/CORTEX\/DATAFILE\/users.259.1039033555\noutput file name=+DG_DATA\/CORTEXDR\/DATAFILE\/users.260.1066479853 tag=TAG20210306T122248\nchannel ch2: datafile copy complete, elapsed time: 00:00:03\noutput file name=+DG_DATA\/CORTEXDR\/DATAFILE\/sysaux.257.1066479825 tag=TAG20210306T122248\nchannel ch1: datafile copy complete, elapsed time: 00:00:34\nFinished backup at 06-MAR-21\n \nsql statement: alter system archive log current\n \ncontents of Memory Script:\n{\n   switch clone datafile all;\n}\nexecuting Memory Script\n \ndatafile 1 switched to datafile copy\ninput datafile copy RECID=1 STAMP=1066479860 file name=+DG_DATA\/CORTEXDR\/DATAFILE\/system.259.1066479769\ndatafile 3 switched to datafile copy\ninput datafile copy RECID=2 STAMP=1066479860 file name=+DG_DATA\/CORTEXDR\/DATAFILE\/sysaux.257.1066479825\ndatafile 4 switched to datafile copy\ninput datafile copy RECID=3 STAMP=1066479860 file name=+DG_DATA\/CORTEXDR\/DATAFILE\/undotbs1.256.1066479825\ndatafile 5 switched to datafile copy\ninput datafile copy RECID=4 STAMP=1066479860 file name=+DG_DATA\/CORTEXDR\/DATAFILE\/soe.258.1066479771\ndatafile 7 switched to datafile copy\ninput datafile copy RECID=5 STAMP=1066479860 file name=+DG_DATA\/CORTEXDR\/DATAFILE\/users.260.1066479853\nFinished Duplicate Db at 06-MAR-21\nreleased channel: ch1\nreleased channel: ch2\nreleased channel: ch3\n \nRMAN&gt;\n<\/pre><\/div>\n\n\n<p>Validando o standby:<\/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 dbs]$ sqlplus \/ as sysdba\n \nSQL*Plus: Release 19.0.0.0.0 - Production on Sat Mar 6 12:38:19 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 NAME FROM V$DATAFILE;\n \nNAME\n--------------------------------------------------------------------------------\n+DG_DATA\/CORTEXDR\/DATAFILE\/system.259.1066479769\n+DG_DATA\/CORTEXDR\/DATAFILE\/sysaux.257.1066479825\n+DG_DATA\/CORTEXDR\/DATAFILE\/undotbs1.256.1066479825\n+DG_DATA\/CORTEXDR\/DATAFILE\/soe.258.1066479771\n+DG_DATA\/CORTEXDR\/DATAFILE\/users.260.1066479853\n \nSQL&gt; select instance_name,status from v$instance;\n \nINSTANCE_NAME    STATUS\n---------------- ------------\nCORTEXDR         MOUNTED\n \nSQL&gt;\n<\/pre><\/div>\n\n\n<p>Nota-se que o Standby Redologs foram multiplexados, e como isso n\u00e3o \u00e9 necess\u00e1rio em nosso ambiente, vou dropar os arquivos poss\u00edveis:<\/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 GROUP#,THREAD#,SEQUENCE#,ARCHIVED,STATUS FROM V$STANDBY_LOG;\n \n    GROUP#    THREAD#  SEQUENCE# ARC STATUS\n---------- ---------- ---------- --- ----------\n         4          1         37 YES UNASSIGNED\n         5          1          0 YES UNASSIGNED\n         6          1          0 YES UNASSIGNED\n         7          1          0 YES UNASSIGNED\n \nSQL&gt; SELECT TYPE, count(*) FROM V$LOGFILE GROUP BY TYPE;\n \nTYPE      COUNT(*)\n------- ----------\nONLINE           6\nSTANDBY          8\n \nSQL&gt; COLUMN MEMBER FORMAT A50\nSQL&gt; SELECT GROUP#, MEMBER FROM V$LOGFILE WHERE TYPE=&#039;STANDBY&#039; ORDER BY 1,2;\n \n    GROUP# MEMBER\n---------- --------------------------------------------------\n         4 +DG_DATA\/CORTEXDR\/ONLINELOG\/group_4.264.1066479893\n         4 +DG_FRA\/CORTEXDR\/ONLINELOG\/group_4.264.1066479889\n         5 +DG_DATA\/CORTEXDR\/ONLINELOG\/group_5.265.1066479905\n         5 +DG_FRA\/CORTEXDR\/ONLINELOG\/group_5.265.1066479901\n         6 +DG_DATA\/CORTEXDR\/ONLINELOG\/group_6.267.1066479917\n         6 +DG_FRA\/CORTEXDR\/ONLINELOG\/group_6.266.1066479911\n         7 +DG_DATA\/CORTEXDR\/ONLINELOG\/group_7.268.1066479929\n         7 +DG_FRA\/CORTEXDR\/ONLINELOG\/group_7.267.1066479923\n \n8 rows selected.\n \nSQL&gt; ALTER DATABASE DROP STANDBY LOGFILE MEMBER &#039;+DG_DATA\/CORTEXDR\/ONLINELOG\/group_4.264.1066479893&#039;;\n \nDatabase altered.\n \nSQL&gt; ALTER DATABASE DROP STANDBY LOGFILE MEMBER &#039;+DG_DATA\/CORTEXDR\/ONLINELOG\/group_5.265.1066479905&#039;;\n \nDatabase altered.\n \nSQL&gt; ALTER DATABASE DROP STANDBY LOGFILE MEMBER &#039;+DG_DATA\/CORTEXDR\/ONLINELOG\/group_6.267.1066479917&#039;;\n \nDatabase altered.\n \nSQL&gt; ALTER DATABASE DROP STANDBY LOGFILE MEMBER &#039;+DG_DATA\/CORTEXDR\/ONLINELOG\/group_7.268.1066479929&#039;;\n \nDatabase altered.\n \nSQL&gt;\n<\/pre><\/div>\n\n\n<p>Setando os par\u00e2metros no Standby:<\/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; ALTER SYSTEM SET FAL_SERVER=CORTEX;\nALTER SYSTEM SET FAL_CLIENT=CORTEXDR;\nALTER SYSTEM SET LOG_ARCHIVE_CONFIG=&#039;DG_CONFIG=(CORTEX,CORTEXDR)&#039;;\nALTER SYSTEM SET STANDBY_FILE_MANAGEMENT=AUTO;\nALTER SYSTEM SET LOG_ARCHIVE_DEST_2=&#039;SERVICE=CORTEX ASYNC DB_UNIQUE_NAME=cortex VALID_FOR=(ONLINE_LOGFILE,PRIMARY_ROLE)&#039; scope=both;\nSystem altered.\n \nSQL&gt;\nSystem altered.\n \nSQL&gt;\nSystem altered.\n \nSQL&gt;\nSystem altered.\n \nSQL&gt;\n \nSystem altered.\n \nSQL&gt;\n<\/pre><\/div>\n\n\n<p>Iniciando o processo:<\/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; ALTER DATABASE RECOVER MANAGED STANDBY DATABASE DISCONNECT;\n \nDatabase altered.\n<\/pre><\/div>\n\n\n<p>Checando configura\u00e7\u00e3o no Standby:<\/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; SET LIN 300\nCOL FILENAME FORMAT A40\nSELECT SEQUENCE#, APPLIED, FIRST_TIME, NEXT_TIME, replace( NAME ,&#039;DG_RECO\/CORTEXDR\/ARCHIVELOG\/2021_03_06\/&#039;,&#039;&#039;) FILENAME FROM V$ARCHIVED_LOG ORDER BY SEQUENCE#;SQL&gt; SQL&gt;\n \n SEQUENCE# APPLIED   FIRST_TIME          NEXT_TIME           FILENAME\n---------- --------- ------------------- ------------------- ----------------------------------------\n        36 NO        2021-03-06:11:56:00 2021-03-06:12:24:19 +thread_1_seq_36.281.1066480013\n        37 NO        2021-03-06:12:24:19 2021-03-06:12:54:19 +thread_1_seq_37.282.1066481661\n        38 NO        2021-03-06:12:54:19 2021-03-06:12:59:52 +thread_1_seq_38.283.1066481993\n        39 NO        2021-03-06:12:59:52 2021-03-06:13:29:50 +thread_1_seq_39.284.1066483791\n \nSQL&gt;\n<\/pre><\/div>\n\n\n<p>Criando um novo archive no primary:<\/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 dbs]$ sqlplus \/ as sysdba\n \nSQL*Plus: Release 19.0.0.0.0 - Production on Sat Mar 6 14:00:25 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; ALTER SYSTEM SWITCH LOGFILE;\n \nSystem altered.\n \nSQL&gt;\n<\/pre><\/div>\n\n\n<p>Validando se o standby recebeu a nova sequence:<\/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; SET LIN 300\nCOL FILENAME FORMAT A40\nSELECT SEQUENCE#, APPLIED, FIRST_TIME, NEXT_TIME, replace( NAME ,&#039;DG_RECO\/CORTEXDR\/ARCHIVELOG\/2021_03_06\/&#039;,&#039;&#039;) FILENAME FROM V$ARCHIVED_LOG ORDER BY SEQUENCE#;SQL&gt; SQL&gt;\n \n SEQUENCE# APPLIED   FIRST_TIME          NEXT_TIME           FILENAME\n---------- --------- ------------------- ------------------- ----------------------------------------\n        36 YES       2021-03-06:11:56:00 2021-03-06:12:24:19 +thread_1_seq_36.281.1066480013\n        37 YES       2021-03-06:12:24:19 2021-03-06:12:54:19 +thread_1_seq_37.282.1066481661\n        38 YES       2021-03-06:12:54:19 2021-03-06:12:59:52 +thread_1_seq_38.283.1066481993\n        39 YES       2021-03-06:12:59:52 2021-03-06:13:29:50 +thread_1_seq_39.284.1066483791\n        40 YES       2021-03-06:13:29:50 2021-03-06:13:59:49 +thread_1_seq_40.285.1066485589\n        41 IN-MEMORY 2021-03-06:13:59:49 2021-03-06:14:00:32 +thread_1_seq_41.286.1066485633\n \n6 rows selected.\n<\/pre><\/div>\n\n\n<p>Outra maneira de monitorar a condi\u00e7\u00e3o do ambiente \u00e9 a consulta abaixo (feita no standby):<\/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 PROCESS, STATUS, THREAD#, SEQUENCE#, BLOCK#, BLOCKS FROM V$MANAGED_STANDBY;\n \nPROCESS   STATUS          THREAD#  SEQUENCE#     BLOCK#     BLOCKS\n--------- ------------ ---------- ---------- ---------- ----------\nARCH      CONNECTED             0          0          0          0\nDGRD      ALLOCATED             0          0          0          0\nDGRD      ALLOCATED             0          0          0          0\nARCH      CLOSING               1         40       2048         16\nARCH      CLOSING               1         39       8192       1816\nARCH      CLOSING               1         41          1         45\nRFS       IDLE                  1          0          0          0\nRFS       IDLE                  1         42       6922          1\nRFS       IDLE                  0          0          0          0\nMRP0      APPLYING_LOG          1         42       6922     409600\n \n10 rows selected.\n<\/pre><\/div>\n\n\n<p>Ap\u00f3s ver que a comunica\u00e7\u00e3o entre os ambientes est\u00e1 coesa, podemos configurar a pol\u00edtica de archives no RMAN (tanto primary quanto standby):<\/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 dbs]$ rman target \/\n \nRecovery Manager: Release 19.0.0.0.0 - Production on Sat Mar 6 14:06:20 2021\nVersion 19.3.0.0.0\n \nCopyright (c) 1982, 2019, Oracle and\/or its affiliates.  All rights reserved.\n \nconnected to target database: CORTEX (DBID=548968087)\n \nRMAN&gt; CONFIGURE ARCHIVELOG DELETION POLICY TO APPLIED ON ALL STANDBY;\n \nusing target database control file instead of recovery catalog\nnew RMAN configuration parameters:\nCONFIGURE ARCHIVELOG DELETION POLICY TO APPLIED ON ALL STANDBY;\nnew RMAN configuration parameters are successfully stored\n \nRMAN&gt;\n<\/pre><\/div>\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 dbs]$ rman target \/\n \nRecovery Manager: Release 19.0.0.0.0 - Production on Sat Mar 6 14:07:52 2021\nVersion 19.3.0.0.0\n \nCopyright (c) 1982, 2019, Oracle and\/or its affiliates.  All rights reserved.\n \nconnected to target database: CORTEX (DBID=548968087, not open)\n \nRMAN&gt; CONFIGURE ARCHIVELOG DELETION POLICY TO APPLIED ON ALL STANDBY;\n \nusing target database control file instead of recovery catalog\nold RMAN configuration parameters:\nCONFIGURE ARCHIVELOG DELETION POLICY TO APPLIED ON ALL STANDBY;\nnew RMAN configuration parameters:\nCONFIGURE ARCHIVELOG DELETION POLICY TO APPLIED ON ALL STANDBY;\nnew RMAN configuration parameters are successfully stored\n \nRMAN&gt;\n<\/pre><\/div>\n\n\n<p>De forma opcional, podemos habilitar o recurso de Flashback no Standby tamb\u00e9m:<\/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 dbs]$ sqlplus \/ as sysdba\n \nSQL*Plus: Release 19.0.0.0.0 - Production on Sat Mar 6 14:09:43 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 LOG_MODE,FLASHBACK_ON FROM V$DATABASE;\n \nLOG_MODE     FLASHBACK_ON\n------------ ------------------\nARCHIVELOG   NO\n \nSQL&gt; ALTER SYSTEM SET DB_FLASHBACK_RETENTION_TARGET =2880;\n \nSystem altered.\n \nSQL&gt; ALTER DATABASE RECOVER MANAGED STANDBY DATABASE CANCEL;\n \nDatabase altered.\n \nSQL&gt; ALTER DATABASE FLASHBACK ON;\n \nDatabase altered.\n \nSQL&gt;\n<\/pre><\/div>\n\n\n<p>Por \u00faltimo, podemos incluir o standby no Oracle Restart (se atentar que o startupoption precisa estar em MOUNT):<\/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 dbs]$ sqlplus \/ as sysdba\n \nSQL*Plus: Release 19.0.0.0.0 - Production on Sat Mar 6 14:13:15 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; shu immediate;\nORA-01109: database not open\n \n \nDatabase dismounted.\nORACLE instance shut down.\nSQL&gt; exit\nDisconnected from Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production\nVersion 19.3.0.0.0\n&#x5B;oracle@fornix2 dbs]$ srvctl add database -db CORTEXDR -instance CORTEXDR -oraclehome \/oracle\/19.3.0\/product -startoption MOUNT -stopoption IMMEDIATE -policy AUTOMATIC -role physical_standby -spfile \/oracle\/19.3.0\/product\/dbs\/spfileCORTEXDR.ora\n&#x5B;oracle@fornix2 dbs]$ srvctl start database -d CORTEXDR\n&#x5B;oracle@fornix2 dbs]$ srvctl status database -d CORTEXDR\nDatabase is running.\n&#x5B;oracle@fornix2 dbs]$\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>Ajustando o bash_profile do ambiente Standby: Criando diret\u00f3rios dentro do ASM (diskgroup de dados): Criando um arquivo pfile com o usu\u00e1rio oracle, utilizando apenas o par\u00e2metro DB_NAME: Logando no ambiente primary, e copiando o password file para o ambiente standby: Configurando o arquivo tnsnames.ora do standby usando como refer\u00eancia o do primary: Checando se 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-2400","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\/2400","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=2400"}],"version-history":[{"count":1,"href":"https:\/\/swiv.com.br\/index.php\/wp-json\/wp\/v2\/posts\/2400\/revisions"}],"predecessor-version":[{"id":9247,"href":"https:\/\/swiv.com.br\/index.php\/wp-json\/wp\/v2\/posts\/2400\/revisions\/9247"}],"wp:attachment":[{"href":"https:\/\/swiv.com.br\/index.php\/wp-json\/wp\/v2\/media?parent=2400"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/swiv.com.br\/index.php\/wp-json\/wp\/v2\/categories?post=2400"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/swiv.com.br\/index.php\/wp-json\/wp\/v2\/tags?post=2400"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}