Esse post apresenta o passo a passo para realização de um duplicate via RMAN, utilizando o backup automático da OCI de um banco de dados hospeado em DB System ou Exadata Cloud Service (ExaCS). O servidor de destino pode ser de qualquer tipo, como uma VM em IaaS nativo na OCI, outro Cloud Provider ou até mesmo para um servidor OnPremise.

Para esse procedimento, usaremos a abordagem de “RMAN Backup-based duplication with a target connection”, o qual assume que o servidor de destino pode se conectar no banco de origem na porta 1521 (ou outra porta configurada no listener).

Resumo das etapas:

  • 1) Copiar a Wallet de TDE da origem para destino
  • 2) Copiar os arquivos de configuração do Cloud Backup Module da origem para o destino
  • 3) Criar os diretórios no servidor de destino para armazenar a Wallet de TDE e os arquivos de configuração do Cloud Backup Module;
  • 4) Configurar e iniciar a instância auxiliar (pwfile, pfile, sqlnet.ora)
  • 5) Iniciar RMAN Duplicate com conexão para o “Target” Database (origem do duplicate)

Note que essa abordagem de duplicate conecta no banco de dados de origem apenas para consultar as informações do controlfile, tais como backup dos datafiles e archivelogs, assim como a configuração dos canais do tipo SBT_TAPE, mas o duplicate em si é realizado através de restore e recovery do backup armazenado no ObjectStorage da OCI.

1) Copiar a TDE Wallet da Origem para o Destino

1.1) No DB System, identifique a localização da Wallet:

[oracle@dbcs1 ~]$ sqlplus / as sysdba

SQL> SELECT WRL_PARAMETER FROM V$ENCRYPTION_WALLET;

WRL_PARAMETER
--------------------------------------------------------------------------------
/opt/oracle/dcs/commonstore/wallets/tde/ORCL_gru1ns/

1.2) Compactando os arquivos para cópia:

[oracle@dbcs1 ~]$ cd /opt/oracle/dcs/commonstore/wallets/tde/ORCL_gru1ns/
[oracle@dbcs1 ORCL_gru1ns]$ zip -r /tmp/wallet_tde.zip *

1.3) Copiando o arquivo wallet_tde.zip para o servidor de destino.

Neste exemplo, não tenho conexão ssh direta entre os dois servidores de origem e destino, então preciso de uma máquina ponte:

maicon@desktop:~$ scp opc@dbcs1:/tmp/wallet_tde.zip /tmp
maicon@desktop:~$ scp /tmp/wallet_tde.zip  oracle@lab04:/tmp

2) Copiar Arquivos de Configuração do Oracle Database Cloud Backup Module

2.1) No DB System, acesse o RMAN e liste as configurações padrão:

[oracle@dbcs1 ~]$ rman target /

Recovery Manager: Release 19.0.0.0.0 - Production on Tue Apr 26 20:19:32 2022
Version 19.14.0.0.0

Copyright (c) 1982, 2019, Oracle and/or its affiliates.  All rights reserved.

connected to target database: ORCL (DBID=1630800863)

RMAN> show all;

using target database control file instead of recovery catalog
RMAN configuration parameters for database with db_unique_name ORCL_GRU1NS are:
CONFIGURE RETENTION POLICY TO RECOVERY WINDOW OF 30 DAYS;
CONFIGURE BACKUP OPTIMIZATION OFF;
CONFIGURE DEFAULT DEVICE TYPE TO DISK; # default
CONFIGURE CONTROLFILE AUTOBACKUP ON;
CONFIGURE CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE DISK TO '%F'; # default
CONFIGURE CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE SBT_TAPE TO '%F'; # default
CONFIGURE DEVICE TYPE DISK BACKUP TYPE TO BACKUPSET PARALLELISM 1;
CONFIGURE DEVICE TYPE 'SBT_TAPE' PARALLELISM 2 BACKUP TYPE TO COMPRESSED BACKUPSET;
CONFIGURE DATAFILE BACKUP COPIES FOR DEVICE TYPE DISK TO 1; # default
CONFIGURE DATAFILE BACKUP COPIES FOR DEVICE TYPE SBT_TAPE TO 1; # default
CONFIGURE ARCHIVELOG BACKUP COPIES FOR DEVICE TYPE DISK TO 1; # default
CONFIGURE ARCHIVELOG BACKUP COPIES FOR DEVICE TYPE SBT_TAPE TO 1; # default
CONFIGURE CHANNEL DEVICE TYPE 'SBT_TAPE' FORMAT   '%d_%I_%U_%T_%t' PARMS  'SBT_LIBRARY=/opt/oracle/dcs/commonstore/oss/ORCL_gru1ns/libopc.so ENV=(OPC_PFILE=/opt/oracle/dcs/commonstore/oss/ORCL_gru1ns/2ed2b349-8b9c-4767-84b5-96894f2dd4ca/opc_ORCL_gru1ns.ora)';
CONFIGURE MAXSETSIZE TO UNLIMITED; # default
CONFIGURE ENCRYPTION FOR DATABASE ON;
CONFIGURE ENCRYPTION ALGORITHM 'AES256';
CONFIGURE COMPRESSION ALGORITHM 'LOW' AS OF RELEASE 'DEFAULT' OPTIMIZE FOR LOAD TRUE;
CONFIGURE RMAN OUTPUT TO KEEP FOR 7 DAYS; # default
CONFIGURE ARCHIVELOG DELETION POLICY TO BACKED UP 1 TIMES TO 'SBT_TAPE';
CONFIGURE SNAPSHOT CONTROLFILE NAME TO '+RECO/ORCL_GRU1NS/controlfile/snapcf_orcl_gru1ns.f';

RMAN>

O objetivo é identificar a configuração padrão do canal SBT_TAPE:

