{"id":5637,"date":"2021-06-29T08:08:42","date_gmt":"2021-06-29T08:08:42","guid":{"rendered":"https:\/\/swiv.com.br\/taking-backup-in-primary-and-standby-databases-using-rman\/"},"modified":"2026-05-27T20:02:31","modified_gmt":"2026-05-27T19:02:31","slug":"taking-backup-in-primary-and-standby-databases-using-rman","status":"publish","type":"post","link":"https:\/\/swiv.com.br\/index.php\/2021\/06\/29\/taking-backup-in-primary-and-standby-databases-using-rman\/","title":{"rendered":"Taking Backup in Primary and Standby Databases using RMAN"},"content":{"rendered":"\n<p>Vamos simular a execu\u00e7\u00e3o de backup de tablespace em um ambiente Data Guard, tanto do Primary quanto do seu Standby Database.<\/p>\n\n\n\n<p>Validando configura\u00e7\u00e3o do Data Guard:<\/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 as sysdba\nDGMGRL for Linux: Release 19.0.0.0.0 - Production on Tue Jun 29 04:48:52 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 46 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;\n<\/pre><\/div>\n\n\n<p>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 ~]$ dgmgrl sys\/oracle@CORTEXDR as sysdba\nDGMGRL for Linux: Release 19.0.0.0.0 - Production on Tue Jun 29 04:49:26 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 DATABASE CORTEXDR;\n \nDatabase - cortexdr\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: 19.00 KByte\/s\n  Real Time Query:    ON\n  Instance(s):\n    CORTEXDR\n \nDatabase Status:\nSUCCESS\n \nDGMGRL&gt;\n<\/pre><\/div>\n\n\n<p>No ambiente que abriga o banco Primary, vou criar um diret\u00f3rio novo para o backup da tablespace:<\/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 oracle]$ cd \/oracle\/\n&#x5B;oracle@fornix1 oracle]$ mkdir BACKUP\n&#x5B;oracle@fornix1 oracle]$ cd BACKUP\/\n&#x5B;oracle@fornix1 BACKUP]$ pwd\n\/oracle\/BACKUP\n&#x5B;oracle@fornix1 BACKUP]$\n<\/pre><\/div>\n\n\n<p>Realizando backup da tablespace USERS do banco Primary (CORTEX):<\/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 BACKUP]$ rman target sys\/oracle@CORTEX CATALOG CAT\/CAT@CORTEX\n \nRecovery Manager: Release 19.0.0.0.0 - Production on Tue Jun 29 04:52:02 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 recovery catalog database\n \nRMAN&gt; BACKUP TABLESPACE USERS FORMAT &#039;\/oracle\/BACKUP\/users.bak&#039;;\n \nStarting backup at 29-JUN-21\nallocated channel: ORA_DISK_1\nchannel ORA_DISK_1: SID=99 device type=DISK\nchannel ORA_DISK_1: starting full datafile backup set\nchannel ORA_DISK_1: specifying datafile(s) in backup set\ninput datafile file number=00007 name=+DG_DATA\/CORTEX\/DATAFILE\/users.259.1039033555\nchannel ORA_DISK_1: starting piece 1 at 29-JUN-21\nchannel ORA_DISK_1: finished piece 1 at 29-JUN-21\npiece handle=\/oracle\/BACKUP\/users.bak tag=TAG20210629T045255 comment=NONE\nchannel ORA_DISK_1: backup set complete, elapsed time: 00:00:03\nFinished backup at 29-JUN-21\n \nStarting Control File and SPFILE Autobackup at 29-JUN-21\npiece handle=+DG_FRA\/CORTEX\/AUTOBACKUP\/2021_06_29\/s_1076475179.272.1076475181 comment=NONE\nFinished Control File and SPFILE Autobackup at 29-JUN-21\n \nRMAN&gt;\n<\/pre><\/div>\n\n\n<p>Realizando o mesmo processo no banco 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 ~]$ cd \/oracle\/\n&#x5B;oracle@fornix2 oracle]$ mkdir BACKUP\n&#x5B;oracle@fornix2 oracle]$ cd BACKUP\/\n&#x5B;oracle@fornix2 BACKUP]$ pwd\n\/oracle\/BACKUP\n&#x5B;oracle@fornix2 BACKUP]$\n<\/pre><\/div>\n\n\n<p>Backup:<\/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 BACKUP]$ rman target sys\/oracle@CORTEXDR catalog CAT\/CAT@CORTEX\n \nRecovery Manager: Release 19.0.0.0.0 - Production on Tue Jun 29 04:54:24 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 recovery catalog database\n \nRMAN&gt; BACKUP TABLESPACE USERS FORMAT &#039;\/oracle\/BACKUP\/users2.bak&#039;;\n \nStarting backup at 29-JUN-21\nallocated channel: ORA_DISK_1\nchannel ORA_DISK_1: SID=86 device type=DISK\nchannel ORA_DISK_1: starting full datafile backup set\nchannel ORA_DISK_1: specifying datafile(s) in backup set\ninput datafile file number=00007 name=+DG_DATA\/CORTEXDR\/DATAFILE\/users.260.1066479853\nchannel ORA_DISK_1: starting piece 1 at 29-JUN-21\nchannel ORA_DISK_1: finished piece 1 at 29-JUN-21\npiece handle=\/oracle\/BACKUP\/users2.bak tag=TAG20210629T045446 comment=NONE\nchannel ORA_DISK_1: backup set complete, elapsed time: 00:00:03\nFinished backup at 29-JUN-21\n \nStarting Control File and SPFILE Autobackup at 29-JUN-21\npiece handle=+DG_FRA\/CORTEXDR\/AUTOBACKUP\/2021_06_29\/s_1076475239.275.1076475293 comment=NONE\nFinished Control File and SPFILE Autobackup at 29-JUN-21\n \nRMAN&gt;\n<\/pre><\/div>\n\n<p>Utilizando as strings\/alias criados <a href=\"https:\/\/swiv.com.br\/creating-a-rman-recovery-catalog-and-registering-the-primary-and-standby-database\/\" target=\"\\&quot;_blank\\&quot;\" rel=\"\\&quot;noreferrer noopener\" noopener=\"\">NESTE<\/a> artigo, podemos ver a diferen\u00e7a (do datafile name) exibido tanto no primary quanto standby pelo comando LIST:<\/p>\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 BACKUP]$ rman target sys\/oracle@CORTEX CATALOG CAT\/CAT@CORTEX\n \nRecovery Manager: Release 19.0.0.0.0 - Production on Tue Jun 29 05:01:15 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 recovery catalog database\n \nRMAN&gt; LIST BACKUP OF TABLESPACE USERS for DB_UNIQUE_NAME CORTEX;\n \nList of Backup Set for database with db_unique_name CORTEX\n===================\n \n \nBS Key  Type LV Size       Device Type Elapsed Time Completion Time\n------- ---- -- ---------- ----------- ------------ ---------------\n260     Full    8.36M      DISK        00:00:01     29-JUN-21\n        BP Key: 263   Status: AVAILABLE  Compressed: NO  Tag: TAG20210629T045255\n        Piece Name: \/oracle\/BACKUP\/users.bak\n  List of Datafiles in backup set 260\n  File LV Type Ckp SCN    Ckp Time  Abs Fuz SCN Sparse Name\n  ---- -- ---- ---------- --------- ----------- ------ ----\n  7       Full 6336017    29-JUN-21              NO    +DG_DATA\/CORTEX\/DATAFILE\/users.259.1039033555\n \nRMAN&gt; LIST BACKUP OF TABLESPACE USERS for DB_UNIQUE_NAME CORTEXDR;\n \nList of Backup Set for database with db_unique_name CORTEXDR\n===================\n \n \nBS Key  Type LV Size       Device Type Elapsed Time Completion Time\n------- ---- -- ---------- ----------- ------------ ---------------\n280     Full    8.62M      DISK        00:00:01     29-JUN-21\n        BP Key: 283   Status: AVAILABLE  Compressed: NO  Tag: TAG20210629T045446\n        Piece Name: \/oracle\/BACKUP\/users2.bak\n  List of Datafiles in backup set 280\n  File LV Type Ckp SCN    Ckp Time  Abs Fuz SCN Sparse Name\n  ---- -- ---- ---------- --------- ----------- ------ ----\n  7       Full 6218684    14-JUN-21 6336125      NO    +DG_DATA\/CORTEX\/DATAFILE\/users.259.1039033555\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 BACKUP]$ rman target sys\/oracle@CORTEXDR catalog CAT\/CAT@CORTEX\n \nRecovery Manager: Release 19.0.0.0.0 - Production on Tue Jun 29 05:02:01 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 recovery catalog database\n \nRMAN&gt; LIST BACKUP OF TABLESPACE USERS for DB_UNIQUE_NAME CORTEX;\n \nList of Backup Set for database with db_unique_name CORTEX\n===================\n \n \nBS Key  Type LV Size       Device Type Elapsed Time Completion Time\n------- ---- -- ---------- ----------- ------------ ---------------\n260     Full    8.36M      DISK        00:00:01     29-JUN-21\n        BP Key: 263   Status: AVAILABLE  Compressed: NO  Tag: TAG20210629T045255\n        Piece Name: \/oracle\/BACKUP\/users.bak\n  List of Datafiles in backup set 260\n  File LV Type Ckp SCN    Ckp Time  Abs Fuz SCN Sparse Name\n  ---- -- ---- ---------- --------- ----------- ------ ----\n  7       Full 6336017    29-JUN-21              NO    +DG_DATA\/CORTEXDR\/DATAFILE\/users.260.1066479853\n \nRMAN&gt; LIST BACKUP OF TABLESPACE USERS for DB_UNIQUE_NAME CORTEXDR;\n \nList of Backup Set for database with db_unique_name CORTEXDR\n===================\n \n \nBS Key  Type LV Size       Device Type Elapsed Time Completion Time\n------- ---- -- ---------- ----------- ------------ ---------------\n280     Full    8.62M      DISK        00:00:01     29-JUN-21\n        BP Key: 283   Status: AVAILABLE  Compressed: NO  Tag: TAG20210629T045446\n        Piece Name: \/oracle\/BACKUP\/users2.bak\n  List of Datafiles in backup set 280\n  File LV Type Ckp SCN    Ckp Time  Abs Fuz SCN Sparse Name\n  ---- -- ---- ---------- --------- ----------- ------ ----\n  7       Full 6218684    14-JUN-21 6336125      NO    +DG_DATA\/CORTEXDR\/DATAFILE\/users.260.1066479853\n \nRMAN&gt;\n<\/pre><\/div>\n\n\n<p>Usando o REPORT SCHEMA, podemos ver a j\u00e1 esperada diferen\u00e7a do nome dos datafiles:<\/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 BACKUP]$ rman target sys\/oracle@CORTEX CATALOG CAT\/CAT@CORTEX\n \nRecovery Manager: Release 19.0.0.0.0 - Production on Tue Jun 29 05:03:01 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 recovery catalog database\n \nRMAN&gt; report schema for DB_UNIQUE_NAME CORTEX;\n \nReport of database schema for database with db_unique_name CORTEX\n \nList of Permanent Datafiles\n===========================\nFile Size(MB) Tablespace           RB segs Datafile Name\n---- -------- -------------------- ------- ------------------------\n1    920      SYSTEM               YES     +DG_DATA\/CORTEX\/DATAFILE\/system.256.1039033445\n3    610      SYSAUX               NO      +DG_DATA\/CORTEX\/DATAFILE\/sysaux.257.1039033519\n4    340      UNDOTBS1             YES     +DG_DATA\/CORTEX\/DATAFILE\/undotbs1.258.1039033555\n5    888      SOE                  NO      +DG_DATA\/CORTEX\/DATAFILE\/soe.266.1065506205\n7    12       USERS                NO      +DG_DATA\/CORTEX\/DATAFILE\/users.259.1039033555\n \nList of Temporary Files\n=======================\nFile Size(MB) Tablespace           Maxsize(MB) Tempfile Name\n---- -------- -------------------- ----------- --------------------\n1    32       TEMP                 32767       +DG_DATA\/CORTEX\/TEMPFILE\/temp.264.1039033669\n \nRMAN&gt; report schema for DB_UNIQUE_NAME CORTEXDR;\n \nReport of database schema for database with db_unique_name CORTEXDR\n \nList of Permanent Datafiles\n===========================\nFile Size(MB) Tablespace           RB segs Datafile Name\n---- -------- -------------------- ------- ------------------------\n1    920      SYSTEM               YES     +DG_DATA\/CORTEXDR\/DATAFILE\/system.259.1066479769\n3    610      SYSAUX               NO      +DG_DATA\/CORTEXDR\/DATAFILE\/sysaux.257.1066479825\n4    340      UNDOTBS1             YES     +DG_DATA\/CORTEXDR\/DATAFILE\/undotbs1.256.1066479825\n5    888      SOE                  NO      +DG_DATA\/CORTEXDR\/DATAFILE\/soe.258.1066479771\n7    12       USERS                NO      +DG_DATA\/CORTEXDR\/DATAFILE\/users.260.1066479853\n \nList of Temporary Files\n=======================\nFile Size(MB) Tablespace           Maxsize(MB) Tempfile Name\n---- -------- -------------------- ----------- --------------------\n1    32       TEMP                 32767       +DG_DATA\/CORTEXDR\/TEMPFILE\/temp.268.1074148127\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 BACKUP]$ rman target sys\/oracle@CORTEXDR catalog CAT\/CAT@CORTEX\n \nRecovery Manager: Release 19.0.0.0.0 - Production on Tue Jun 29 05:03:31 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 recovery catalog database\n \nRMAN&gt; report schema for DB_UNIQUE_NAME CORTEX;\n \nReport of database schema for database with db_unique_name CORTEX\n \nList of Permanent Datafiles\n===========================\nFile Size(MB) Tablespace           RB segs Datafile Name\n---- -------- -------------------- ------- ------------------------\n1    920      SYSTEM               YES     +DG_DATA\/CORTEX\/DATAFILE\/system.256.1039033445\n3    610      SYSAUX               NO      +DG_DATA\/CORTEX\/DATAFILE\/sysaux.257.1039033519\n4    340      UNDOTBS1             YES     +DG_DATA\/CORTEX\/DATAFILE\/undotbs1.258.1039033555\n5    888      SOE                  NO      +DG_DATA\/CORTEX\/DATAFILE\/soe.266.1065506205\n7    12       USERS                NO      +DG_DATA\/CORTEX\/DATAFILE\/users.259.1039033555\n \nList of Temporary Files\n=======================\nFile Size(MB) Tablespace           Maxsize(MB) Tempfile Name\n---- -------- -------------------- ----------- --------------------\n1    32       TEMP                 32767       +DG_DATA\/CORTEX\/TEMPFILE\/temp.264.1039033669\n \nRMAN&gt; report schema for DB_UNIQUE_NAME CORTEXDR;\n \nReport of database schema for database with db_unique_name CORTEXDR\n \nList of Permanent Datafiles\n===========================\nFile Size(MB) Tablespace           RB segs Datafile Name\n---- -------- -------------------- ------- ------------------------\n1    920      SYSTEM               YES     +DG_DATA\/CORTEXDR\/DATAFILE\/system.259.1066479769\n3    610      SYSAUX               NO      +DG_DATA\/CORTEXDR\/DATAFILE\/sysaux.257.1066479825\n4    340      UNDOTBS1             YES     +DG_DATA\/CORTEXDR\/DATAFILE\/undotbs1.256.1066479825\n5    888      SOE                  NO      +DG_DATA\/CORTEXDR\/DATAFILE\/soe.258.1066479771\n7    12       USERS                NO      +DG_DATA\/CORTEXDR\/DATAFILE\/users.260.1066479853\n \nList of Temporary Files\n=======================\nFile Size(MB) Tablespace           Maxsize(MB) Tempfile Name\n---- -------- -------------------- ----------- --------------------\n1    32       TEMP                 32767       +DG_DATA\/CORTEXDR\/TEMPFILE\/temp.268.1074148127\n \nRMAN&gt;\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>Vamos simular a execu\u00e7\u00e3o de backup de tablespace em um ambiente Data Guard, tanto do Primary quanto do seu Standby Database. Validando configura\u00e7\u00e3o do Data Guard: Standby: No ambiente que abriga o banco Primary, vou criar um diret\u00f3rio novo para o backup da tablespace: Realizando backup da tablespace USERS do banco Primary (CORTEX): Realizando 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":[3,5],"tags":[],"class_list":["post-5637","post","type-post","status-publish","format-standard","hentry","category-backup-recovery","category-high-availability"],"_links":{"self":[{"href":"https:\/\/swiv.com.br\/index.php\/wp-json\/wp\/v2\/posts\/5637","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=5637"}],"version-history":[{"count":1,"href":"https:\/\/swiv.com.br\/index.php\/wp-json\/wp\/v2\/posts\/5637\/revisions"}],"predecessor-version":[{"id":9090,"href":"https:\/\/swiv.com.br\/index.php\/wp-json\/wp\/v2\/posts\/5637\/revisions\/9090"}],"wp:attachment":[{"href":"https:\/\/swiv.com.br\/index.php\/wp-json\/wp\/v2\/media?parent=5637"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/swiv.com.br\/index.php\/wp-json\/wp\/v2\/categories?post=5637"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/swiv.com.br\/index.php\/wp-json\/wp\/v2\/tags?post=5637"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}