-
Upgrade de bases de datos 10gR1R2 a 11gR2 Parte III
Por Joel Prez ( Oracle ACE )
Reciban estimados tecnlogos Oracle un cordial saludo. A travs
del presente artculo, tendremos la
adentrarnos un poco en el tema de Rolling Upgrade de bases de
datos 10g(R1/R2) a 11gR2.
Dentro de todas las posibles tareas que uno como DBA ( Database
Administrator ) realiza, personalmente,
una por las que mas siento afinidad es realizar upgrades. Las
condiciones, atributos, criticidad de negocio,
ventanas de tiempo, etc, generalmente siempre son diversas entre
un caso y otro.
Realizar un upgrade es como construir un traje a la medida.
Diversas sern las vas pero el objetivo
siempre ser escoger la opcin mas optima para el caso, ofreciendo
el menor Downtime posible.
Enmarcaremos los mtodos de upgrade de la siguiente manera:
Upgrades ( Lgicos ): un upgrade se lleva a cabo a travs de vas y
mtodos lgicos cuando hacemos uso de
utilitarios y soluciones tales como:
export/import
Data Pump export/import.
Data Guard: SQL Apply
Las opciones lgicas comprenden internamente la ejecucin de DMLs
( Data Manipulating Language )& DDLs (
Data Definition Language ).
Upgrades ( Fsicos ): un upgrade se lleva a cabo fsicamente
cuando trasladamos nuestras bases de datos
bloque a bloque tal cual como es la naturaleza de su
almacenamiento. Para esta clasificacin tenemos algunas
opciones:
RMAN Restore & Recover
Manual Standby
Data Guard
Convert Database
DBUA ( Database Upgrade Assistant )
Ahora, la pregunta es cuando utilizar una opcin o la otra all es
cuando inicia la construccin del traje a la
medida Para la escogencia del mtodo se analizaran principalmente
las siguientes condiciones:
La empresa tiene capacidad para un Downtime largo, moderado o
casi nulo ?
Capacidad de ocupacin de la base de datos ( medida: 30GB, 200GB,
5TB..etc )
-
Endian Format del Sistema operativo origen y destino
Cada una de las opciones poseen ventajas y desventajas, unas con
respecto a las otras.
Analicemos posibles escenarios para proporcionarnos una idea de
cmo seria el ciclo de vida de escoger la opcin
adecuada:
Caso 1.- Se desea migrar BBDD de 30GB de un servidor con sistema
operativo (SO) Linux 64Bits a un servidor con
SO HP-UX 11.31 64bits.
Elementos a considerar para el caso 1:
La BBDD se puede considerar una BBDD de medida reducida.
Los sistemas operativos origen y destinos no poseen el mismo
endian format por lo tanto
se opcionara en primer orden por un mtodo lgico el cual no posee
distincin en
operacin de acuerdo al sistema operativo origen o destino
Si la BBDD origen es 9i o versiones anteriores tendremos que
llevar a cabo el uso de
Export/Import el cual exista para las nombradas versiones y
posee su utilitario en versin
superior en 10g(R1/R2) & 11g(R1/R2). Si el origen de BBDD es
10g(R1) o superior se
podr utilizar Data Pump Export/Import. Nota: en versiones 9i o
anteriores no existan los
utilitarios Data Pump Export/Import
Conclusin para el caso 1: se utilizaran los utilitarios
Export/Import debido a que la BBDD no es de largo alcance y
los sistemas operativos origen y destinos poseen distintos
endian formats. Se asume que estar permitido un
Downtime necesario para llevar a cabo la tarea lo cual lo
podramos clasificar como un Downtime bajo.
Caso 2.- Se desea migrar BBDD de 5TB de un servidor con sistema
operativo (SO) Linux 64Bits a un servidor con
SO HP-UX 11.31 64bits.
Elementos a considerar para el caso 2:
La BBDD esta vez si es de largo alcance. La opcin de
export/import ya no seria una
opcin aconsejable debido a que el Downtime posiblemente sea
bastante largo
Los sistemas operativos origen y destinos no poseen el mismo
endian format por lo tanto
se anulan las posibilidades de traslados fsicos por el principio
mencionado. Para el
presente caso las posibles vas de migracin podran ser a travs de
las siguientes
herramientas y/o soluciones:
o Oracle Streams
o Oracle Golden Gate
o RMAN: Transportable Tablespaces
-
Cada una de estas herramientas poseen sus modos de usos,
limitaciones, ventajas y desventajas de acuerdo al
caso. Solo se podr escoger la mejor va si se posee el
conocimiento de que tan verstil es cada una de estas y
cuales son las implicaciones que cada una de ellas ( Soluciones
de migracin: utilitarios y/o mtodos ) encierran.
Caso 3.- Se desea migrar BBDD de 3TB de un servidor con sistema
operativo (SO) Linux 64Bits a un servidor con
SO Linux 64bits.
Elementos a considerar para el caso 3:
La BBDD es de largo alcance pero tenemos la mejor condicin y/o
atributo posible en
casos de upgrade. Migracin entre sistemas operativos que poseen
el mismo endian
format. Dentro de esta clasificacin hay 2 sub-clasificaciones
mas:
o Endian format y Sistemas operativos origen y destino idnticos:
con esta opcin
podremos utilizar: RMAN Restore & Recover, Data Guard, DBUA
etc.
o Endian format Iguales y Sistemas operativos origen y destino
diversos: en esta
opcin tendremos que utilizar RMAN: Convert Database
En anlisis de solo 3 casos podemos proyectar lo complejo que
podra tornarse la escogencia del mtodo idneo
para la migracin de una BBDd.. La objetivo de la serie de
artculos: Upgrade de base de datos10g(R1/R2) a
11gR2 ( Parte I/II/III,etc ) es proporcionarnos los criterios y
las claves necesarias para escoger entre los diversos
mtodos, herramientas y/o soluciones para realizar un exitoso
upgrade.
El siguiente diagrama ilustra la toma de decisiones para llevar
a cabo una tarea de upgrade. Tal como se puede
visualizar, el principal elemento de discernimiento para la
escogencia de la tcnica es la versin del sistema
operativo y su respectivo Endian Format. Si nos encontramos en
el mismo sistema operativo escogeramos el
siguiente elemento en el camino en base al Downtime permitido.
Si el mismo puede ser mayor a 30minutos
entonces podemos realizarlo con tcnicas que conlleven la
reconstruccin del catalogo como ( RMAN: Restore &
Recover + catupgrd script ) o a travs del DBUA el cual es el
foco del presente articulo.
-
Si el origen y destino no se encuentra en el mismo sistema
operativo entonces tenemos opciones como:
Data Guard ( SQL Apply )
Oracle Streams
Transportable Database/Tablespaces
Oracle Golden Gate
Export/Import
Dado por terminado la introduccin al presente artculo, hablemos
un poco del escenario que llevaremos a cabo.
Un cliente posee las siguientes caractersticas y
requerimientos:
Base de Datos de Produccin: Tamao 8TB
Requerimiento: migrar la misma de versin 10g(10.2.0.5) Single
Instance a 11gR2(11.2.0.3) RAC
Perfil de Criticidad: Su negocio es altamente critico y desea un
Downtime lo mas corto posible
Sistemas operativos: sus sistemas operativos origen y destino
son el mismo ( Oracle Linux para x86 64-bit ).
En base a las caractersticas descritas se analiza y se llega a
la conclusin de que un mtodo eficiente para realizar
este trabajo seria a travs de un Rolling Upgrade con RMAN,
restaurando y recuperando backups de RMAN de
versin de BBDD 10g en una BBDD 11g R2 de single a RAC.
Podra usted preguntarse en este momento: y eso es posible
realizarlo de forma directa ?
-
Respuesta: si, siendo as vamos a realizarlo
Herramientas utilizadas para el presente articulo:
RMAN ( Oracle Recovery Manager )
DBCA ( Database Configuration Assistant ).
Datos de Escenario
Origen
o Configuracin de Instancias: Single Instance
o Nombre de BBDD: SRCDB
o Versin de manejador: 10.2.0.5
o Locacin para archivos de BBDD: filesystem
o Servidor: MyServer1
o Sistema Operativo: Oracle Linux para x86 64-bit
Destino
o Configuracin de Instancias: Instancias de BBDD para RAC (
SRCDB1 & SRCDB2 )
o Nombre de BBDD: SRCDB
o Versin de manejador: 11.2.0.3
o Locacin para archivos de BBDD: ASM
o Servidores: MyRACServer1 & MyRACServer2
o Sistemas Operativos: Oracle Linux para x86 64-bit
En la presente actividad se asume lo siguiente:
La BBDD origen en 10.2.0.5 es una BBDD de produccin la cual debe
estar establecida en modo Archive
Para el presente caso los backups se almacenaran en discos
locales del servidor origen. Si la BBDD tuviese una poltica de
respaldos en cinta. Toda la infraestructura de cinta deber ser
presentada para uso al nodo1 de RAC
La BBDD destino en RAC ser creada a travs del DBCA con las
opciones que el DBA a cargo escoja. Para el presente ejercicio, los
controlfiles, datafiles & Redo Log files sern sustituidos por
el proceso de restauracin y creacin de nuevos elementos.
Los ajustes de los parmetros de la BBDD final estar a cargo del
DBA. Es una actividad que se debe de realizar para asegurar el
rendimiento optimo de la misma.
-
Paths de Upgrade ( Versiones )
Paso1: Ejecucin del Pre-Upgrade Tool Estando conectados en la
BBDD origen debemos ejecutar el script utlu112i.sql. Este script
establece las condiciones necesarias para la posterior apertura de
la BBDD en modo upgrade. El mismo debe obtenerse en el Oracle Home
del manejador destino, en el presente caso, el manejador destino es
11.2.0.3 tal como puede ser visualizado en el feedback de ejecucin
del mismo. Oracle Database Server 11gR1 tambin posee su versin de
este script para realizar upgrade de versiones anteriores a la
misma. Dicho script realiza internamente la adicin de un campo a la
tabla registry$database y la actualizacin de su respectivo valor.
Posterior a ello realiza el compilado del package SYS.DBMS_REGISTRY
y de la vista SYS.DBA_REGISTRY_DATABASE. SQL> ALTER TABLE
registry$database ADD (tz_version NUMBER); SQL> UPDATE
registry$database set tz_version =4;
SQL> ALTER PACKAGE SYS.DBMS_REGISTRY COMPILE BODY; SQL>
ALTER VIEW SYS.DBA_REGISTRY_DATABASE COMPILE;
Nota: Es importante divisar las recomendaciones plasmadas en el
feedback de la ejecucin del script ( tamao mnimo de tablespaces,
valor para opcin Flashback, feedback de componentes instalados en
la BBDD, Recycle bin, EM, estadsticas, parmetros, etc )
-
La ejecucin de este script es clave para la reconstruccin del
catalogo en la BBDD destino. Si el mismo no es ejecutado en la BBDD
original, la reconstruccin del catalogo fallara y en la mayora de
los casos, deber repetir el proceso desde el paso 1.
[oracle@MyServer1 ~]$ sqlplus / as sysdba
SQL*Plus: Release 10.2.0.4.0 - Production on Tue Sep 4 18:24:14
2012
Copyright (c) 1982, 2007, Oracle. All Rights Reserved.
Connected to:
Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 -
64bit Production
With the Partitioning, OLAP, Data Mining and Real Application
Testing options
SQL> start utlu112i.sql
Oracle Database 11.2 Pre-Upgrade Information Tool 08-09-2012
15:04:26
Script Version: 11.2.0.3.0 Build: 001
.
**********************************************************************
Database:
**********************************************************************
--> name: DB10TO11
--> version: 10.2.0.4.0
--> compatible: 10.2.0.3.0
--> blocksize: 8192
--> platform: Linux x86 64-bit
--> timezone file: V4
.
**********************************************************************
Tablespaces: [make adjustments in the current environment]
**********************************************************************
--> SYSTEM tablespace is adequate for the upgrade.
.... minimum required size: 719 MB
--> UNDOTBS1 tablespace is adequate for the upgrade.
.... minimum required size: 400 MB
--> SYSAUX tablespace is adequate for the upgrade.
.... minimum required size: 444 MB
--> TEMP tablespace is adequate for the upgrade.
.... minimum required size: 60 MB
.
**********************************************************************
Flashback: OFF
**********************************************************************
**********************************************************************
Update Parameters: [Update Oracle Database 11.2 init.ora or
spfile]
Note: Pre-upgrade tool was run on a lower version 64-bit
database.
**********************************************************************
--> If Target Oracle is 32-Bit, refer here for Update
Parameters:
-- No update parameter changes are required.
.
--> If Target Oracle is 64-Bit, refer here for Update
Parameters:
-- No update parameter changes are required.
.
**********************************************************************
Renamed Parameters: [Update Oracle Database 11.2 init.ora or
spfile]
**********************************************************************
-- No renamed parameters found. No changes are required.
.
**********************************************************************
Obsolete/Deprecated Parameters: [Update Oracle Database 11.2
init.ora or spfile]
**********************************************************************
--> background_dump_dest 11.1 DEPRECATED replaced by
"diagnostic_dest"
--> user_dump_dest 11.1 DEPRECATED replaced by
"diagnostic_dest"
.
**********************************************************************
-
Components: [The following database components will be upgraded
or installed]
**********************************************************************
--> Oracle Catalog Views [upgrade] VALID
--> Oracle Packages and Types [upgrade] VALID
--> JServer JAVA Virtual Machine [upgrade] VALID
--> Oracle XDK for Java [upgrade] VALID
--> Oracle Workspace Manager [upgrade] VALID
--> OLAP Analytic Workspace [upgrade] VALID
--> OLAP Catalog [upgrade] VALID
--> EM Repository [upgrade] VALID
--> Oracle Text [upgrade] VALID
--> Oracle XML Database [upgrade] VALID
--> Oracle Java Packages [upgrade] VALID
--> Oracle interMedia [upgrade] VALID
--> Spatial [upgrade] VALID
--> Data Mining [upgrade] VALID
--> Expression Filter [upgrade] VALID
--> Rule Manager [upgrade] VALID
--> Oracle OLAP API [upgrade] VALID
.
**********************************************************************
Miscellaneous Warnings
**********************************************************************
WARNING: --> Database is using a timezone file older than
version 14.
.... After the release migration, it is recommended that
DBMS_DST package
.... be used to upgrade the 10.2.0.4.0 database timezone
version
.... to the latest version which comes with the new release.
WARNING: --> EM Database Control Repository exists in the
database.
.... Direct downgrade of EM Database Control is not supported.
Refer to the
.... Upgrade Guide for instructions to save the EM data prior to
upgrade.
WARNING: --> Your recycle bin is turned on and currently
contains no objects.
.... Because it is REQUIRED that the recycle bin be empty prior
to upgrading
.... and your recycle bin is turned on, you may need to execute
the command:
PURGE DBA_RECYCLEBIN
.... prior to executing your upgrade to confirm the recycle bin
is empty.
.
**********************************************************************
Recommendations
**********************************************************************
Oracle recommends gathering dictionary statistics prior to
upgrading the database.
To gather dictionary statistics execute the following
command
while connected as SYSDBA:
EXECUTE dbms_stats.gather_dictionary_stats;
**********************************************************************
Oracle recommends reviewing any defined events prior to
upgrading.
To view existing non-default events execute the following
commands
while connected AS SYSDBA:
Events:
SELECT (translate(value,chr(13)||chr(10),' ')) FROM
sys.v$parameter2
WHERE UPPER(name) ='EVENT' AND isdefault='FALSE'
Trace Events:
SELECT (translate(value,chr(13)||chr(10),' ')) from
sys.v$parameter2
WHERE UPPER(name) = '_TRACE_EVENTS' AND isdefault='FALSE'
Changes will need to be made in the init.ora or spfile.
**********************************************************************
SQL>
-
Paso2: Backup Full con RMAN para la BBDD origen ( SRCDB ) El rea
escogida para almacenar los backups se situ en la siguiente ruta:
/tmp/DBS/BK [oracle@MyServer1]$ rman target /
Recovery Manager: Release 10.2.0.4.0 - Production on Tue Sep 4
19:24:14 2012
Copyright (c) 1982, 2005, Oracle. All rights reserved.
connected to target database: SRCDB (DBID=426962306)
RMAN> Backup Database format
'/tmp/DBS/BK/BKfull_SRCDB10g_%t_s%s_s%p.bkp';
Starting backup at 04-SEP-12
using target database control file instead of recovery
catalog
allocated channel: ORA_DISK_1
channel ORA_DISK_1: sid=141 devtype=DISK
channel ORA_DISK_1: starting full datafile backupset
channel ORA_DISK_1: specifying datafile(s) in backupset
input datafile fno=00001 name=/tmp/DBS/SRCDB/system01.dbf
input datafile fno=00002 name=/tmp/DBS/SRCDB/undotbs01.dbf
input datafile fno=00003 name=/tmp/DBS/SRCDB/sysaux01.dbf
input datafile fno=00004 name=/tmp/DBS/SRCDB/users01.dbf
input datafile fno=00005 name=/tmp/DBS/SRCDB/undotbs02.dbf
channel ORA_DISK_1: starting piece 1 at 04-SEP-12
channel ORA_DISK_1: finished piece 1 at 04-SEP-12
piece handle=/tmp/DBS/BK/BKfull_SRCDB10g_793135460_s2_s1.bkp
tag=TAG20120904T192420 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time:
00:01:15
Finished backup at 04-SEP-12
RMAN>
Paso3: Toma de Primer backup de Archives En la presente ejecucin
se respaldaron los archives existentes, los cuales estaban
generados hasta la secuencia 29. Si se desea visualizar los valores
de secuencias actuales para la instancia, podr realizarlo con el
comando ( SQL> Archive log list ) de sqlplus o a travs de las
vistas del diccionario de datos. Es importante activar la opcin
Autobackup en On para as obtener una copia del controlfile
posterior al backup de los archives. La opcin snapshot de RMAN esta
activa por defecto pero para el presenta caso tomaremos el backup
de controlfile producto del resultado del Autobackup. Originalmente
la opcin de autobackup de spfile & controlfile viene
desactivada tal como puede verse en el siguiente feedback: Paso3.1:
Visualizando feedback original de las opciones de RMAN
[oracle@MyServer1]$ rman target / Recovery Manager: Release
10.2.0.1.0 - Production on Tue Sep 4 19:15:01 2012 Copyright (c)
1982, 2005, Oracle. All rights reserved. connected to target
database: SRCDB (DBID=426962306) RMAN> show all;
-
using target database control file instead of recovery catalog
RMAN configuration parameters are: CONFIGURE RETENTION POLICY TO
REDUNDANCY 1; # default CONFIGURE BACKUP OPTIMIZATION OFF; #
default CONFIGURE DEFAULT DEVICE TYPE TO DISK; # default CONFIGURE
CONTROLFILE AUTOBACKUP OFF; # default CONFIGURE CONTROLFILE
AUTOBACKUP FORMAT FOR DEVICE TYPE DISK TO '%F'; # default CONFIGURE
DEVICE TYPE DISK PARALLELISM 1 BACKUP TYPE TO BACKUPSET; # default
CONFIGURE DATAFILE BACKUP COPIES FOR DEVICE TYPE DISK TO 1; #
default CONFIGURE ARCHIVELOG BACKUP COPIES FOR DEVICE TYPE DISK TO
1; # default CONFIGURE MAXSETSIZE TO UNLIMITED; # default CONFIGURE
ENCRYPTION FOR DATABASE OFF; # default CONFIGURE ENCRYPTION
ALGORITHM 'AES128'; # default CONFIGURE ARCHIVELOG DELETION POLICY
TO NONE; # default CONFIGURE SNAPSHOT CONTROLFILE NAME TO
'/u01/app/oracle/oracle/product/10.2.0/db_1/dbs/snapcf_SRCDB.f'; #
default Paso3.2: Estableciendo CONTROLFILE AUTOBACKUP en ON
RMAN> CONFIGURE CONTROLFILE AUTOBACKUP ON; new RMAN
configuration parameters: CONFIGURE CONTROLFILE AUTOBACKUP ON; new
RMAN configuration parameters are successfully stored Paso3.3:
Visualizando opcin CONTROLFILE AUTOBACKUP en ON establecida
RMAN> show all; RMAN configuration parameters are: CONFIGURE
RETENTION POLICY TO REDUNDANCY 1; # default CONFIGURE BACKUP
OPTIMIZATION OFF; # default CONFIGURE DEFAULT DEVICE TYPE TO DISK;
# default CONFIGURE CONTROLFILE AUTOBACKUP ON; CONFIGURE
CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE DISK TO '%F'; #
default CONFIGURE DEVICE TYPE DISK PARALLELISM 1 BACKUP TYPE TO
BACKUPSET; # default CONFIGURE DATAFILE BACKUP COPIES FOR DEVICE
TYPE DISK TO 1; # default CONFIGURE ARCHIVELOG BACKUP COPIES FOR
DEVICE TYPE DISK TO 1; # default CONFIGURE MAXSETSIZE TO UNLIMITED;
# default CONFIGURE ENCRYPTION FOR DATABASE OFF; # default
CONFIGURE ENCRYPTION ALGORITHM 'AES128'; # default CONFIGURE
ARCHIVELOG DELETION POLICY TO NONE; # default CONFIGURE SNAPSHOT
CONTROLFILE NAME TO
'/u01/app/oracle/oracle/product/10.2.0/db_1/dbs/snapcf_SRCDB.f'; #
default
-
Paso3.4: Primer Backup de Archive redo logs En la presente
ejecucin se visualiza el respaldo de los archives generados hasta
el momento los cuales van hasta la secuencia 29. La BBDD destino
ser recuperada originalmente hasta el archive 29. RMAN> Backup
Archivelog all format '/tmp/DBS/BK/BKArch_SRCDB10g_%t_s%s_s%p.bkp';
Starting backup at 04-SEP-12 current log archived using channel
ORA_DISK_1 channel ORA_DISK_1: starting archive log backupset
channel ORA_DISK_1: specifying archive log(s) in backup set input
archive log thread=1 sequence=23 recid=1 stamp=793134879 input
archive log thread=1 sequence=24 recid=2 stamp=793134879 input
archive log thread=1 sequence=25 recid=3 stamp=793135663 input
archive log thread=1 sequence=26 recid=4 stamp=793135665 input
archive log thread=1 sequence=27 recid=5 stamp=793135773 input
archive log thread=1 sequence=28 recid=6 stamp=793135848 input
archive log thread=1 sequence=29 recid=7 stamp=793135899 channel
ORA_DISK_1: starting piece 1 at 04-SEP-12 channel ORA_DISK_1:
finished piece 1 at 04-SEP-12 piece
handle=/tmp/DBS/BK/BKArch_SRCDB10g_793135900_s8_s1.bkp
tag=TAG20120904T193139 comment=NONE channel ORA_DISK_1: backup set
complete, elapsed time: 00:00:04 Finished backup at 04-SEP-12
Starting Control File and SPFILE Autobackup at 04-SEP-12 piece
handle=/u01/app/oracle/flash_recovery_area/SRCDB/autobackup/2012_09_04/o1_mf_s_793135904_84f7cjdp_.bkp
comment=NONE Finished Control File and SPFILE Autobackup at
04-SEP-12 RMAN> Piezas Generadas en el Servidor Origen
[oracle@eg7067 BK]$ ls -lt total 690472 -rw-r----- 1 oracle
oinstall 11776 Sep 4 19:35 BKArch_SRCDB10g_793136158_s10_s1.bkp
-rw-r----- 1 oracle oinstall 40363520 Sep 4 19:31
BKArch_SRCDB10g_793135900_s8_s1.bkp -rw-r----- 1 oracle oinstall
3072 Sep 4 19:30 BKArch_SRCDB10g_793135849_s6_s1.bkp -rw-r----- 1
oracle oinstall 665960448 Sep 4 19:25
BKfull_SRCDB10g_793135460_s2_s1.bkp [oracle@eg7067 BK]$
-
Transferencia al nodo1 del RAC La locacin escogida y construida
para alojar los backups en el nodo1 del RAC es: /tmp/for10gbackups
[oracle@eg7067 BK]$ scp * eg7346:/tmp/for10gbackups The
authenticity of host 'eg7346 (10.216.52.150)' can't be established.
RSA key fingerprint is
ab:33:1b:a6:89:53:ba:24:77:76:90:e2:7a:1c:79:11. Are you sure you
want to continue connecting (yes/no)? yes Warning: Permanently
added 'eg7346,10.216.52.150' (RSA) to the list of known hosts.
oracle@eg7346's password: BKArch_SRCDB10g_793135849_s6_s1.bkp 100%
3072 3.0KB/s 00:00 BKArch_SRCDB10g_793135900_s8_s1.bkp 100% 38MB
38.5MB/s 00:01 BKArch_SRCDB10g_793136158_s10_s1.bkp 100% 12KB
11.5KB/s 00:00 BKfull_SRCDB10g_793135460_s2_s1.bkp 100% 635MB
18.7MB/s 00:34 [oracle@eg7067 BK]$ [oracle@eg7067 BK]$
Transferencia de la pieza generada de autobackup De esta pieza
obtendremos el controlfile para iniciar la actividad de restore en
la BBDD destino. [oracle@eg7067 BK]$ scp
/u01/app/oracle/flash_recovery_area/SRCDB/autobackup/2012_09_04/o1_mf_s_793136160_84f7mjd5_.bkp
eg7346:/tmp/for10gbackups oracle@eg7346's password:
o1_mf_s_793136160_84f7mjd5_.bkp 100% 6976KB 6.8MB/s 00:01
[oracle@eg7067 BK]$ [oracle@eg7067 BK]$ Tareas previas para iniciar
el trabajo con la BBDD en RAC
Es recomendable remover los datafiles & redo logs originales
de la BBDD en RAC para que el espacio sea utilizado en forma
optima
El parmetro CLUSTER_DATABASE se establecer en FALSE. Esto se
lleva a cabo para operar la BBDD en modo exclusivo en el nodo1. En
la fase de recreacin automtica de redo logs se vera con mayor
detalle el porque la BBDD no puede ser operada desde el inicio en
RAC si los redo logs provienen de filesystem.
La instancia SRCDB2 permanecer cerrada durante todo el ejercicio
de restauracin y/o recuperacin. Visualizando las rutas establecidas
de los controlfiles A partir de este momento iniciamos el trabajo
en la BBDD en RAC. Tal cual como fue expresado al principio del
articulo. La BBDD en RAC fue creada a travs del DBCA con opciones
regulares para cualquier BBDD en RAC. [oracle@eg7346
for10gbackups]$ export ORACLE_SID=SRCDB1 [oracle@eg7346
for10gbackups]$ [oracle@eg7346 for10gbackups]$ sqlplus / as
sysdba
-
SQL*Plus: Release 11.2.0.3.0 - Production on Tue Sep 4 19:46:30
2012 Copyright (c) 1982, 2007, Oracle. All rights reserved.
Connected to: Oracle Database 11g Enterprise Edition Release
11.2.0.3.0 - Production With the Partitioning, Real Application
Clusters, OLAP, Data Mining and Real Application Testing options
SQL> SQL> show parameters control_files
NAME TYPE VALUE
------------------------------------
--------------------------------- --------------------
control_files string
+DATA/srcdb/controlfile/current.275.793134791,+FRA/srcdb/controlfile/current.282.79313479
Paso5: Restaurado de Controlfiles La pieza generada producto del
autobackup es utilizada para restaurar los controlfiles de la BBDD
en RAC.
[oracle@MyRACSrv1 ~]$ rman target /
Recovery Manager: Release 11.2.0.3.0 - Production on Fri Sep 7
16:17:22 2012
Copyright (c) 1982, 2007, Oracle. All rights reserved.
connected to target database: SRCDB (not mounted)
RMAN> restore controlfile from
2> '/tmp/for10gbackups/o1_mf_s_793136160_84f7mjd5_.bkp';
Starting restore at 07-SEP-12
using target database control file instead of recovery
catalog
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=170 device type=DISK
channel ORA_DISK_1: restoring control file
channel ORA_DISK_1: restore complete, elapsed time: 00:00:01
output file
name=+DATA/srcdb/controlfile/current.275.793134791
output file name=+FRA/srcdb/controlfile/current.282.79313479
Finished restore at 07-SEP-12
RMAN>
Estableciendo la instancia1 ( SRCDB1 ) modo mount Una vez que se
han reestablecidos los controlfiles, establecemos la BBDD en modo
mount para iniciar las actividades de restauracin y recuperacin.
SQL> shutdown abort ORACLE instance shut down. SQL> SQL>
startup mount ORACLE instance started.
-
Total System Global Area 673763328 bytes Fixed Size 1302036
bytes Variable Size 415236588 bytes Database Buffers 251658240
bytes Redo Buffers 5566464 bytes Database mounted. SQL> Paso6:
Ajustando informacin de Backups en controlfiles de la BBDD en RAC
Aca se podr apreciar que los controlfiles restaurados poseen
naturalmente la referencia de los backups realizados por la BBDD
10g. Para el presente caso la ruta donde se encuentra el backup
full y de archives en el nodo1, no es la misma ruta en la cual se
obtuvieron los backups en el servidor original. Por lo tanto hay
que realizar ajustes al respecto. Si los backups se encuentran en
cinta el tratamiento es distinto. Paso6.1: Listando backups SQL>
ho rman target / Recovery Manager: Release 11.2.0.3.0 - Production
on Tue Sep 4 19:56:11 2012 Copyright (c) 1982, 2007, Oracle. All
rights reserved. connected to target database: SRCDB
(DBID=426962306, not open) RMAN> List Backup; using target
database control file instead of recovery catalog List of Backup
Sets =================== BS Key Type LV Size Device Type Elapsed
Time Completion Time ------- ---- -- ---------- -----------
------------ --------------- 1 Full 635.10M DISK 00:01:07 04-SEP-12
BP Key: 1 Status: AVAILABLE Compressed: NO Tag: TAG20120904T192420
Piece Name: /tmp/DBS/BK/BKfull_SRCDB10g_793135460_s2_s1.bkp List of
Datafiles in backup set 1 File LV Type Ckp SCN Ckp Time Name ----
-- ---- ---------- --------- ---- 1 Full 339859 04-SEP-12
/tmp/DBS/SRCDB/system01.dbf 2 Full 339859 04-SEP-12
/tmp/DBS/SRCDB/undotbs01.dbf 3 Full 339859 04-SEP-12
/tmp/DBS/SRCDB/sysaux01.dbf 4 Full 339859 04-SEP-12
/tmp/DBS/SRCDB/users01.dbf 5 Full 339859 04-SEP-12
/tmp/DBS/SRCDB/undotbs02.dbf BS Key Type LV Size Device Type
Elapsed Time Completion Time ------- ---- -- ---------- -----------
------------ --------------- 2 Full 6.80M DISK 00:00:01
04-SEP-12
-
BP Key: 2 Status: AVAILABLE Compressed: NO Tag:
TAG20120904T192536 Piece Name:
/u01/app/oracle/flash_recovery_area/SRCDB/autobackup/2012_09_04/o1_mf_s_793135536_84f701sg_.bkp
SPFILE Included: Modification time: 04-SEP-12 Control File
Included: Ckp SCN: 339888 Ckp time: 04-SEP-12 BS Key Size Device
Type Elapsed Time Completion Time ------- ---------- -----------
------------ --------------- 3 38.49M DISK 00:00:03 04-SEP-12 BP
Key: 3 Status: AVAILABLE Compressed: NO Tag: TAG20120904T192934
Piece Name:
/u01/app/oracle/flash_recovery_area/SRCDB/backupset/2012_09_04/o1_mf_annnn_TAG20120904T192934_84f77hp8_.bkp
List of Archived Logs in backup set 3 Thrd Seq Low SCN Low Time
Next SCN Next Time ---- ------- ---------- --------- ----------
--------- 1 23 317904 04-SEP-12 339533 04-SEP-12 1 24 339533
04-SEP-12 339535 04-SEP-12 1 25 339535 04-SEP-12 339966 04-SEP-12 1
26 339966 04-SEP-12 339968 04-SEP-12 1 27 339968 04-SEP-12 340442
04-SEP-12 BS Key Type LV Size Device Type Elapsed Time Completion
Time ------- ---- -- ---------- ----------- ------------
--------------- 4 Full 6.80M DISK 00:00:01 04-SEP-12 BP Key: 4
Status: AVAILABLE Compressed: NO Tag: TAG20120904T192938 Piece
Name:
/u01/app/oracle/flash_recovery_area/SRCDB/autobackup/2012_09_04/o1_mf_s_793135778_84f77m4r_.bkp
SPFILE Included: Modification time: 04-SEP-12 Control File
Included: Ckp SCN: 340450 Ckp time: 04-SEP-12 BS Key Size Device
Type Elapsed Time Completion Time ------- ---------- -----------
------------ --------------- 5 2.50K DISK 00:00:01 04-SEP-12 BP
Key: 5 Status: AVAILABLE Compressed: NO Tag: TAG20120904T193048
Piece Name: /tmp/DBS/BK/BKArch_SRCDB10g_793135849_s6_s1.bkp List of
Archived Logs in backup set 5 Thrd Seq Low SCN Low Time Next SCN
Next Time ---- ------- ---------- --------- ---------- --------- 1
28 340442 04-SEP-12 340483 04-SEP-12 BS Key Type LV Size Device
Type Elapsed Time Completion Time ------- ---- -- ----------
----------- ------------ --------------- 6 Full 6.80M DISK 00:00:00
04-SEP-12 BP Key: 6 Status: AVAILABLE Compressed: NO Tag:
TAG20120904T193051 Piece Name:
/u01/app/oracle/flash_recovery_area/SRCDB/autobackup/2012_09_04/o1_mf_s_793135851_84f79vl5_.bkp
SPFILE Included: Modification time: 04-SEP-12 Control File
Included: Ckp SCN: 340489 Ckp time: 04-SEP-12
-
BS Key Size Device Type Elapsed Time Completion Time -------
---------- ----------- ------------ --------------- 7 38.49M DISK
00:00:02 04-SEP-12 BP Key: 7 Status: AVAILABLE Compressed: NO Tag:
TAG20120904T193139 Piece Name:
/tmp/DBS/BK/BKArch_SRCDB10g_793135900_s8_s1.bkp List of Archived
Logs in backup set 7 Thrd Seq Low SCN Low Time Next SCN Next Time
---- ------- ---------- --------- ---------- --------- 1 23 317904
04-SEP-12 339533 04-SEP-12 1 24 339533 04-SEP-12 339535 04-SEP-12 1
25 339535 04-SEP-12 339966 04-SEP-12 1 26 339966 04-SEP-12 339968
04-SEP-12 1 27 339968 04-SEP-12 340442 04-SEP-12 1 28 340442
04-SEP-12 340483 04-SEP-12 1 29 340483 04-SEP-12 340524 04-SEP-12
BS Key Type LV Size Device Type Elapsed Time Completion Time
------- ---- -- ---------- ----------- ------------ ---------------
8 Full 6.80M DISK 00:00:00 04-SEP-12 BP Key: 8 Status: AVAILABLE
Compressed: NO Tag: TAG20120904T193144 Piece Name:
/u01/app/oracle/flash_recovery_area/SRCDB/autobackup/2012_09_04/o1_mf_s_793135904_84f7cjdp_.bkp
SPFILE Included: Modification time: 04-SEP-12 Control File
Included: Ckp SCN: 340531 Ckp time: 04-SEP-12 BS Key Size Device
Type Elapsed Time Completion Time ------- ---------- -----------
------------ --------------- 9 11.00K DISK 00:00:01 04-SEP-12 BP
Key: 9 Status: AVAILABLE Compressed: NO Tag: TAG20120904T193557
Piece Name: /tmp/DBS/BK/BKArch_SRCDB10g_793136158_s10_s1.bkp List
of Archived Logs in backup set 9 Thrd Seq Low SCN Low Time Next SCN
Next Time ---- ------- ---------- --------- ---------- --------- 1
30 340524 04-SEP-12 340614 04-SEP-12 1 31 340614 04-SEP-12 340651
04-SEP-12 RMAN> Paso6.2: Crosscheck de Backups Los backups
referenciados no se encuentran en las mismas rutas en el presente
servidor. Por lo tanto aplicaremos un crosscheck para que los
mismos se establezcan en estatus de expirados. RMAN> crosscheck
backup; Starting implicit crosscheck backup at 04-SEP-12 allocated
channel: ORA_DISK_1 channel ORA_DISK_1: SID=143 device
type=DISK
-
Crosschecked 9 objects Finished implicit crosscheck backup at
04-SEP-12 Starting implicit crosscheck copy at 04-SEP-12 using
channel ORA_DISK_1 Finished implicit crosscheck copy at 04-SEP-12
searching for all files in the recovery area cataloging files... no
files cataloged using channel ORA_DISK_1 crosschecked backup piece:
found to be 'EXPIRED' backup piece
handle=/tmp/DBS/BK/BKfull_SRCDB10g_793135460_s2_s1.bkp RECID=1
STAMP=793135460 crosschecked backup piece: found to be 'EXPIRED'
backup piece
handle=/u01/app/oracle/flash_recovery_area/SRCDB/autobackup/2012_09_04/o1_mf_s_793135536_84f701sg_.bkp
RECID=2 STAMP=793135537 crosschecked backup piece: found to be
'EXPIRED' backup piece
handle=/u01/app/oracle/flash_recovery_area/SRCDB/backupset/2012_09_04/o1_mf_annnn_TAG20120904T192934_84f77hp8_.bkp
RECID=3 STAMP=793135775 crosschecked backup piece: found to be
'EXPIRED' backup piece
handle=/u01/app/oracle/flash_recovery_area/SRCDB/autobackup/2012_09_04/o1_mf_s_793135778_84f77m4r_.bkp
RECID=4 STAMP=793135779 crosschecked backup piece: found to be
'EXPIRED' backup piece
handle=/tmp/DBS/BK/BKArch_SRCDB10g_793135849_s6_s1.bkp RECID=5
STAMP=793135850 crosschecked backup piece: found to be 'EXPIRED'
backup piece
handle=/u01/app/oracle/flash_recovery_area/SRCDB/autobackup/2012_09_04/o1_mf_s_793135851_84f79vl5_.bkp
RECID=6 STAMP=793135851 crosschecked backup piece: found to be
'EXPIRED' backup piece
handle=/tmp/DBS/BK/BKArch_SRCDB10g_793135900_s8_s1.bkp RECID=7
STAMP=793135901 crosschecked backup piece: found to be 'EXPIRED'
backup piece
handle=/u01/app/oracle/flash_recovery_area/SRCDB/autobackup/2012_09_04/o1_mf_s_793135904_84f7cjdp_.bkp
RECID=8 STAMP=793135904 crosschecked backup piece: found to be
'EXPIRED' backup piece
handle=/tmp/DBS/BK/BKArch_SRCDB10g_793136158_s10_s1.bkp RECID=9
STAMP=793136159 Crosschecked 9 objects Paso6.3: Eliminando la
referencia de Backups con estatus Expired RMAN> delete expired
backup; using channel ORA_DISK_1 List of Backup Pieces BP Key BS
Key Pc# Cp# Status Device Type Piece Name ------- ------- --- ---
----------- ----------- ----------
-
1 1 1 1 EXPIRED DISK
/tmp/DBS/BK/BKfull_SRCDB10g_793135460_s2_s1.bkp 2 2 1 1 EXPIRED
DISK
/u01/app/oracle/flash_recovery_area/SRCDB/autobackup/2012_09_04/o1_mf_s_793135536_84f701sg_.bkp
3 3 1 1 EXPIRED DISK
/u01/app/oracle/flash_recovery_area/SRCDB/backupset/2012_09_04/o1_mf_annnn_TAG20120904T192934_84f77hp8_.bkp
4 4 1 1 EXPIRED DISK
/u01/app/oracle/flash_recovery_area/SRCDB/autobackup/2012_09_04/o1_mf_s_793135778_84f77m4r_.bkp
5 5 1 1 EXPIRED DISK
/tmp/DBS/BK/BKArch_SRCDB10g_793135849_s6_s1.bkp 6 6 1 1 EXPIRED
DISK
/u01/app/oracle/flash_recovery_area/SRCDB/autobackup/2012_09_04/o1_mf_s_793135851_84f79vl5_.bkp
7 7 1 1 EXPIRED DISK
/tmp/DBS/BK/BKArch_SRCDB10g_793135900_s8_s1.bkp 8 8 1 1 EXPIRED
DISK
/u01/app/oracle/flash_recovery_area/SRCDB/autobackup/2012_09_04/o1_mf_s_793135904_84f7cjdp_.bkp
9 9 1 1 EXPIRED DISK
/tmp/DBS/BK/BKArch_SRCDB10g_793136158_s10_s1.bkp Do you really want
to delete the above objects (enter YES or NO)? YES deleted backup
piece backup piece
handle=/tmp/DBS/BK/BKfull_SRCDB10g_793135460_s2_s1.bkp RECID=1
STAMP=793135460 deleted backup piece backup piece
handle=/u01/app/oracle/flash_recovery_area/SRCDB/autobackup/2012_09_04/o1_mf_s_793135536_84f701sg_.bkp
RECID=2 STAMP=793135537 deleted backup piece backup piece
handle=/u01/app/oracle/flash_recovery_area/SRCDB/backupset/2012_09_04/o1_mf_annnn_TAG20120904T192934_84f77hp8_.bkp
RECID=3 STAMP=793135775 deleted backup piece backup piece
handle=/u01/app/oracle/flash_recovery_area/SRCDB/autobackup/2012_09_04/o1_mf_s_793135778_84f77m4r_.bkp
RECID=4 STAMP=793135779 deleted backup piece backup piece
handle=/tmp/DBS/BK/BKArch_SRCDB10g_793135849_s6_s1.bkp RECID=5
STAMP=793135850 deleted backup piece backup piece
handle=/u01/app/oracle/flash_recovery_area/SRCDB/autobackup/2012_09_04/o1_mf_s_793135851_84f79vl5_.bkp
RECID=6 STAMP=793135851 deleted backup piece backup piece
handle=/tmp/DBS/BK/BKArch_SRCDB10g_793135900_s8_s1.bkp RECID=7
STAMP=793135901 deleted backup piece backup piece
handle=/u01/app/oracle/flash_recovery_area/SRCDB/autobackup/2012_09_04/o1_mf_s_793135904_84f7cjdp_.bkp
RECID=8 STAMP=793135904 deleted backup piece backup piece
handle=/tmp/DBS/BK/BKArch_SRCDB10g_793136158_s10_s1.bkp RECID=9
STAMP=793136159 Deleted 9 EXPIRED objects Paso6.4: Referencias de
Backups eliminadas Una vez realizado el paso 6.3. Los controlfiles
quedan sin ninguna referencia de algn backup
-
RMAN> List Backup; Paso6.5: Catalogando RMAN backups
Catalogaremos los backups que se transfirieron al nodo1. RMAN>
Catalog start with '/tmp/for10gbackups'; searching for all files
that match the pattern /tmp/for10gbackups List of Files Unknown to
the Database ===================================== File Name:
/tmp/for10gbackups/BKfull_SRCDB10g_793135460_s2_s1.bkp File Name:
/tmp/for10gbackups/o1_mf_s_793136160_84f7mjd5_.bkp File Name:
/tmp/for10gbackups/BKArch_SRCDB10g_793135900_s8_s1.bkp File Name:
/tmp/for10gbackups/BKArch_SRCDB10g_793135849_s6_s1.bkp Do you
really want to catalog the above files (enter YES or NO)? YES
cataloging files... cataloging done List of Cataloged Files
======================= File Name:
/tmp/for10gbackups/BKfull_SRCDB10g_793135460_s2_s1.bkp File Name:
/tmp/for10gbackups/o1_mf_s_793136160_84f7mjd5_.bkp File Name:
/tmp/for10gbackups/BKArch_SRCDB10g_793135900_s8_s1.bkp File Name:
/tmp/for10gbackups/BKArch_SRCDB10g_793135849_s6_s1.bkp RMAN>
Paso7: Borrando los datafiles de la BBDD Es recomendable remover
los datafiles para evitar uso ineficiente del espacio a ser ocupado
por los datafiles nuevos. [oracle@MyRACSrv1]$ asmcmd ASMCMD>
ASMCMD> cd data ASMCMD> ls -lt Type Redund Striped Time Sys
Name Y SRCDB/ ASMCMD> ASMCMD> cd srcdb ASMCMD> ASMCMD>
ls -lt Type Redund Striped Time Sys Name Y TEMPFILE/ Y
PARAMETERFILE/ Y ONLINELOG/ Y DATAFILE/ Y CONTROLFILE/
-
N spfileSRCDB.ora =>
+DATA/SRCDB/PARAMETERFILE/spfile.282.793134923 ASMCMD>
ASMCMD> cd datafile ASMCMD> ASMCMD> ls -lt Type Redund
Striped Time Sys Name DATAFILE MIRROR COARSE SEP 04 19:00:00 Y
USERS.274.793134671 DATAFILE MIRROR COARSE SEP 04 19:00:00 Y
UNDOTBS2.279.793134849 DATAFILE MIRROR COARSE SEP 04 19:00:00 Y
UNDOTBS1.273.793134671 DATAFILE MIRROR COARSE SEP 04 19:00:00 Y
SYSTEM.271.793134669 DATAFILE MIRROR COARSE SEP 04 19:00:00 Y
SYSAUX.272.793134669 ASMCMD> ASMCMD> rm * You may delete
multiple files and/or directories. Are you sure? (y/n) y ASMCMD>
ASMCMD> Paso8: Recuperacion Inicial hasta el archive 29 El
primer backup de archives comprende un backupset el cual contiene
archives hasta la secuencia 29. Por lo tanto esa ser la primera
secuencia hasta la cual recuperaremos la BBDD. run { allocate
channel ch1 device type disk; SET NEWNAME FOR DATAFILE 1 TO
'+DATA'; SET NEWNAME FOR DATAFILE 2 TO '+DATA'; SET NEWNAME FOR
DATAFILE 3 TO '+DATA'; SET NEWNAME FOR DATAFILE 4 TO '+DATA'; SET
NEWNAME FOR TEMPFILE 1 TO '+DATA'; restore database; switch
datafile all; recover database until sequence 29; } RMAN> run
2> { allocate channel ch1 device type disk; 3> 4> SET
NEWNAME FOR DATAFILE 1 TO '+DATA'; SET NEWNAME FOR DATAFILE 2 TO
'+DATA'; 5> 6> SET NEWNAME FOR DATAFILE 3 TO '+DATA'; 7>
SET NEWNAME FOR DATAFILE 4 TO '+DATA'; 8> SET NEWNAME FOR
TEMPFILE 1 TO '+DATA'; restore database until sequence 29; switch
datafile all; 9> 10> 11> recover database until sequence
29; }12> released channel: ORA_DISK_1 allocated channel: ch1
-
channel ch1: SID=143 device type=DISK executing command: SET
NEWNAME executing command: SET NEWNAME executing command: SET
NEWNAME executing command: SET NEWNAME executing command: SET
NEWNAME Starting restore at 04-SEP-12 channel ch1: starting
datafile backup set restore channel ch1: specifying datafile(s) to
restore from backup set channel ch1: restoring datafile 00001 to
+DATA channel ch1: restoring datafile 00002 to +DATA channel ch1:
restoring datafile 00003 to +DATA channel ch1: restoring datafile
00004 to +DATA channel ch1: reading from backup piece
/tmp/for10gbackups/BKfull_SRCDB10g_793135460_s2_s1.bkp channel ch1:
piece handle=/tmp/for10gbackups/BKfull_SRCDB10g_793135460_s2_s1.bkp
tag=TAG20120904T192420 channel ch1: restored backup piece 1 channel
ch1: restore complete, elapsed time: 00:00:35 Finished restore at
04-SEP-12 datafile 1 switched to datafile copy input datafile copy
RECID=5 STAMP=793138127 file
name=+DATA/srcdb/datafile/system.279.793138093 datafile 2 switched
to datafile copy input datafile copy RECID=6 STAMP=793138127 file
name=+DATA/srcdb/datafile/undotbs1.274.793138093 datafile 3
switched to datafile copy input datafile copy RECID=7
STAMP=793138127 file name=+DATA/srcdb/datafile/sysaux.273.793138093
datafile 4 switched to datafile copy input datafile copy RECID=8
STAMP=793138128 file name=+DATA/srcdb/datafile/users.272.793138093
datafile 5 switched to datafile copy input datafile copy RECID=8
STAMP=793138128 file
name=+DATA/srcdb/datafile/undotbs2.272.793138093 Starting recover
at 04-SEP-12 starting media recovery channel ch1: starting archived
log restore to default destination channel ch1: restoring archived
log archived log thread=1 sequence=25 channel ch1: restoring
archived log archived log thread=1 sequence=26 channel ch1:
restoring archived log archived log thread=1 sequence=27 channel
ch1: restoring archived log archived log thread=1 sequence=28
-
channel ch1: reading from backup piece
/tmp/for10gbackups/BKArch_SRCDB10g_793135900_s8_s1.bkp channel ch1:
piece handle=/tmp/for10gbackups/BKArch_SRCDB10g_793135900_s8_s1.bkp
tag=TAG20120904T193139 channel ch1: restored backup piece 1 channel
ch1: restore complete, elapsed time: 00:00:01 archived log file
name=+FRA/srcdb/archivelog/2012_09_04/thread_1_seq_25.357.793138131
thread=1 sequence=25 channel default: deleting archived log(s)
archived log file
name=+FRA/srcdb/archivelog/2012_09_04/thread_1_seq_25.357.793138131
RECID=13 STAMP=793138132 archived log file
name=+FRA/srcdb/archivelog/2012_09_04/thread_1_seq_26.281.793138131
thread=1 sequence=26 channel default: deleting archived log(s)
archived log file
name=+FRA/srcdb/archivelog/2012_09_04/thread_1_seq_26.281.793138131
RECID=12 STAMP=793138131 archived log file
name=+FRA/srcdb/archivelog/2012_09_04/thread_1_seq_27.420.793138131
thread=1 sequence=27 channel default: deleting archived log(s)
archived log file
name=+FRA/srcdb/archivelog/2012_09_04/thread_1_seq_27.420.793138131
RECID=10 STAMP=793138131 archived log file
name=+FRA/srcdb/archivelog/2012_09_04/thread_1_seq_28.412.793138131
thread=1 sequence=28 channel default: deleting archived log(s)
archived log file
name=+FRA/srcdb/archivelog/2012_09_04/thread_1_seq_28.412.793138131
RECID=11 STAMP=793138131 media recovery complete, elapsed time:
00:00:01 Finished recover at 04-SEP-12 released channel: ch1
RMAN> Paso 9: Toma de Segundo backup de Archives La BBDD origen
esta abierta y generando archives. La tcnica de Rolling Upgrade que
llevaremos a cabo estar basada en la capacidad de tomar backups de
archives de la BBDD origen en la medida en que se vayan generando e
ir aplicando los mismos a la BBDD destino en forma progresiva tal
como si se tratase de un Manual Standby Database. Para no tomar
backup de los Archives que ya fueron respaldados, activamos la
opcin ( CONFIGURE BACKUP OPTIMIZATION ) de RMAN. La cual asegura el
no respaldo de una pieza que ya ha sido respaldada. Con esta opcin
podremos obtener un diferencial perfecto de Archive redo logs no
respaldados. Paso 9.1: Establecimiento de opcin RMAN ( CONFIGURE
BACKUP OPTIMIZATION ) RMAN> CONFIGURE BACKUP OPTIMIZATION ON;
new RMAN configuration parameters: CONFIGURE BACKUP OPTIMIZATION
ON; new RMAN configuration parameters are successfully stored Paso
9.2: Realizando segundo backup de Archive redo logs
-
A travs de la opcin establecida, RMAN ignora los archives ya
respaldados. Respaldando as los que no han sido respaldados. Estos
van de la secuencia 30 a la 31. RMAN> Backup Archivelog all
format '/tmp/DBS/BK/BKArch_SRCDB10g_%t_s%s_s%p.bkp'; Starting
backup at 04-SEP-12 current log archived allocated channel:
ORA_DISK_1 channel ORA_DISK_1: sid=141 devtype=DISK skipping
archive log file
/u01/app/oracle/flash_recovery_area/SRCDB/archivelog/2012_09_04/o1_mf_1_23_84f6cfj2_.arc;
already backed up 1 time(s) skipping archive log file
/u01/app/oracle/flash_recovery_area/SRCDB/archivelog/2012_09_04/o1_mf_1_24_84f6ch9s_.arc;
already backed up 1 time(s) skipping archive log file
/u01/app/oracle/flash_recovery_area/SRCDB/archivelog/2012_09_04/o1_mf_1_25_84f73zkc_.arc;
already backed up 1 time(s) skipping archive log file
/u01/app/oracle/flash_recovery_area/SRCDB/archivelog/2012_09_04/o1_mf_1_26_84f7418y_.arc;
already backed up 1 time(s) skipping archive log file
/u01/app/oracle/flash_recovery_area/SRCDB/archivelog/2012_09_04/o1_mf_1_27_84f77foz_.arc;
already backed up 1 time(s) skipping archive log file
/u01/app/oracle/flash_recovery_area/SRCDB/archivelog/2012_09_04/o1_mf_1_28_84f79rxf_.arc;
already backed up 1 time(s) skipping archive log file
/u01/app/oracle/flash_recovery_area/SRCDB/archivelog/2012_09_04/o1_mf_1_29_84f7ccpj_.arc;
already backed up 1 time(s) channel ORA_DISK_1: starting archive
log backupset channel ORA_DISK_1: specifying archive log(s) in
backup set input archive log thread=1 sequence=30 recid=8
stamp=793136103 input archive log thread=1 sequence=31 recid=9
stamp=793136157 channel ORA_DISK_1: starting piece 1 at 04-SEP-12
channel ORA_DISK_1: finished piece 1 at 04-SEP-12 piece
handle=/tmp/DBS/BK/BKArch_SRCDB10g_793136158_s10_s1.bkp
tag=TAG20120904T193557 comment=NONE channel ORA_DISK_1: backup set
complete, elapsed time: 00:00:02 Finished backup at 04-SEP-12
Starting Control File and SPFILE Autobackup at 04-SEP-12 piece
handle=/u01/app/oracle/flash_recovery_area/SRCDB/autobackup/2012_09_04/o1_mf_s_793136160_84f7mjd5_.bkp
comment=NONE Finished Control File and SPFILE Autobackup at
04-SEP-12 RMAN>
-
Paso10: Segunda Recuperacion As tal como llevamos a cabo esta
segunda recuperacin. As podremos realizar tantas recuperaciones
como deseemos, con el objetivo de ir aplicando los archives
generados en la nueva BBDD de produccin en RAC. Esta es la tcnica
principal que describe la concepcin de realizar un Rolling Upgrade
con RMAN entre BBDD 10gR2 Single Instance y una BBDD 11gR2 e RAC.
Paso10.1: Transferencia de Segundo backupset de Archives generado
Solo para hacer notar en manera fehaciente la aplicacin del segundo
backup de archives. Cambiamos la ruta destino para el mismo. En
esta ocasin lo almacenaremos en la ruta:
/tmp/for10gbackups/for2ndrecover [oracle@eg7067 BK]$ scp *s10*
eg7346:/tmp/for10gbackups/for2ndrecover oracle@eg7346's password:
BKArch_SRCDB10g_793136158_s10_s1.bkp 100% 12KB 11.5KB/s 00:00
[oracle@eg7067 BK]$ [oracle@eg7067 BK]$ Paso10.2: Catalogando el
Segundo backupset de archives RMAN> Catalog Start with
'/tmp/for10gbackups/for2ndrecover'; searching for all files that
match the pattern /tmp/for10gbackups/for2ndrecover List of Files
Unknown to the Database ===================================== File
Name:
/tmp/for10gbackups/for2ndrecover/BKArch_SRCDB10g_793136158_s10_s1.bkp
Do you really want to catalog the above files (enter YES or NO)?
YES cataloging files... cataloging done List of Cataloged Files
======================= File Name:
/tmp/for10gbackups/for2ndrecover/BKArch_SRCDB10g_793136158_s10_s1.bkp
RMAN> Paso11: Recuperacin del Segundo backupset de archives run
{ allocate channel ch2 device type disk; recover database until
sequence 31; } RMAN> run { allocate channel ch2 device type
disk;
-
recover database until sequence 31; }2> 3> 4> 5>
allocated channel: ch2 channel ch2: SID=143 device type=DISK
Starting recover at 04-SEP-12 starting media recovery channel ch2:
starting archived log restore to default destination channel ch2:
restoring archived log archived log thread=1 sequence=29 channel
ch2: reading from backup piece
/tmp/for10gbackups/BKArch_SRCDB10g_793135900_s8_s1.bkp channel ch2:
piece handle=/tmp/for10gbackups/BKArch_SRCDB10g_793135900_s8_s1.bkp
tag=TAG20120904T193139 channel ch2: restored backup piece 1 channel
ch2: restore complete, elapsed time: 00:00:02 archived log file
name=+FRA/srcdb/archivelog/2012_09_04/thread_1_seq_29.412.793138495
thread=1 sequence=29 channel default: deleting archived log(s)
archived log file
name=+FRA/srcdb/archivelog/2012_09_04/thread_1_seq_29.412.793138495
RECID=14 STAMP=793138494 channel ch2: starting archived log restore
to default destination channel ch2: restoring archived log archived
log thread=1 sequence=30 channel ch2: reading from backup piece
/tmp/for10gbackups/for2ndrecover/BKArch_SRCDB10g_793136158_s10_s1.bkp
channel ch2: piece
handle=/tmp/for10gbackups/for2ndrecover/BKArch_SRCDB10g_793136158_s10_s1.bkp
tag=TAG20120904T193557 channel ch2: restored backup piece 1 channel
ch2: restore complete, elapsed time: 00:00:01 archived log file
name=+FRA/srcdb/archivelog/2012_09_04/thread_1_seq_30.412.793138497
thread=1 sequence=30 channel default: deleting archived log(s)
archived log file
name=+FRA/srcdb/archivelog/2012_09_04/thread_1_seq_30.412.793138497
RECID=15 STAMP=793138495 media recovery complete, elapsed time:
00:00:00 Finished recover at 04-SEP-12 released channel: ch2
RMAN> Paso12: Aperturando la BBDD Si la BBDD 10g posee los Redo
Log groups en filesystems, tal cual es el caso presente, entonces
debemos asegurarnos de poseer esa ruta en el nodo1 para que la BBDD
pueda aperturarse sin problema alguno en modo resetlogs. Recordando
que cuando una BBDD se apertura en modo resetlogs, los mismos son
reconstruidos. La BBDD con la cual estamos trabajando es una BBDD
en RAC pero para esta fase inicial es tratada en como si fuera una
BBDD single debido a que el parmetro CLUSTER_DATABASE=false y los
redo logs se reconstruirn
-
inicialmente en filesystem en una ruta que no es compartida por
ambos nodos. Si la BBDD original posee sus redo log groups en ASM y
dichos Diskgroups existe en la actual instalacin 11g, entonces no
habr que realizar gestin alguna sobre estos. Si as fuese el caso
entonces se recomienda crear en la BBDD 10g, los redo log groups
para el thread 2 ( thread habitual para la instancia2 en una BBDD
en RAC ) y activar el mismo. De esa forma los redo log groups para
los ambos threads estaran conformados. Paso12.1: Creando directorio
para creacion automatica de Redo Log Groups Esta informacin se
determina consultando la ruta de los redo log groups en la BBDD
10g. Dicha informacin se podra obtener a travs siguiente SQL
Statement ( select member from v$logfile ) [oracle@MyRACSrv1 joel]$
mkdir -p /u01/app1/oracle/oradata/SRCDB/ Llegado el momento de
aperturar la BBDD, la misma debe llevarse a cabo de la siguiente
manera:
En modo Upgrade debido a que el manejador es de versin superior
respecto a la versin del catalogo que posee internamente la
BBDD
La misma debe aperturarse en modo exclusivo solo por una
instancia. Para el presente caso, la instancia 1 ( SRCDB1 ). No se
puede aperturar la BBDD en modo upgrade con opcin
CLUSTER_DATABASE=true. Si se intentara dicha operacin, obtendramos
un mensaje en el alert log como el siguiente:
ORA-39701: database must be mounted EXCLUSIVE for UPGRADE or
DOWNGRADE Error 39701 happened during db open, shutting down
database USER (ospid: 1569): terminating the instance due to error
39701
Paso12.2: Aperturando en modo Upgrade [oracle@MyRACSrv1 joel]$
sqlplus / as sysdba SQL*Plus: Release 11.2.0.3.0 - Production on
Fri Sep 7 16:48:49 2012 Copyright (c) 1982, 2007, Oracle. All
rights reserved. Connected to: Oracle Database 11g Enterprise
Edition Release 11.2.0.3.0 - Production With the Partitioning, Real
Application Clusters, OLAP, Data Mining and Real Application
Testing options SQL> alter database open resetlogs upgrade;
Database altered. SQL> Paso13: Ajustando Redo Log Groups
Paso13.1: Consultando los miembros de Redo Log Groups
existentes
-
SQL> select member from v$logfile; MEMBER
--------------------------------------------------------------------------------
/u01/app1/oracle/oradata/SRCDB/redo01.log
/u01/app1/oracle/oradata/SRCDB/redo02.log
/u01/app1/oracle/oradata/SRCDB/redo03.log Paso13.2: Construyendo
Redo Log Groups para BBDD RAC en ASM A nivel de Server Parameter
file ( spfile ) se encuentra un parmetro que designa la locacin por
defecto para la construccin de Redo Log groups. Es por ello que
construimos los mismos sin asignarle locacin. Se deben crear al
menos 2 Redo Log groups por thread tal como se puede apreciar.
SQL> ALTER DATABASE ADD LOGFILE THREAD 1 group 4 size 100m;
SQL> ALTER DATABASE ADD LOGFILE THREAD 1 group 5 size 100m;
SQL> ALTER DATABASE ADD LOGFILE THREAD 2 group 6 size 100m;
SQL> ALTER DATABASE ADD LOGFILE THREAD 2 group 7 size 100m; Una
vez realizado esto este paso, podemos realizar switchs On demand de
archives, con el objetivo de que el redo log group current se
establezca en algn miembro de los redo log groups alojados en ASM.
Conseguido este punto se podr cerrar la BBDD y establecerla en modo
mount, para as remover los redo log groups existentes en
filesystem. SQL> Shutdown Immediate SQL> Startup mount
SQL> Alter Database Drop Logfile Group 1; SQL> Alter Database
Drop Logfile Group 2; SQL> Alter Database Drop Logfile Group 3;
Paso14: Ajustando elementos para trabajar BBDD en RAC Posterior al
borrado de los Redo Log groups 1,2 & 3, ejecutamos los ltimos
pasos para completar la tarea.
Cerrar la BBDD desde el nodo en el cual hemos hecho todo el
trabajo ( Nodo1 ) Aperturar la BBDD en modo upgrade ( SQL>
Startup Upgrade ) Una vez aperturada la BBDD en modo upgrade es
necesario ejecutar la re-construccin del catalogo,
lo cual no solo actualiza las vistas del catalogo de la BBDD
sino que tambin realiza el upgrade de las opciones existentes (
Oracle Text, Oracle XML Database, etc ). La ejecucin de este script
es lo que mas consume de tiempo en el Downtime del upgrade.
Regularmente esta ejecucin tarda de 30
-
a 90 minutos. La ejecucin de las estadsticas del diccionario de
datos ( EXECUTE dbms_stats.gather_dictionary_stats;) promover la
rapidez de la ejecucin de esta fase y la relacionada con la
compilacin de objetos invlidos. Dicho script se deber ejecutar
conectado como sys y se encuentra en la siguiente ruta:
$ORACLE_HOME/rdbms/admin/catupgrd.sql
Posterior a la reconstruccin del catalogo. Establecer el
parmetro CLUSTER_DATABASE=TRUE para ambos nodos. El parmetro
CLUSTER_DATABASE debe posee valor nico para ambos nodos por lo
tanto al momento de establecerlo se debe asignar con clausula
sid=*
SQL> Alter system set CLUSTER_DATABASE=TRUE scope=spfile
sid=*;
Construir el undo tablespace que trabajara con la instancia2 (
SRCDB2 ), el nombre de este tablespace podr ser determinando por el
parmetro UNDO_TABLESPACE de la instancia2. Se aconseja que para
este tipo de procedimientos se cree originalmente en la BBDD 10g
con un tamao prudencial ( 100MB, por ejemplo ) y una vez que la
BBDD 11g este conformada entonces se podr asignar su tamao
definitivo.
Detener la instancia1 ( SRCDB1 ) Aperturar la BBDD para ambos
nodos. Ya estando establecido el parmetro
CLUSTER_DATABASE=TRUE, podemos aplicar el siguiente comando
[oracle@MyRACSrv1 joel]$ srvctl start database d SRCDB
Conclusin
Y voila ya tenemos BBDD migrada a 11gR2 la cual se llevo a cabo
en modo Rolling Upgrade
Saludos
Joel is an Expert DBA with over 12 years of experience
specialized in several database areas with special focus in High
Availability Solution ( RAC, Data Guard, and others ). Joel is
frequent speaker at many Oracle events such as OTN LAD TOUR and
others. Among other complementary activities Joel is an
international Oracle University instructor of High Availability
courses. Joel was the first Latin American to be named OTN Expert
in year 2003 and Oracle ACE since 2004.