CONFIGURE CHANNEL DEVICE TYPE 'SBT_TAPE' FORMAT   '%d_%I_%U_%T_%t' PARMS  'SBT_LIBRARY=/opt/oracle/dcs/commonstore/oss/ORCL_gru1ns/libopc.so ENV=(OPC_PFILE=/opt/oracle/dcs/commonstore/oss/ORCL_gru1ns/2ed2b349-8b9c-4767-84b5-96894f2dd4ca/opc_ORCL_gru1ns.ora)';

O atributo SBT_LIBRARY indica o caminho do Cloud Backup Module e o atributo OPC_PFILE indica a localização dos arquivos de configuração do backup automático da OCI. Por padrão o OPC_PFILE estará localizado no mesmo diretório que SBT_LIBRARY, então podemos copiar todos de uma vez.

2.2) Compactando os arquivos do Cloud Backup Module:

[oracle@dbcs1 ~]$ cd /opt/oracle/dcs/commonstore/oss/ORCL_gru1ns/
[oracle@dbcs1 ORCL_gru1ns]$ zip -r /tmp/bkp_module.zip *

2.3) Copiando arquivos do módulo de backup para o servidor de destino:

maicon@desktop:~$ scp opc@dbcs1:/tmp/bkp_module.zip /tmp
maicon@desktop:~$ scp /tmp/bkp_module.zip  oracle@lab04:/tmp

3) Criar Diretórios no Servidor de Destino para Wallet e Cloud Backup Módule

A partir desta etapa, todos os comandos são executados no servidor de destino, que neste exemplo é uma VM em um laboratório local (OnPremise) com Oracle Linux 7 e Oracle Database 19c previamente instalados.

3.1) Opcionalmente, crie um arquivo de variáveis de ambiente que serão usadas na instância auxiliar, note a presença da variável ORACLE_UNQNAME, que deve apontar para o DB Unique Name do banco a ser criado e será utilizada na identificação da Wallet TDE.

[oracle@lab04 ~]$ cat TEST.env
function addpath {

  [[ ":${PATH}:" =~ :$1: ]] && return
  PATH="$PATH:$1"
}
export NLS_DATE_FORMAT='DD/MM/YYYY HH24:MI:SS'
export ORACLE_BASE=/u01/app/oracle
export ORACLE_HOME=/u01/app/oracle/product/19.12.0.0/db_1
export ORACLE_UNQNAME=TEST
export ORACLE_SID=TEST
# If binary locations do not already exist in
# $PATH add them to the end without duplicates...
addpath ${ORACLE_HOME%/}/bin
addpath ${ORACLE_HOME%/}/OPatch

3.2) Criando diretório da Wallet:

[oracle@lab04 ~]$ mkdir -p /u01/app/oracle/admin/tde/wallet/$ORACLE_UNQNAME
[oracle@lab04 ~]$ unzip /tmp/wallet_tde.zip -d /u01/app/oracle/admin/tde/wallet/$ORACLE_UNQNAME

3.3) Criando diretório do Oracle Database Cloud Backup Module:

[oracle@lab04 ~]$ mkdir -p /u01/app/oracle/admin/opc_backup_module
[oracle@lab04 ~]$ unzip /tmp/bkp_module.zip -d /u01/app/oracle/admin/opc_backup_module

Nesta etapa poderia ser criado uma estrutura de diretórios para o Cloud Backup Module com a mesma estrutura existente no ambiente de origem, dispensando a necessidade de alterar qualquer configuração. No entanto, como pode haver restrições de segurança no ambiente de destino, essa demonstração apresenta como usar uma estrutura de diretórios diferente no destino, dispensando uma eventual necessidade de acesso root para criar diretórios na raiz do sistema operacional.

3.4) Edite o arquivo opc_<DB UNIQUE NAME>.ora e altere o diretório da wallet do backup (atributo OPC_WALLET). Esse atributo deve ser ajustado para refletir ao ambiente atual, como exemplo a seguir:

Versão original com configuração do DB System (antes de editar):

Versão alterada, refletindo o novo ambiente:

3.5) Crie ou edite o arquivo sqlnet.ora no DB Home para indicar o caminho da wallet TDE:

Exemplo:

[oracle@lab04 ~]$ cat $ORACLE_HOME/network/admin/sqlnet.ora
ENCRYPTION_WALLET_LOCATION=(SOURCE=(METHOD=FILE)(METHOD_DATA=(DIRECTORY=/u01/app/oracle/admin/tde/wallet/$ORACLE_UNQNAME)))

Note que se o servidor de destino possui apenas um banco de dados, não é necessário usar uma variável de ambiente nessa configuração, mas esse padrão pode ser útil caso seja necessário subir outra instância no mesmo servidor futuramente.

4) Criar e Configurar Instância Auxiliar

4.1) Crie o PFILE (Parameter File) da instância auxiliar com os parâmetros que refletem a realidade do ambiente de destino.

PFILE utilizado neste exemplo:

[oracle@lab04 ~]$ cat $ORACLE_HOME/dbs/initTEST.ora
*.audit_file_dest='/u01/app/oracle/admin/TEST/adump'
*.audit_trail='db'
*.compatible='19.0.0'
*.control_files='+DATA/TEST/control01.ctl','+RECO/TEST/control02.ctl'
*.db_block_size=8192
*.db_name='TEST'
*.diagnostic_dest='/u01/app/oracle'
*.enable_pluggable_database=true
*.filesystemio_options='setall'
*.nls_language='AMERICAN'
*.nls_territory='AMERICA'
*.open_cursors=300
*.pga_aggregate_target=766m
*.processes=320
*.remote_login_passwordfile='EXCLUSIVE'
*.sga_target=1024m
*.undo_tablespace='UNDOTBS1'
*.db_create_file_dest='+DATA'
*.db_recovery_file_dest_size=8g
*.db_recovery_file_dest='+RECO'

4.2) Criando diretórios no Filesystem para a nova instância chamada TEST:

[oracle@lab04 ~]$ mkdir -p /u01/app/oracle/admin/TEST/adump

