Multiplexando Controlfile no ASM em RAC com RMAN

O objetivo deste é explicar como multiplexar os controlfiles no ASM em RAC. Este nós vamos utilizar o RMAN para realizar tal operação.
Vamos executar todo procedimento no RAC 1 e deixar o banco de dados no RAC 2 baixado.

Vamos visualizar os controlfiles no ASM em RAC.

RAC 1

[oracle-DB@rac10g1 ~]$ ps -ef | grep pmon
oracle    5385     1  0 20:14 ?        00:00:00 asm_pmon_+ASM1
oracle    5697     1  0 20:15 ?        00:00:00 ora_pmon_racrafa1
oracle    7670  5975  0 20:19 pts/0    00:00:00 grep pmon
[oracle-DB@rac10g1 ~]$ sqlplus /nolog

SQL*Plus: Release 10.2.0.4.0 - Production on Tue Oct 25 20:21:25 2011

Copyright (c) 1982, 2007, Oracle.  All Rights Reserved.

SQL> conn sys/***** as sysdba
Connected.
SQL> show parameter control

NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
control_file_record_keep_time        integer     7
control_files                        string      +DGTESTE/racrafa/controlfile/c
                                                 ontrol02.ctl, +DGDADOS/racrafa
                                                 /controlfile/current.256.74879
                                                 4713
SQL> !

Vamos visualizar os discos de grupos disponíveis para a Multiplexação dos Controlfiles.

[oracle-DB@rac10g1 ~]$ export ORACLE_SID=+ASM1
[oracle-DB@rac10g1 ~]$ asmcmd
ASMCMD> lsdg
State    Type    Rebal  Unbal  Sector  Block       AU  Total_MB  Free_MB  Req_mir_free_MB  Usable_file_MB  Offline_disks  Name
MOUNTED  EXTERN  N      N         512   4096  1048576      2046      167                0             167              0  DGARCH/
MOUNTED  EXTERN  N      N         512   4096  1048576      4092     2354                0            2354              0  DGDADOS/
MOUNTED  EXTERN  N      N         512   4096  1048576      2046     1941                0            1941              0  DGINDEX/
MOUNTED  EXTERN  N      N         512   4096  1048576      3072     2946                0            2946              0  DGTESTE/
ASMCMD> exit

Vamos desligar as Instâncias do RAC para realizarmos o procedimento de Multiplexação dos Controlfiles.

[oracle-DB@rac10g1 ~]$ srvctl stop instance -d racrafa -i racrafa1 -o immediate

RAC 2

[oracle-DB@rac10g2 ~]$ srvctl stop instance -d racrafa -i racrafa2 -o immediate
[oracle-DB@rac10g2 ~]$ ps -ef | grep pmon
oracle    5468     1  0 20:14 ?        00:00:00 asm_pmon_+ASM2
oracle   13475  7056  0 20:33 pts/0    00:00:00 grep pmon
[oracle-DB@rac10g2 ~]$

Vamos iniciar a multiplexação dos controlfiles no RAC 1. Vamos iniciá-lo no estato “nomount” para executar a multiplexação.

RAC 1

[oracle-DB@rac10g1 ~]$ srvctl start instance -d racrafa -i racrafa1 -o nomount
[oracle-DB@rac10g1 ~]$ exit
exit
SQL> exit
ERROR:
ORA-03135: connection lost contact


Disconnected from Oracle Database 10g Release 10.2.0.4.0 - Production
With the Real Application Clusters option (with complications)
[oracle-DB@rac10g1 ~]$ sqlplus /nolog

SQL*Plus: Release 10.2.0.4.0 - Production on Tue Oct 25 20:34:39 2011

Copyright (c) 1982, 2007, Oracle.  All Rights Reserved.
SQL> conn sys/***** as sysdba
Connected.
SQL> show parameter control

NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
control_file_record_keep_time        integer     7
control_files                        string      +DGTESTE/racrafa/controlfile/c
                                                 ontrol02.ctl, +DGDADOS/racrafa
                                                 /controlfile/current.256.74879
                                                 4713
SQL> !

Acessando o RMAN para realizar a Multiplexação do Controlfile.

[oracle-DB@rac10g1 ~]$ rman target ****/*****

