Passo a passo para se criar um standby físico utilizando o comando DUPLICATE do RMAN a partir de um database master ativo.
- A feature de criação online está disponível a partir da versão Oracle 11g.
- O comando duplicate do RMAN está disponível em versões anteriores, porém não é feito de forma "online": é necessário restaurar um backup para criar a criação do standby nas versões anteriores a 11g.
- Documentação Oracle: Step by Step Guide on Creating Physical Standby Using RMAN DUPLICATE...FROM ACTIVE DATABASE Without Shutting down the Primary and using Primary Active Database Files [ID 1075908.1]
Passo a passo:
1.Make the necessary changes to the primary database.
a. Enable force logging.
b. Creating the password file if one does not exist.
c. Create standby redologs.
d. Modify the parameter file suitable for Dataguard.
2. Ensure that the sql*net connectivity is working fine.
3. Create the standby database over the network using the active(primary) database files.
a. Create the password file
b. Create the initialization parameter file for the standby database (auxiliary database)
c. Create the necessary mount points or the folders for the database files
d. Run the standby creation ON STANDBY by connecting to primary as target database.
O passo acima em destaque é o que efetivamente cria o standby. O banco standby deve estar no estado NOMOUNT com o pfile que foi criado no passo 3.b (pfile com apenas o parâmetro db_name='$NOME')
Depois de subir em NOMOUNT, a partir do primary deve-se conectar ao rman com o standby de auxiliar:
rman target sys/$PASS@$primary auxiliary sys/$PASS@standby
connected to target database: PRIMARY(DBID=XXXXXXXX)
connected to auxiliary database: STANDBY (not mounted)
IMPORTANTE: A conexão de ambos os lados deve ser feita usando entradas no TNS da máquina standby (netservices). Conectando-se localmente ( auxiliary /) não vai funcionar.
IMPORTANTE2: Os dois servidores envolvidos tem que ter a mesma entrada no tns (lembre-se de usar UR=A).
IMPORTANTE3: Em caso de FS, crie todos os diretórios antes.
IMPORTANTE4: Forçar o tns a se conectar no nó 1 do cluster (primary e standby) em caso de Oracle RAC
IMPORTANTE3: Em caso de FS, crie todos os diretórios antes.
IMPORTANTE4: Forçar o tns a se conectar no nó 1 do cluster (primary e standby) em caso de Oracle RAC
RMAN DUPLICATE:
run {
allocate channel prmy1 type disk;
allocate channel prmy2 type disk;
allocate channel prmy3 type disk;
allocate channel prmy4 type disk;
allocate auxiliary channel stby type disk;
duplicate target database for standby from active database nofilenamecheck
spfile
parameter_value_convert ' $NOME ',' $NOME '
set db_unique_name=' $NOME '
set db_file_name_convert='+DG_DATA1/ $NOME ','+DG_DATA/ $NOME '
set log_file_name_convert='+DG_REDO1/ $NOME ','+DG_REDO/ $NOME '
set control_files='+DG_CONTROL','+DG_DATA'
set log_archive_max_processes='5'
set audit_file_dest='/u00/app/oracle/diag'
set db_create_file_dest='+DG_DATA'
set fal_client=' $NOME_STD '
set fal_server=' $NOME_MASTER '
set standby_file_management='AUTO'
set log_archive_dest_1='LOCATION=+DG_ARCH'
set log_archive_format='SGA_%t_%s_%r.arc';
}
Caso o standby não tenha o mesmo nome do primary, retire a entrada nofilenamecheck e altere os valores de $NOME para:
Primeiro valor: SID_MASTER
Segundo valor: SID_STANDBY
OBS.: Já passei por casos onde é necessário setar manualmente o SID no standby para evitar problemas no serviço durante o processo (pois o duplicate restarta o banco).
Nenhum comentário:
Postar um comentário