4.3) Criando diretórios no ASM antecipadamente para restore do controlfile:

[grid@lab04 ~]$ asmcmd -p
ASMCMD [+] &gt;
ASMCMD [+] &gt; mkdir +DATA/TEST/
ASMCMD [+] &gt; mkdir +RECO/TEST/

4.4) Iniciando a instância auxiliar em NOMOUNT:

[oracle@lab04 ~]$ sqlplus / as sysdba

SQL&gt; startup nomount;
ORACLE instance started.

Total System Global Area 1073738520 bytes
Fixed Size                  9143064 bytes
Variable Size             276824064 bytes
Database Buffers          780140544 bytes
Redo Buffers                7630848 bytes
SQL&gt;

4.5) Crie uma entrada tnsnames para o banco de origem (usado como Target Database no RMAN).

No exemplo abaixo, o alias TEST refere-se a instância local, enquanto ORCL_DBCS referente ao banco no DB System OCI:

[oracle@lab04 ~]$ cat $ORACLE_HOME/network/admin/tnsnames.ora
TEST =
  (DESCRIPTION =
    (ADDRESS = (PROTOCOL = TCP)(HOST = lab04.dibiei.com)(PORT = 1521))
    (CONNECT_DATA =
      (SERVER = DEDICATED)
      (SERVICE_NAME = TEST)
    )
  )

ORCL_DBCS =
  (DESCRIPTION =
    (ADDRESS = (PROTOCOL = TCP)(HOST = dbcs1.emdb.emcc.oraclevcn.com)(PORT = 1521))
    (CONNECT_DATA =
      (SERVER = DEDICATED)
      (SERVICE_NAME = ORCL_gru1ns.emdb.emcc.oraclevcn.com)
    )
  )

5) Iniciar Duplicate no RMAN

5.1) Conectando o RMAN nas duas instâncias:

[oracle@lab04 ~]$ rman

Recovery Manager: Release 19.0.0.0.0 - Production on Tue Apr 26 21:05:46 2022
Version 19.12.0.0.0

Copyright (c) 1982, 2019, Oracle and/or its affiliates.  All rights reserved.

RMAN&gt; connect target sys/SenhaDoSys@ORCL_DBCS

connected to target database: ORCL (DBID=1630800863)

RMAN&gt; connect auxiliary /

connected to auxiliary database: TEST (not mounted)

5.2) Listando os últimos backups dos archiveslogs realizados no banco “Target”, que nesse caso é o DB System na OCI:

RMAN&gt; list backup of archivelog all summary;

using target database control file instead of recovery catalog

List of Backups
===============
Key     TY LV S Device Type Completion Time     #Pieces #Copies Compressed Tag
------- -- -- - ----------- ------------------- ------- ------- ---------- ---
4       B  A  A SBT_TAPE    26/04/2022 11:18:39 1       1       YES        DBTREGULAR-L01650981353244WJN
5       B  A  A SBT_TAPE    26/04/2022 11:18:42 1       1       YES        DBTREGULAR-L01650981353244WJN
12      B  A  A SBT_TAPE    26/04/2022 11:19:48 1       1       YES        DBTREGULAR-L01650981353244WJN
17      B  A  A SBT_TAPE    26/04/2022 12:01:48 1       1       YES        AUTO_ARCHIVE
22      B  A  A SBT_TAPE    26/04/2022 13:01:46 1       1       YES        AUTO_ARCHIVE
27      B  A  A SBT_TAPE    26/04/2022 17:01:50 1       1       YES        AUTO_ARCHIVE
28      B  A  A SBT_TAPE    26/04/2022 17:01:50 1       1       YES        AUTO_ARCHIVE
33      B  A  A SBT_TAPE    26/04/2022 18:02:13 1       1       YES        AUTO_ARCHIVE
34      B  A  A SBT_TAPE    26/04/2022 18:02:13 1       1       YES        AUTO_ARCHIVE
39      B  A  A SBT_TAPE    26/04/2022 19:02:18 1       1       YES        AUTO_ARCHIVE
44      B  A  A SBT_TAPE    26/04/2022 20:01:46 1       1       YES        AUTO_ARCHIVE
49      B  A  A SBT_TAPE    26/04/2022 21:01:40 1       1       YES        AUTO_ARCHIVE

5.3) Identificando o SCN ou SEQUENCE# do último archivelog que foi para backup no ObjectStorage (backupset 49 na lista anterior):

RMAN&gt; list backupset 49;


List of Backup Sets
===================


BS Key  Size       Device Type Elapsed Time Completion Time
------- ---------- ----------- ------------ -------------------
49      1.75M      SBT_TAPE    00:00:04     26/04/2022 21:01:40
        BP Key: 49   Status: AVAILABLE  Compressed: YES  Tag: AUTO_ARCHIVE
        Handle: Auto_Archive_arc_ORCL_1630800863_1h0rul5g_49_1_1_20220426_1103058096_set49   Media: swiftobjectstorage.s..d.com/v1/gr12pjjsbpbv/bYll2iQWZnj1MnjuGdtM

  List of Archived Logs in backup set 49
  Thrd Seq     Low SCN    Low Time            Next SCN   Next Time
  ---- ------- ---------- ------------------- ---------- ---------
  1    13      2775654    26/04/2022 20:01:38 2778488    26/04/2022 21:01:33

Podemos usar o número da sequence ou o SCN no comando de duplicate, neste exemplo usarei o número do SCN.

5.4) Crie o script RMAN de DUPLICATE, alocando os canais do tipo SBT_TAPE.

Para adaptar o script de duplicate, a dica é copiar e configuração do canal no banco de origem e adaptar no ALLOCATE CHANNEL com o novo caminho do Backup Service Module.

Configuração original no DB System:

RMAN&gt; SHOW CHANNEL;

