Oracle Duplicate Database (From Active)

Olá, nesse artigo iremos abordar as etapas necessárias para se realizar um duplicate do banco de dados oracle a partir de uma instância ativa. (Duplicate from active database)

1 - Criar um listener dedicato ao duplicate: (etapa opcional)

vi $ORACLE_HOME/network/admin/listener.ora
LISTENER_DUP =
  (DESCRIPTION_LIST =
    (DESCRIPTION =
      (ADDRESS = (PROTOCOL = TCP)(HOST = oracledb)(PORT = 1522))
      (ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1522))
    )
  )

2 - Criar serviço estático no listener:

vi $ORACLE_HOME/network/admin/listener.ora
SID_LIST_LISTENER_DUP =
 (SID_LIST =
  (SID_DESC =
  (GLOBAL_DBNAME = DUPDB)
  (ORACLE_HOME = /u01/app/oracle/product/19.0.0/dbhome_1)
  (SID_NAME = DUPDB)
  )
)

3 - Iniciar novo listener:

lsnrctl start LISTENER_DUP

4 - Exportar as variáveis de ambiente para a nova instância:

export ORACLE_SID=DUPDB
export ORACLE_HOME=/u01/app/oracle/product/19.0.0/dbhome_1

5 - Adicionar um nova entrada no tnsnames.ora:

vi $ORACLE_HOME/network/admin/tnsnames.ora
DUPDB =
  (DESCRIPTION =
    (ADDRESS = (PROTOCOL = TCP)(HOST = oracledb)(PORT = 1522))
    (CONNECT_DATA =
      (SERVER = DEDICATED)
      (SERVICE_NAME = DUPDB)
    )
  )

6 - Criar um pfile para iniciar a instância em modo nomount:

vi /home/oracle/initDUPDB.ora
*.audit_file_dest='/u01/app/oracle/admin/DUPDB/adump'
*.audit_trail='db'
*.compatible='19.0.1'
*.control_files='+DATA/DUPDB/control01.ctl','+RECO/DUPDB/control02.ctl'
*.db_block_size=8192
*.db_name='DUPDB'
*.db_unique_name='DUPDB'
*.db_recovery_file_dest='+RECO'
*.db_recovery_file_dest_size=17179869184
*.diagnostic_dest='/u01/app/oracle'
*.dispatchers='(PROTOCOL=TCP) (SERVICE=DUPDBXDB)'
*.local_listener='LISTENER_DUPDB'
*.log_archive_dest_1='LOCATION=+RECO'
*.log_archive_format='%t_%s_%r.arc'
*.memory_max_target=0
*.nls_language='AMERICAN'
*.nls_territory='AMERICA'
*.open_cursors=300
*.pga_aggregate_target=278m
*.processes=300
*.remote_login_passwordfile='EXCLUSIVE'
*.sga_target=872415232
*.undo_tablespace='UNDOTBS1'
*.db_file_name_convert='+DATA/ORCL','+DATA/DUPDB','+DATA/ORCL/DATAFILE', '+DATA/DUPDB/DATAFILE'
*.log_file_name_convert='+RECO/ORCL','+RECO/DUPDB' 
*.pdb_file_name_convert='+DATA/ORCL','+DATA/DUPDB','+DATA/ORCL/DATAFILE', '+DATA/DUPDB/DATAFILE' 

7 - Criar audit file dest no sistema operacional

mkdir -p /u01/app/oracle/admin/DUPDB/adump

8 - Criar arquivo de senhas (ORAPW): orapwd

cd $ORACLE_HOME/dbs
orapwd file=orapwDUPDB format=12

9 - Iniciar instância em modo NOMOUNT usando o pfile criado na etapa anterior:

export ORACLE_SID=DUPDB
export ORACLE_HOME=/u01/app/oracle/product/19.0.0/dbhome_1
sqlplus / as sysdba
startup nomount pfile='/home/oracle/initDUPDB.ora';

10 - RMAN Duplicate Database from Active:

vi duplicate.rcv
connect target sys/oracle@ORCL
connect auxiliary sys/oracle@DUPDB

run{

allocate auxiliary channel c1 device type disk;
allocate auxiliary channel c2 device type disk;
allocate auxiliary channel c3 device type disk;
allocate auxiliary channel c4 device type disk;

allocate channel c5 device type disk;

duplicate target database to DUPDB from active database nofilenamecheck;

}
nohup rman cmdfile duplicate.rcv &

- Até a próxima.

Oracle Duplicate Database (From Active)

— Autor: Leonardo Lopes 02/03/2025 05H:13