Recovery Manager: Release 10.2.0.4.0 - Production on Tue Oct 25 20:34:59 2011

Copyright (c) 1982, 2007, Oracle.  All rights reserved.

connected to target database: racrafa (not mounted)
RMAN> restore controlfile to '+DGINDEX/racrafa/controlfile/control03.ctl' from '+DGDADOS/racrafa/controlfile/current.256.748794713';

Starting restore at 25-OCT-11
using channel ORA_DISK_1

channel ORA_DISK_1: copied control file copy
Finished restore at 25-OCT-11

RMAN> exit


Recovery Manager complete.
[oracle-DB@rac10g1 ~]$ exit
exit

Vamos criar um PFILE do SPFILE corrente por segurança e alterar no SPFILE o parâmetro “control_files”.

SQL> show parameter control

NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
control_file_record_keep_time        integer     7
control_files                        string      +DGTESTE/racrafa/controlfile/c
                                                 ontrol02.ctl, +DGDADOS/racrafa
                                                 /controlfile/current.256.74879
                                                 4713
SQL> create pfile from spfile;

File created.

SQL> alter system set control_files='+DGTESTE/racrafa/controlfile/control02.ctl','+DGDADOS/racrafa/controlfile/current.256.748794713','+DGINDEX/racrafa/controlfile/control03.ctl' scope=spfile sid='*';

System altered.

SQL> shutdown immediate
ORA-01507: database not mounted


ORACLE instance shut down.
SQL> exit
Disconnected from Oracle Database 10g Release 10.2.0.4.0 - Production
With the Real Application Clusters option

Vamos iniciar o ambiente RAC.

[oracle-DB@rac10g1 ~]$ srvctl start instance -d racrafa -i racrafa1,racrafa2
[oracle-DB@rac10g1 ~]$ sqlplus /nolog

SQL*Plus: Release 10.2.0.4.0 - Production on Tue Oct 25 20:40:52 2011

Copyright (c) 1982, 2007, Oracle.  All Rights Reserved.
SQL> conn sys/****** as sysdba
Connected.
SQL> show parameter control_file

NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
control_file_record_keep_time        integer     7
control_files                        string      +DGTESTE/racrafa/controlfile/c
                                                 ontrol02.ctl, +DGDADOS/racrafa
                                                 /controlfile/current.256.74879
                                                 4713, +DGINDEX/racrafa/control
                                                 file/control03.ctl
SQL> show parameter instance_name

NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
instance_name                        string      racrafa1
SQL>

RAC 2

[oracle-DB@rac10g2 ~]$ ps -ef | grep pmon
oracle    5468     1  0 20:14 ?        00:00:00 asm_pmon_+ASM2
oracle   16270     1  0 20:40 ?        00:00:00 ora_pmon_racrafa2
oracle   16875  7056  0 20:41 pts/0    00:00:00 grep pmon
[oracle-DB@rac10g2 ~]$ sqlplus /nolog

SQL*Plus: Release 10.2.0.4.0 - Production on Tue Oct 25 20:41:20 2011

Copyright (c) 1982, 2007, Oracle.  All Rights Reserved.
SQL> conn sys/****** as sysdba
Connected.
SQL> show parameter control_file

NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
control_file_record_keep_time        integer     7
control_files                        string      +DGTESTE/racrafa/controlfile/c
                                                 ontrol02.ctl, +DGDADOS/racrafa
                                                 /controlfile/current.256.74879
                                                 4713, +DGINDEX/racrafa/control
                                                 file/control03.ctl
SQL> show parameter instance_name

NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
instance_name                        string      racrafa2
SQL>

Pronto seus controlfiles no ASM em RAC foram multiplexados conforme recomendações de segurança da Oracle.

%name Multiplexando Controlfile no ASM em RAC com RMAN

Autor: Maycon Tomiasi

Formado em Tecnologia da Informação na FIPP (Faculdade de Informática de Presidente Prudente), Analista DBA Oracle pela Teiko Soluções em Tecnologia da Informação, residente em Blumenau/ SC, Certificado OCP 10g/11g/12c, OCS 11g Implementation, OCE 11g Performance Tuning, OCE 11g RAC & GRID e OPN Specialist. Conhecimentos em PHP.