RMAN configuration parameters for database with db_unique_name ORCL_GRU1NS are:
CONFIGURE CHANNEL DEVICE TYPE 'SBT_TAPE' FORMAT   '%d_%I_%U_%T_%t' PARMS  'SBT_LIBRARY=/opt/oracle/dcs/commonstore/oss/ORCL_gru1ns/libopc.so ENV=(OPC_PFILE=/opt/oracle/dcs/commonstore/oss/ORCL_gru1ns/2ed2b349-8b9c-4767-84b5-96894f2dd4ca/opc_ORCL_gru1ns.ora)';

Script utilizado neste exemplo com a alocação dos canais SBT já adaptados:

run {
ALLOCATE AUXILIARY CHANNEL C1 DEVICE TYPE 'SBT_TAPE' FORMAT  '%d_%I_%U_%T_%t' 
PARMS  'SBT_LIBRARY=/u01/app/oracle/admin/opc_backup_module/libopc.so ENV=(OPC_PFILE=/u01/app/oracle/admin/opc_backup_module/2ed2b349-8b9c-4767-84b5-96894f2dd4ca/opc_ORCL_gru1ns.ora)';

ALLOCATE AUXILIARY CHANNEL C2 DEVICE TYPE 'SBT_TAPE' FORMAT  '%d_%I_%U_%T_%t' 
PARMS 'SBT_LIBRARY=/u01/app/oracle/admin/opc_backup_module/libopc.so ENV=(OPC_PFILE=/u01/app/oracle/admin/opc_backup_module/2ed2b349-8b9c-4767-84b5-96894f2dd4ca/opc_ORCL_gru1ns.ora)';

DUPLICATE TARGET DATABASE TO 'TEST' UNTIL SCN 2775654;
}

Observe que o ALLOCATE CHANNEL foi adaptado com o novo diretório:

Log de execução deste exemplo:

RMAN> run {
ALLOCATE AUXILIARY CHANNEL C1 DEVICE TYPE 'SBT_TAPE' FORMAT  '%d_%I_%U_%T_%t'
PARMS  'SBT_LIBRARY=/u01/app/oracle/admin/opc_backup_module/libopc.so ENV=(OPC_PFILE=/u01/app/oracle/admin/opc_backup_module/2ed2b349-8b9c-4767-84b5-96894f2dd4ca/opc_ORCL_gru1ns.ora)';

ALLOCATE AUXILIARY CHANNEL C2 DEVICE TYPE 'SBT_TAPE' FORMAT  '%d_%I_%U_%T_%t'
PARMS 'SBT_LIBRARY=/u01/app/oracle/admin/opc_backup_module/libopc.so ENV=(OPC_PFILE=/u01/app/oracle/admin/opc_backup_module/2ed2b349-8b9c-4767-84b5-96894f2dd4ca/opc_ORCL_gru1ns.ora)';

DUPLICATE TARGET DATABASE TO 'TEST' UNTIL SCN 2775654;
}2> 3> 4> 5> 6> 7> 8> 9>

using target database control file instead of recovery catalog
allocated channel: C1
channel C1: SID=271 device type=SBT_TAPE
channel C1: Oracle Database Backup Service Library VER=21.0.0.1

allocated channel: C2
channel C2: SID=26 device type=SBT_TAPE
channel C2: Oracle Database Backup Service Library VER=21.0.0.1

Starting Duplicate Db at 26/04/2022 21:31:22

contents of Memory Script:
{
   sql clone "create spfile from memory";
}
executing Memory Script

sql statement: create spfile from memory

contents of Memory Script:
{
   shutdown clone immediate;
   startup clone nomount;
}
executing Memory Script

Oracle instance shut down

connected to auxiliary database (not started)
Oracle instance started

Total System Global Area    1073738520 bytes

Fixed Size                     9143064 bytes
Variable Size                276824064 bytes
Database Buffers             780140544 bytes
Redo Buffers                   7630848 bytes
allocated channel: C1
channel C1: SID=20 device type=SBT_TAPE
channel C1: Oracle Database Backup Service Library VER=21.0.0.1
allocated channel: C2
channel C2: SID=274 device type=SBT_TAPE
channel C2: Oracle Database Backup Service Library VER=21.0.0.1
duplicating Online logs to Oracle Managed File (OMF) location
duplicating Datafiles to Oracle Managed File (OMF) location

contents of Memory Script:
{
   set until scn  2775654;
   sql clone "alter system set  db_name =
 ''ORCL'' comment=
 ''Modified by RMAN duplicate'' scope=spfile";
   sql clone "alter system set  db_unique_name =
 ''TEST'' comment=
 ''Modified by RMAN duplicate'' scope=spfile";
   shutdown clone immediate;
   startup clone force nomount
   restore clone primary controlfile;
   alter clone database mount;
}
executing Memory Script

executing command: SET until clause

sql statement: alter system set  db_name =  ''ORCL'' comment= ''Modified by RMAN duplicate'' scope=spfile

sql statement: alter system set  db_unique_name =  ''TEST'' comment= ''Modified by RMAN duplicate'' scope=spfile

Oracle instance shut down

Oracle instance started

Total System Global Area    1073738520 bytes

Fixed Size                     9143064 bytes
Variable Size                276824064 bytes
Database Buffers             780140544 bytes
Redo Buffers                   7630848 bytes
allocated channel: C1
channel C1: SID=21 device type=SBT_TAPE
channel C1: Oracle Database Backup Service Library VER=21.0.0.1
allocated channel: C2
channel C2: SID=273 device type=SBT_TAPE
channel C2: Oracle Database Backup Service Library VER=21.0.0.1

Starting restore at 26/04/2022 21:32:30

channel C1: starting datafile backup set restore
channel C1: restoring control file
channel C1: reading from backup piece c-1630800863-20220426-0d
channel C1: piece handle=c-1630800863-20220426-0d tag=TAG20220426T190230
channel C1: restored backup piece 1
channel C1: restore complete, elapsed time: 00:00:03
output file name=+DATA/TEST/control01.ctl
output file name=+RECO/TEST/control02.ctl
Finished restore at 26/04/2022 21:32:35

database mounted

contents of Memory Script:
{
   set until scn  2775654;
   set newname for clone datafile  1 to new;
   set newname for clone datafile  3 to new;
   set newname for clone datafile  4 to new;
   set newname for clone datafile  5 to new;
   set newname for clone datafile  6 to new;
   set newname for clone datafile  7 to new;
   set newname for clone datafile  8 to new;
   set newname for clone datafile  9 to new;
   set newname for clone datafile  10 to new;
   set newname for clone datafile  11 to new;
   set newname for clone datafile  12 to new;
   restore
   clone database
   ;
}
executing Memory Script

executing command: SET until clause

executing command: SET NEWNAME

executing command: SET NEWNAME

executing command: SET NEWNAME

executing command: SET NEWNAME

executing command: SET NEWNAME

executing command: SET NEWNAME

executing command: SET NEWNAME

executing command: SET NEWNAME

executing command: SET NEWNAME

executing command: SET NEWNAME

executing command: SET NEWNAME

Starting restore at 26/04/2022 21:32:46

channel C1: starting datafile backup set restore
channel C1: specifying datafile(s) to restore from backup set
channel C1: restoring datafile 00003 to +DATA
channel C1: restoring datafile 00004 to +DATA
channel C1: reading from backup piece DBTRegular-L01650981353244Wjn_df_ORCL_1630800863_070rtj0r_7_1_1_20220426_1103023131_set7
channel C2: starting datafile backup set restore
channel C2: specifying datafile(s) to restore from backup set
channel C2: restoring datafile 00001 to +DATA
channel C2: restoring datafile 00011 to +DATA
channel C2: reading from backup piece DBTRegular-L01650981353244Wjn_df_ORCL_1630800863_060rtj0r_6_1_1_20220426_1103023131_set6
channel C1: piece handle=DBTRegular-L01650981353244Wjn_df_ORCL_1630800863_070rtj0r_7_1_1_20220426_1103023131_set7 tag=DBTREGULAR-L01650981353244WJN
channel C1: restored backup piece 1
channel C1: restore complete, elapsed time: 00:00:26
channel C1: starting datafile backup set restore
channel C1: specifying datafile(s) to restore from backup set
channel C1: restoring datafile 00006 to +DATA
channel C1: reading from backup piece DBTRegular-L01650981353244Wjn_df_ORCL_1630800863_090rtj1k_9_1_1_20220426_1103023156_set9
channel C1: piece handle=DBTRegular-L01650981353244Wjn_df_ORCL_1630800863_090rtj1k_9_1_1_20220426_1103023156_set9 tag=DBTREGULAR-L01650981353244WJN
channel C1: restored backup piece 1
channel C1: restore complete, elapsed time: 00:00:25
channel C1: starting datafile backup set restore
channel C1: specifying datafile(s) to restore from backup set
channel C1: restoring datafile 00009 to +DATA
channel C1: restoring datafile 00010 to +DATA
channel C1: reading from backup piece DBTRegular-L01650981353244Wjn_df_ORCL_1630800863_080rtj1k_8_1_1_20220426_1103023156_set8
channel C2: piece handle=DBTRegular-L01650981353244Wjn_df_ORCL_1630800863_060rtj0r_6_1_1_20220426_1103023131_set6 tag=DBTREGULAR-L01650981353244WJN
channel C2: restored backup piece 1
channel C2: restore complete, elapsed time: 00:00:51
channel C2: starting datafile backup set restore
channel C2: specifying datafile(s) to restore from backup set
channel C2: restoring datafile 00005 to +DATA
channel C2: restoring datafile 00007 to +DATA
channel C2: reading from backup piece DBTRegular-L01650981353244Wjn_df_ORCL_1630800863_0a0rtj24_10_1_1_20220426_1103023172_set10
channel C1: piece handle=DBTRegular-L01650981353244Wjn_df_ORCL_1630800863_080rtj1k_8_1_1_20220426_1103023156_set8 tag=DBTREGULAR-L01650981353244WJN
channel C1: restored backup piece 1
channel C1: restore complete, elapsed time: 00:00:26
channel C1: starting datafile backup set restore
channel C1: specifying datafile(s) to restore from backup set
channel C1: restoring datafile 00008 to +DATA
channel C1: restoring datafile 00012 to +DATA
channel C1: reading from backup piece DBTRegular-L01650981353244Wjn_df_ORCL_1630800863_0b0rtj24_11_1_1_20220426_1103023172_set11
channel C2: piece handle=DBTRegular-L01650981353244Wjn_df_ORCL_1630800863_0a0rtj24_10_1_1_20220426_1103023172_set10 tag=DBTREGULAR-L01650981353244WJN
channel C2: restored backup piece 1
channel C2: restore complete, elapsed time: 00:01:00
channel C1: piece handle=DBTRegular-L01650981353244Wjn_df_ORCL_1630800863_0b0rtj24_11_1_1_20220426_1103023172_set11 tag=DBTREGULAR-L01650981353244WJN
channel C1: restored backup piece 1
channel C1: restore complete, elapsed time: 00:01:35
Finished restore at 26/04/2022 21:35:45

contents of Memory Script:
{
   switch clone datafile all;
}
executing Memory Script

datafile 1 switched to datafile copy
input datafile copy RECID=15 STAMP=1103060146 file name=+DATA/TEST/DATAFILE/system.278.1103059975
datafile 3 switched to datafile copy
input datafile copy RECID=16 STAMP=1103060146 file name=+DATA/TEST/DATAFILE/sysaux.261.1103059975
datafile 4 switched to datafile copy
input datafile copy RECID=17 STAMP=1103060147 file name=+DATA/TEST/DATAFILE/undotbs1.262.1103059975
datafile 5 switched to datafile copy
input datafile copy RECID=18 STAMP=1103060147 file name=+DATA/TEST/DD8FB21B4910F301E0530D00020A871C/DATAFILE/system.267.1103060027
datafile 6 switched to datafile copy
input datafile copy RECID=19 STAMP=1103060147 file name=+DATA/TEST/DD8FB21B4910F301E0530D00020A871C/DATAFILE/sysaux.269.1103060001
datafile 7 switched to datafile copy
input datafile copy RECID=20 STAMP=1103060147 file name=+DATA/TEST/DD8FB21B4910F301E0530D00020A871C/DATAFILE/undotbs1.264.1103060027
datafile 8 switched to datafile copy
input datafile copy RECID=21 STAMP=1103060147 file name=+DATA/TEST/DD8FD0D59F2B1F48E0530D00020A30C7/DATAFILE/system.266.1103060055
datafile 9 switched to datafile copy
input datafile copy RECID=22 STAMP=1103060147 file name=+DATA/TEST/DD8FD0D59F2B1F48E0530D00020A30C7/DATAFILE/sysaux.268.1103060025
datafile 10 switched to datafile copy
input datafile copy RECID=23 STAMP=1103060147 file name=+DATA/TEST/DD8FD0D59F2B1F48E0530D00020A30C7/DATAFILE/undotbs1.265.1103060025
datafile 11 switched to datafile copy
input datafile copy RECID=24 STAMP=1103060147 file name=+DATA/TEST/DATAFILE/users.273.1103059975
datafile 12 switched to datafile copy
input datafile copy RECID=25 STAMP=1103060147 file name=+DATA/TEST/DD8FD0D59F2B1F48E0530D00020A30C7/DATAFILE/users.263.1103060057

contents of Memory Script:
{
   set until scn  2775654;
   recover
   clone database
    delete archivelog
   ;
}
executing Memory Script

executing command: SET until clause

Starting recover at 26/04/2022 21:35:49

starting media recovery

channel C1: starting archived log restore to default destination
channel C1: restoring archived log
archived log thread=1 sequence=3
channel C1: reading from backup piece DBTRegular-L01650981353244Wjn_arc_ORCL_1630800863_0c0rtj2j_12_1_1_20220426_1103023187_set12
channel C2: starting archived log restore to default destination
channel C2: restoring archived log
archived log thread=1 sequence=4
channel C2: reading from backup piece Auto_Archive_arc_ORCL_1630800863_0h0rtlh9_17_1_1_20220426_1103025705_set17
channel C1: piece handle=DBTRegular-L01650981353244Wjn_arc_ORCL_1630800863_0c0rtj2j_12_1_1_20220426_1103023187_set12 tag=DBTREGULAR-L01650981353244WJN
channel C1: restored backup piece 1
channel C1: restore complete, elapsed time: 00:00:02
archived log file name=+RECO/TEST/ARCHIVELOG/2022_04_26/thread_1_seq_3.275.1103060169 thread=1 sequence=3
channel clone_default: deleting archived log(s)
archived log file name=+RECO/TEST/ARCHIVELOG/2022_04_26/thread_1_seq_3.275.1103060169 RECID=12 STAMP=1103060168
channel C1: starting archived log restore to default destination
channel C1: restoring archived log
archived log thread=1 sequence=5
channel C1: reading from backup piece Auto_Archive_arc_ORCL_1630800863_0m0rtp1n_22_1_1_20220426_1103029303_set22
channel C2: piece handle=Auto_Archive_arc_ORCL_1630800863_0h0rtlh9_17_1_1_20220426_1103025705_set17 tag=AUTO_ARCHIVE
channel C2: restored backup piece 1
channel C2: restore complete, elapsed time: 00:00:03
archived log file name=+RECO/TEST/ARCHIVELOG/2022_04_26/thread_1_seq_4.274.1103060169 thread=1 sequence=4
channel clone_default: deleting archived log(s)
archived log file name=+RECO/TEST/ARCHIVELOG/2022_04_26/thread_1_seq_4.274.1103060169 RECID=13 STAMP=1103060168
channel C2: starting archived log restore to default destination
channel C2: restoring archived log
archived log thread=1 sequence=6
channel C2: reading from backup piece Auto_Archive_arc_ORCL_1630800863_0s0ru73r_28_1_1_20220426_1103043707_set28
channel C1: piece handle=Auto_Archive_arc_ORCL_1630800863_0m0rtp1n_22_1_1_20220426_1103029303_set22 tag=AUTO_ARCHIVE
channel C1: restored backup piece 1
channel C1: restore complete, elapsed time: 00:00:03
archived log file name=+RECO/TEST/ARCHIVELOG/2022_04_26/thread_1_seq_5.274.1103060171 thread=1 sequence=5
channel clone_default: deleting archived log(s)
archived log file name=+RECO/TEST/ARCHIVELOG/2022_04_26/thread_1_seq_5.274.1103060171 RECID=14 STAMP=1103060171
channel C1: starting archived log restore to default destination
channel C1: restoring archived log
archived log thread=1 sequence=7
channel C1: reading from backup piece Auto_Archive_arc_ORCL_1630800863_0r0ru73r_27_1_1_20220426_1103043707_set27
channel C2: piece handle=Auto_Archive_arc_ORCL_1630800863_0s0ru73r_28_1_1_20220426_1103043707_set28 tag=AUTO_ARCHIVE
channel C2: restored backup piece 1
channel C2: restore complete, elapsed time: 00:00:02
archived log file name=+RECO/TEST/ARCHIVELOG/2022_04_26/thread_1_seq_6.275.1103060171 thread=1 sequence=6
channel clone_default: deleting archived log(s)
archived log file name=+RECO/TEST/ARCHIVELOG/2022_04_26/thread_1_seq_6.275.1103060171 RECID=15 STAMP=1103060171
channel C2: starting archived log restore to default destination
channel C2: restoring archived log
archived log thread=1 sequence=8
channel C2: restoring archived log
archived log thread=1 sequence=9
channel C2: reading from backup piece Auto_Archive_arc_ORCL_1630800863_120rual2_34_1_1_20220426_1103047330_set34
channel C1: piece handle=Auto_Archive_arc_ORCL_1630800863_0r0ru73r_27_1_1_20220426_1103043707_set27 tag=AUTO_ARCHIVE
channel C1: restored backup piece 1
channel C1: restore complete, elapsed time: 00:00:02
archived log file name=+RECO/TEST/ARCHIVELOG/2022_04_26/thread_1_seq_7.275.1103060173 thread=1 sequence=7
channel clone_default: deleting archived log(s)
archived log file name=+RECO/TEST/ARCHIVELOG/2022_04_26/thread_1_seq_7.275.1103060173 RECID=16 STAMP=1103060174
channel C1: starting archived log restore to default destination
channel C1: restoring archived log
archived log thread=1 sequence=10
channel C1: reading from backup piece Auto_Archive_arc_ORCL_1630800863_110rual2_33_1_1_20220426_1103047330_set33
channel C2: piece handle=Auto_Archive_arc_ORCL_1630800863_120rual2_34_1_1_20220426_1103047330_set34 tag=AUTO_ARCHIVE
channel C2: restored backup piece 1
channel C2: restore complete, elapsed time: 00:00:02
archived log file name=+RECO/TEST/ARCHIVELOG/2022_04_26/thread_1_seq_8.273.1103060175 thread=1 sequence=8
channel clone_default: deleting archived log(s)
archived log file name=+RECO/TEST/ARCHIVELOG/2022_04_26/thread_1_seq_8.273.1103060175 RECID=18 STAMP=1103060174
archived log file name=+RECO/TEST/ARCHIVELOG/2022_04_26/thread_1_seq_9.274.1103060175 thread=1 sequence=9
channel clone_default: deleting archived log(s)
archived log file name=+RECO/TEST/ARCHIVELOG/2022_04_26/thread_1_seq_9.274.1103060175 RECID=17 STAMP=1103060174
channel C2: starting archived log restore to default destination
channel C2: restoring archived log
archived log thread=1 sequence=11
channel C2: reading from backup piece Auto_Archive_arc_ORCL_1630800863_170rue5m_39_1_1_20220426_1103050934_set39
channel C1: piece handle=Auto_Archive_arc_ORCL_1630800863_110rual2_33_1_1_20220426_1103047330_set33 tag=AUTO_ARCHIVE
channel C1: restored backup piece 1
channel C1: restore complete, elapsed time: 00:00:03
archived log file name=+RECO/TEST/ARCHIVELOG/2022_04_26/thread_1_seq_10.274.1103060177 thread=1 sequence=10
channel clone_default: deleting archived log(s)
archived log file name=+RECO/TEST/ARCHIVELOG/2022_04_26/thread_1_seq_10.274.1103060177 RECID=19 STAMP=1103060177
channel C1: starting archived log restore to default destination
channel C1: restoring archived log
archived log thread=1 sequence=12
channel C1: reading from backup piece Auto_Archive_arc_ORCL_1630800863_1c0ruhl6_44_1_1_20220426_1103054502_set44
channel C2: piece handle=Auto_Archive_arc_ORCL_1630800863_170rue5m_39_1_1_20220426_1103050934_set39 tag=AUTO_ARCHIVE
channel C2: restored backup piece 1
channel C2: restore complete, elapsed time: 00:00:05
archived log file name=+RECO/TEST/ARCHIVELOG/2022_04_26/thread_1_seq_11.273.1103060179 thread=1 sequence=11
channel clone_default: deleting archived log(s)
archived log file name=+RECO/TEST/ARCHIVELOG/2022_04_26/thread_1_seq_11.273.1103060179 RECID=20 STAMP=1103060181
channel C1: piece handle=Auto_Archive_arc_ORCL_1630800863_1c0ruhl6_44_1_1_20220426_1103054502_set44 tag=AUTO_ARCHIVE
channel C1: restored backup piece 1
channel C1: restore complete, elapsed time: 00:00:10
archived log file name=+RECO/TEST/ARCHIVELOG/2022_04_26/thread_1_seq_12.274.1103060179 thread=1 sequence=12
channel clone_default: deleting archived log(s)
archived log file name=+RECO/TEST/ARCHIVELOG/2022_04_26/thread_1_seq_12.274.1103060179 RECID=21 STAMP=1103060184
media recovery complete, elapsed time: 00:00:02
Finished recover at 26/04/2022 21:36:30
released channel: C1
released channel: C2
Oracle instance started

Total System Global Area    1073738520 bytes

Fixed Size                     9143064 bytes
Variable Size                276824064 bytes
Database Buffers             780140544 bytes
Redo Buffers                   7630848 bytes

contents of Memory Script:
{
   sql clone "alter system set  db_name =
 ''TEST'' comment=
 ''Reset to original value by RMAN'' scope=spfile";
   sql clone "alter system reset  db_unique_name scope=spfile";
}
executing Memory Script

sql statement: alter system set  db_name =  ''TEST'' comment= ''Reset to original value by RMAN'' scope=spfile

sql statement: alter system reset  db_unique_name scope=spfile
Oracle instance started

Total System Global Area    1073738520 bytes

Fixed Size                     9143064 bytes
Variable Size                276824064 bytes
Database Buffers             780140544 bytes
Redo Buffers                   7630848 bytes
sql statement: CREATE CONTROLFILE REUSE SET DATABASE "TEST" RESETLOGS ARCHIVELOG
  MAXLOGFILES     16
  MAXLOGMEMBERS      3
  MAXDATAFILES     1024
  MAXINSTANCES     8
  MAXLOGHISTORY      292
 LOGFILE
  GROUP     1  SIZE 1 G ,
  GROUP     2  SIZE 1 G ,
  GROUP     3  SIZE 1 G
 DATAFILE
  '+DATA/TEST/DATAFILE/system.278.1103059975',
  '+DATA/TEST/DD8FB21B4910F301E0530D00020A871C/DATAFILE/system.267.1103060027',
  '+DATA/TEST/DD8FD0D59F2B1F48E0530D00020A30C7/DATAFILE/system.266.1103060055'
 CHARACTER SET AL32UTF8


contents of Memory Script:
{
   set newname for clone tempfile  1 to new;
   set newname for clone tempfile  2 to new;
   set newname for clone tempfile  4 to new;
   switch clone tempfile all;
   catalog clone datafilecopy  "+DATA/TEST/DATAFILE/sysaux.261.1103059975",
 "+DATA/TEST/DATAFILE/undotbs1.262.1103059975",
 "+DATA/TEST/DD8FB21B4910F301E0530D00020A871C/DATAFILE/sysaux.269.1103060001",
 "+DATA/TEST/DD8FB21B4910F301E0530D00020A871C/DATAFILE/undotbs1.264.1103060027",
 "+DATA/TEST/DD8FD0D59F2B1F48E0530D00020A30C7/DATAFILE/sysaux.268.1103060025",
 "+DATA/TEST/DD8FD0D59F2B1F48E0530D00020A30C7/DATAFILE/undotbs1.265.1103060025",
 "+DATA/TEST/DATAFILE/users.273.1103059975",
 "+DATA/TEST/DD8FD0D59F2B1F48E0530D00020A30C7/DATAFILE/users.263.1103060057";
   switch clone datafile all;
}
executing Memory Script

executing command: SET NEWNAME

executing command: SET NEWNAME

executing command: SET NEWNAME

renamed tempfile 1 to +DATA in control file
renamed tempfile 2 to +DATA in control file
renamed tempfile 4 to +DATA in control file

cataloged datafile copy
datafile copy file name=+DATA/TEST/DATAFILE/sysaux.261.1103059975 RECID=1 STAMP=1103060225
cataloged datafile copy
datafile copy file name=+DATA/TEST/DATAFILE/undotbs1.262.1103059975 RECID=2 STAMP=1103060225
cataloged datafile copy
datafile copy file name=+DATA/TEST/DD8FB21B4910F301E0530D00020A871C/DATAFILE/sysaux.269.1103060001 RECID=3 STAMP=1103060226
cataloged datafile copy
datafile copy file name=+DATA/TEST/DD8FB21B4910F301E0530D00020A871C/DATAFILE/undotbs1.264.1103060027 RECID=4 STAMP=1103060226
cataloged datafile copy
datafile copy file name=+DATA/TEST/DD8FD0D59F2B1F48E0530D00020A30C7/DATAFILE/sysaux.268.1103060025 RECID=5 STAMP=1103060226
cataloged datafile copy
datafile copy file name=+DATA/TEST/DD8FD0D59F2B1F48E0530D00020A30C7/DATAFILE/undotbs1.265.1103060025 RECID=6 STAMP=1103060226
cataloged datafile copy
datafile copy file name=+DATA/TEST/DATAFILE/users.273.1103059975 RECID=7 STAMP=1103060226
cataloged datafile copy
datafile copy file name=+DATA/TEST/DD8FD0D59F2B1F48E0530D00020A30C7/DATAFILE/users.263.1103060057 RECID=8 STAMP=1103060226

datafile 3 switched to datafile copy
input datafile copy RECID=1 STAMP=1103060225 file name=+DATA/TEST/DATAFILE/sysaux.261.1103059975
datafile 4 switched to datafile copy
input datafile copy RECID=2 STAMP=1103060225 file name=+DATA/TEST/DATAFILE/undotbs1.262.1103059975
datafile 6 switched to datafile copy
input datafile copy RECID=3 STAMP=1103060226 file name=+DATA/TEST/DD8FB21B4910F301E0530D00020A871C/DATAFILE/sysaux.269.1103060001
datafile 7 switched to datafile copy
input datafile copy RECID=4 STAMP=1103060226 file name=+DATA/TEST/DD8FB21B4910F301E0530D00020A871C/DATAFILE/undotbs1.264.1103060027
datafile 9 switched to datafile copy
input datafile copy RECID=5 STAMP=1103060226 file name=+DATA/TEST/DD8FD0D59F2B1F48E0530D00020A30C7/DATAFILE/sysaux.268.1103060025
datafile 10 switched to datafile copy
input datafile copy RECID=6 STAMP=1103060226 file name=+DATA/TEST/DD8FD0D59F2B1F48E0530D00020A30C7/DATAFILE/undotbs1.265.1103060025
datafile 11 switched to datafile copy
input datafile copy RECID=7 STAMP=1103060226 file name=+DATA/TEST/DATAFILE/users.273.1103059975
datafile 12 switched to datafile copy
input datafile copy RECID=8 STAMP=1103060226 file name=+DATA/TEST/DD8FD0D59F2B1F48E0530D00020A30C7/DATAFILE/users.263.1103060057
Reenabling controlfile options for auxiliary database
Executing: alter database force logging
Executing: alter database enable block change tracking

contents of Memory Script:
{
   Alter clone database open resetlogs;
}
executing Memory Script

database opened

contents of Memory Script:
{
   sql clone "alter pluggable database all open";
}
executing Memory Script

sql statement: alter pluggable database all open
Cannot remove created server parameter file
Finished Duplicate Db at 26/04/2022 21:38:41

RMAN>

Conclusão

Esse post apresentou como utilizar os backups automáticos da OCI para realizar um duplicate RMAN de forma manual, essa abordagem pode ser útil em diversos cenários, como a clonagem de bases de grande porte que tem restrições de performance com Active Duplicate, ou até mesmo para testar a integridade do backup OCI de forma independente dos recursos da console.

Leave a Reply

Discover more from Blog do Dibiei

Subscribe now to keep reading and get access to the full archive.

Continue reading