martes, 6 de mayo de 2014


RMAN

RMAN puede ser usado para respaldar restaurar y recuperar los archivos de datos, archivos de control y los archivos redo, así como los archive files. También puede ser usada para recuperaciones de bases de datos completas e incompletas

RMAN inicia el proceso servidor de Oracle en la base de datos a ser respaldada o restaurada. Los respaldos, restauración y recuperación son manejados a través de procesos llamados 'server-managed recovery'.

1.- Crear el Recovery Catalog

El recovery catalog es un repositorio de información que es usado y mantenido por RMAN, RMAN usa la información en el recovery catalog para determinar cómo ejecutar las acciones requeridas de respaldo y recuperación.



EL recovery catalog puede estar en un esquema de una base de datos de producción, sin embargo Oracle recomienda que este esquema resida en una base  de datos diferente a la de producción. LA BASE DE DATOS DEL RECOVERY CATALOG NO PUEDE SER USADA PARA GUARDAR BACKUP SET DE SI MISMA.


Aunque RMAN puede operar con o sin recovery catalog (En caso de no hacerse con el Recovery Catalog usa el control file de la base de datos a respaldar), cuando se usa sin recovery catalog no se tienen todas las características disponibles. Nuestra recomendación fue la de utilizar recovery catalog para respaldar las bases de datos productivas.

Pasos para crear el Catálogo de RMAN:

a) Crear base de datos para RMAN separada de la productiva. Con la siguiente definición mínima.

Tipo de espacio
Requerimiento de espacio
System
200 MB
Temp
50 mb
UNDO
50 MB
RMAN
100 MB

b)   Creación del usuario y otorgar los permisos necesarios para las tareas de respaldo y recuperación
En el prompt de sqlplus:


$ export ORACLE_SID=RMAN
$ sqlplus '/ as sysdba'
SQL> create user rman
  2  identified by rman
  3  default tablespace rman
  4  temporary tablespace temp
  5  quota unlimited on rman;
User created.

SQL> grant recovery_catalog_owner to rman;
Grant succeeded.

c)   Creacion del catalogo

$ORACLE_HOME/bin/rman catalog rman/rman
Recovery Manager: Release 9.2.0.4.0 - Production
Copyright (c) 1995, 2002, Oracle Corporation.  All rights reserved.
connected to recovery catalog database
recovery catalog is not installed
RMAN> create catalog
recovery catalog created
RMAN>

Target           base de datos a respaldar se especifica usuario con privilegio sysdba / password
catalog          Recovery Catalog se especifica dueño del recovery catalog/password
debug           Si se especifica se activa el modo de debugging
cmdfile          Se usa para ejecutar rman en forma batch.
msglog          Se usa para mandar a un archivo la salida en pantalla de RMAN.
Trace            Se usa para especificar nombre al archivo que va a guardar el debugging
append          Se usa cuando no se quiere que el msglog se sobreescriba
nocatalog      Se usa cuando no se va a usar un recovery catalog

d)   Registrar la base de datos.
Setear la variables de la base de datos de producción y hacer lo siguiente:

# RMAN TARGET / CATALOG RMAN@RMAN

Para poder administrar una base de datos a través de RMAN hay que registrarla en el recovery catalog por lo cual la instrucción a usar es:

RMAN > Register database;

e)   Configurar  la base de datos en modo Archive log.
Es necesario para nuestra estrategia de Respaldo que las bases de datos se coloquen en Archive mode, para esto se tienen que realizar las siguientes modificaciones a los parámetros de INIT de la base de datos correspondiente.

log_archive_dest= /archive/express1
log_archive_format=EXPRESS1%t_%s.arc
log_archive_start=true

Se baja la base de datos, se monta y se activa el archivelog mode.

$ sqlplus '/ as sysdba'
SQL > startup mount
SQL > alter database archivelog;

Ejemplo: de como se visualiza la configuración de archive mode.

SQL> archive log list                            
Database log mode              Archive Mode         
Automatic archival             Enabled               
Archive destination            /archive/express2    
Oldest online log sequence     6631                 
Next log sequence to archive   6633     
           
Una vez teniendo todos estos requisitos, podemos ahora comenzar a utilizar RMAN para respaldos, restauración y recuperación de base de datos.

CONFIGURACION DEL RMAN PARA HACER BACKUPS

[root@rac1 ~]# su - oracle
[oracle@rac1 ~]$ . omr.env

Poner la base en modo archive


[oracle@rac1 ~]$ rman target /
Recovery Manager: Release 10.1.0.4.0 - Production
Copyright (c) 1995, 2004, Oracle.  All rights reserved.
connected to target database: EMREP (DBID=3907185226)


1) Parámetros que vienen configurados por default.

RMAN> show all;

using target database controlfile 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 ARCHIVELOG DELETION POLICY TO NONE; # default
CONFIGURE SNAPSHOT CONTROLFILE NAME TO '/u01/app/oracle/product/10.2.0.4/db10g/dbs/snapcf_emrep.f'; # default

2) Se configura el siguiente parámetro con la ruta donde se va guardar los respaldos.

RMAN> CONFIGURE CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE DISK TO '/u02/RMAN/backup_%F.bkp';

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 OFF; # default
CONFIGURE CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE DISK TO '/u02/RMAN/backup_%F.bkp';
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 ARCHIVELOG DELETION POLICY TO NONE; # default
CONFIGURE SNAPSHOT CONTROLFILE NAME TO '/u01/app/oracle/product/10.2.0.4/db10g/dbs/snapcf_emrep.f'; # default


3) Se configura la ruta del siguiente parámetro para almacenar  en ella los respaldos, de preferencia debe ser la misma que la del parámetro anterior.

RMAN> CONFIGURE CHANNEL DEVICE TYPE DISK FORMAT '/u02/RMAN/respaldo_%d.bkp' MAXPIECESIZE 1G;

new RMAN configuration parameters:
CONFIGURE CHANNEL DEVICE TYPE DISK FORMAT   '/u02/RMAN/respaldo_%d.bkp' MAXPIECESIZE 1 G;
new RMAN configuration parameters are successfully stored


RMAN> CONFIGURE SNAPSHOT CONTROLFILE NAME TO '/u02/RMAN/snapcf_emrep.f';

snapshot controlfile name set to: /u02/RMAN/snapcf_emrep.f
new RMAN configuration parameters are successfully stored


RMAN> BACKUP AS COMPRESSED BACKUPSET FULL DATABASE INCLUDE CURRENT CONTROLFILE;
Starting backup at 16-APR-14
allocated channel: ORA_DISK_1
channel ORA_DISK_1: sid=143 devtype=DISK
channel ORA_DISK_1: starting compressed full datafile backupset
channel ORA_DISK_1: specifying datafile(s) in backupset
RMAN-03014: failure of backup command on ORA_DISK_1 channel at 04/16/2014 18:36:07
ORA-19602: cannot backup or copy active file in NOARCHIVELOG mode
continuing other job steps, job failed will not be re-run
channel ORA_DISK_1: starting compressed full datafile backupset
channel ORA_DISK_1: specifying datafile(s) in backupset
including current controlfile in backupset
including current SPFILE in backupset
channel ORA_DISK_1: starting piece 1 at 16-APR-14
channel ORA_DISK_1: finished piece 1 at 16-APR-14
piece handle=/u02/RMAN/respaldo_EMREP.bkp comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:02
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03014: failure of backup command on ORA_DISK_1 channel at 04/16/2014 18:36:07
ORA-19602: cannot backup or copy active file in NOARCHIVELOG mode
Este error lo marca porque la base no está en modo archive.

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 OFF; # default
CONFIGURE CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE DISK TO '/u02/RMAN/backup_%F.bkp';
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 CHANNEL DEVICE TYPE DISK FORMAT   '/u02/RMAN/respaldo_%d.bkp' MAXPIECESIZE 1 G;
CONFIGURE MAXSETSIZE TO UNLIMITED; # default
CONFIGURE ARCHIVELOG DELETION POLICY TO NONE; # default
CONFIGURE SNAPSHOT CONTROLFILE NAME TO '/u02/RMAN/snapcf_emrep.f';

RMAN> CONFIGURE CHANNEL DEVICE TYPE DISK FORMAT   '/u02/RMAN/respaldo%u_%d.bkp' MAXPIECESIZE 1G;
old RMAN configuration parameters:
CONFIGURE CHANNEL DEVICE TYPE DISK FORMAT   '/u02/RMAN/respaldo_%d.bkp' MAXPIECESIZE 1 G;
new RMAN configuration parameters:
CONFIGURE CHANNEL DEVICE TYPE DISK FORMAT   '/u02/RMAN/respaldo%u_%d.bkp' MAXPIECESIZE 1 G;
new RMAN configuration parameters are successfully stored
released channel: ORA_DISK_1

Hacer el respaldo de la base de datos.
RMAN>  BACKUP AS COMPRESSED BACKUPSET FULL DATABASE INCLUDE CURRENT CONTROLFILE;
Starting backup at 16-APR-14
using channel ORA_DISK_1
channel ORA_DISK_1: starting compressed full datafile backupset
channel ORA_DISK_1: specifying datafile(s) in backupset
input datafile fno=00005 name=/u01/app/oracle/product/10.2.0.4/oradata/emrep/mgmt.dbf
input datafile fno=00001 name=/u01/app/oracle/product/10.2.0.4/oradata/emrep/system01.dbf
input datafile fno=00002 name=/u01/app/oracle/product/10.2.0.4/oradata/emrep/undotbs01.dbf
input datafile fno=00003 name=/u01/app/oracle/product/10.2.0.4/oradata/emrep/sysaux01.dbf
input datafile fno=00006 name=/u01/app/oracle/product/10.2.0.4/oradata/emrep/mgmt_ecm_depot1.dbf
input datafile fno=00004 name=/u01/app/oracle/product/10.2.0.4/oradata/emrep/users01.dbf
channel ORA_DISK_1: starting piece 1 at 16-APR-14
channel ORA_DISK_1: finished piece 1 at 16-APR-14
piece handle=/u02/RMAN/respaldo05kckrv3_EMREP.bkp comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:02:46
channel ORA_DISK_1: starting compressed full datafile backupset
channel ORA_DISK_1: specifying datafile(s) in backupset
including current controlfile in backupset
including current SPFILE in backupset
channel ORA_DISK_1: starting piece 1 at 16-APR-14
channel ORA_DISK_1: finished piece 1 at 16-APR-14
piece handle=/u02/RMAN/respaldo06kcks49_EMREP.bkp comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:02
Finished backup at 16-APR-14

Verificar el archivo que tenga incluido el controlfile.

RMAN> list backup; 

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

BS Key  Type LV Size       Device Type Elapsed Time Completion Time
------- ---- -- ---------- ----------- ------------ ---------------
1       Full    2M         DISK        00:00:01     16-APR-14     
        BP Key: 1   Status: AVAILABLE  Compressed: YES  Tag: TAG20140416T183606
        Piece Name: /u02/RMAN/respaldo_EMREP.bkp
  Controlfile Included: Ckp SCN: 1561767      Ckp time: 16-APR-14
  SPFILE Included: Modification time: 16-APR-14

BS Key  Type LV Size       Device Type Elapsed Time Completion Time
------- ---- -- ---------- ----------- ------------ ---------------
2       Full    1G         DISK        00:02:36     16-APR-14     
        BP Key: 2   Status: AVAILABLE  Compressed: YES  Tag: TAG20140416T184555
        Piece Name: /u02/RMAN/respaldo05kckrv3_EMREP.bkp
  List of Datafiles in backup set 2
  File LV Type Ckp SCN    Ckp Time  Name
  ---- -- ---- ---------- --------- ----
  1       Full 1563395    16-APR-14 /u01/app/oracle/product/10.2.0.4/oradata/emrep/system01.dbf
  2       Full 1563395    16-APR-14 /u01/app/oracle/product/10.2.0.4/oradata/emrep/undotbs01.dbf
  3       Full 1563395    16-APR-14 /u01/app/oracle/product/10.2.0.4/oradata/emrep/sysaux01.dbf
  4       Full 1563395    16-APR-14 /u01/app/oracle/product/10.2.0.4/oradata/emrep/users01.dbf
  5       Full 1563395    16-APR-14 /u01/app/oracle/product/10.2.0.4/oradata/emrep/mgmt.dbf
  6       Full 1563395    16-APR-14 /u01/app/oracle/product/10.2.0.4/oradata/emrep/mgmt_ecm_depot1.dbf

BS Key  Type LV Size       Device Type Elapsed Time Completion Time
------- ---- -- ---------- ----------- ------------ ---------------
3       Full    2M         DISK        00:00:01     16-APR-14     
        BP Key: 3   Status: AVAILABLE  Compressed: YES  Tag: TAG20140416T184555
        Piece Name: /u02/RMAN/respaldo06kcks49_EMREP.bkp
  Controlfile Included: Ckp SCN: 1563733      Ckp time: 16-APR-14
  SPFILE Included: Modification time: 16-APR-14


Copiar los archivos que se generaron del respaldo, también el archivo init.ora (crearlo si no existe) y el orapw de la base. 

Crear un pfile si no existe.

[oracle@rac1 ~]$ cd $ORACLE_HOME
[oracle@rac1 db10g]$ ls
admin        dbs                  javavm  mgw          ord       slax
allroot.sh   diagnostics          jdbc    network      oui       sqlj
assistants   dm                   jdk     nls          owm       sqlplus
bin          flash_recovery_area  jlib    oc4j         perl      srvm
cdata        has                  jre     olap         plsql     sysman
cfgtoollogs  hs                   ldap    OPatch       precomp   uix
config       install              lib     opmn         rdbms     ultrasearch
css          install.platform     md      oracore      relnotes  wwg
ctx          inventory            mesg    oraInst.loc  root.sh   xdk
[oracle@rac1 db10g]$ cd dbs/
[oracle@rac1 dbs]$ ls
hc_emrep.dat  initdw.ora  init.ora  lkEMREP  orapwemrep  spfileemrep.ora
[oracle@rac1 dbs]$ sqlplus / as sysdba

SQL*Plus: Release 10.1.0.4.0 - Production on Thu Apr 16 19:11:20 2014
Copyright (c) 1982, 2005, Oracle.  All rights reserved.

Connected to:
Oracle Database 10g Enterprise Edition Release 10.1.0.4.0 - Production
With the Partitioning, OLAP and Data Mining options

SQL> create pfile from spfile;
File created.

[oracle@rac1 dbs]$ ls
hc_emrep.dat  initdw.ora  initemrep.ora  init.ora  lkEMREP  orapwemrep  spfileemrep.ora

[oracle@rac1 dbs]$ scp –r initemrep.ora  192.168.1.229:/u01/RMAN/
[oracle@rac1 dbs]$ scp -r orapwemrep 192.168.1.229:/u01/app/oracle/product/10.2.0.4/db10g/dbs/
oracle@192.168.1.229's password:
orapwemrep                                    100% 1536     1.5KB/s   00:00   

NOTA: Se debe reemplazar el archivo orapwd de la base original en el ORACLE_HOME de la base nueva.

MAQUINA DONDE SE CREARA LA BASE DE DATOS DEL RESPALDO
Guiándose en el init.ora  copiado de la base original recrear todas las rutas para que queden  igual  que la original.

[root@talis ~]# su - oracle
[oracle@talis ~]$ mkdir -p /u01/app/oracle/product/10.2.0.4/db10g/admin/emrep/udump
[oracle@talis ~]$ mkdir -p /u01/app/oracle/product/10.2.0.4/oradata/emrep/
[oracle@talis ~]$ mkdir -p /u01/app/oracle/product/10.2.0.4/db10g/admin/emrep/cdump
[oracle@talis ~]$ mkdir -p /u01/app/oracle/product/10.2.0.4/db10g/admin/emrep/bd
ump
[oracle@talis ~]$ cd /u01/app/oracle/product/10.2.0.4/db10g/admin/emrep/
[oracle@talis ~]$ rman target /

Recovery Manager: Release 10.1.0.4.0 - Production

Copyright (c) 1995, 2004, Oracle.  All rights reserved.

connected to target database (not started)

RMAN> startup pfile='/u01/RMAN/initemrep.ora' nomount;

Oracle instance started

Total System Global Area     536871412 bytes

Fixed Size                      780056 bytes
Variable Size                179312872 bytes
Database Buffers             356515840 bytes
Redo Buffers                    262144 bytes

RMAN> show all;

using target database controlfile 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 ARCHIVELOG DELETION POLICY TO NONE; # default

RMAN> RESTORE CONTROLFILE FROM '/u01/RMAN/respaldo06kcks49_EMREP.bkp';

Starting restore at 16-APR-14
allocated channel: ORA_DISK_1
channel ORA_DISK_1: sid=159 devtype=DISK

channel ORA_DISK_1: restoring controlfile
channel ORA_DISK_1: restore complete
output filename=/u01/app/oracle/product/10.2.0.4/oradata/emrep/control01.ctl
output filename=/u01/app/oracle/product/10.2.0.4/oradata/emrep/control02.ctl
output filename=/u01/app/oracle/product/10.2.0.4/oradata/emrep/control03.ctl
Finished restore at 16-APR-14

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 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 ARCHIVELOG DELETION POLICY TO NONE; # default

Montar la base.

[oracle@talis ~]$ sqlplus / as sysdba

SQL*Plus: Release 10.1.0.4.0 - Production on Thu Apr 16 11:48:15 2014

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


Connected to:
Oracle Database 10g Enterprise Edition Release 10.1.0.4.0 - Production
With the Partitioning, OLAP and Data Mining options

SQL> alter database mount;
alter database mount
*
ERROR at line 1:
ORA-01990: error opening password file
'/u01/app/oracle/product/10.2.0.4/db10g/dbs/orapw' -à Este error lo marca cuando
ORA-27037: unable to obtain file status             no se reemplazo el archivo
Linux Error: 2: No such file or directory           orapwd de la base original.
Additional information: 3


SQL> alter database mount;
alter database mount
*
ERROR at line 1:
ORA-01100: database already mounted


SQL> select open_mode from v$database;

OPEN_MODE
----------
MOUNTED

SQL>


[oracle@talis ~]$ rman target /

Recovery Manager: Release 10.1.0.4.0 - Production

Copyright (c) 1995, 2004, Oracle.  All rights reserved.

connected to target database: EMREP (DBID=3907185226)

RMAN> show all;

using target database controlfile 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 '/u02/RMAN/backup_%F.bkp';
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 CHANNEL DEVICE TYPE DISK FORMAT   '/u02/RMAN/respaldo%u_%d.bkp' MAXPIECESIZE 1 G;
CONFIGURE MAXSETSIZE TO UNLIMITED; # default
CONFIGURE ARCHIVELOG DELETION POLICY TO NONE; # default
CONFIGURE SNAPSHOT CONTROLFILE NAME TO '/u01/app/oracle/product/10.2.0.4/db10g/dbs/snapcf_emrep.f'; # default

RMAN> CONFIGURE CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE DISK TO '/u01/RMAN/backup_%F.bkp';

old RMAN configuration parameters:
CONFIGURE CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE DISK TO '/u01/RMAN//backup_%F.bkp';
new RMAN configuration parameters:
CONFIGURE CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE DISK TO '/u01/RMAN/backup_%F.bkp';
new RMAN configuration parameters are successfully stored

RMAN> CONFIGURE CHANNEL DEVICE TYPE DISK FORMAT   '/u01/RMAN/respaldo%u_%d.bkp' MAXPIECESIZE 1G;

old RMAN configuration parameters:
CONFIGURE CHANNEL DEVICE TYPE DISK FORMAT   '/u02/RMAN/respaldo%u_%d.bkp' MAXPIECESIZE 1 G;
new RMAN configuration parameters:
CONFIGURE CHANNEL DEVICE TYPE DISK FORMAT   '/u01/RMAN/respaldo%u_%d.bkp' MAXPIECESIZE 1 G;
new RMAN configuration parameters are successfully stored

Restaurar la base de datos.

RMAN> RESTORE DATABASE;

Starting restore at 16-APR-14
Starting implicit crosscheck backup at 16-APR-14
allocated channel: ORA_DISK_1
channel ORA_DISK_1: sid=155 devtype=DISK
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of restore command at 04/16/2014 11:58:34
ORA-06552: PL/SQL: Compilation unit analysis terminated
ORA-06553: PLS-553: character set name is not recognized

El error anterior lo manda porque el respaldo copiado no se encuentra en la misma ruta de donde se hizo el respaldo original. Para reconfigurara la ruta se ejecuta lo siguiente pero con la base montada;

RMAN> catalog backuppiece '/u01/RMAN/respaldo05kckrv3_EMREP.bkp';

cataloged backuppiece
backup piece handle=/u01/RMAN/respaldo05kckrv3_EMREP.bkp recid=3 stamp=684331855

RMAN> catalog backuppiece '/u01/RMAN/respaldo06kcks49_EMREP.bkp';

cataloged backuppiece
backup piece handle=/u01/RMAN/respaldo06kcks49_EMREP.bkp recid=4 stamp=684331907


RMAN> restore database;

Starting restore at 16-APR-14
using channel ORA_DISK_1

channel ORA_DISK_1: starting datafile backupset restore
channel ORA_DISK_1: specifying datafile(s) to restore from backup set
restoring datafile 00001 to /u01/app/oracle/product/10.2.0.4/oradata/emrep/system01.dbf
restoring datafile 00002 to /u01/app/oracle/product/10.2.0.4/oradata/emrep/undotbs01.dbf
restoring datafile 00003 to /u01/app/oracle/product/10.2.0.4/oradata/emrep/sysaux01.dbf
restoring datafile 00004 to /u01/app/oracle/product/10.2.0.4/oradata/emrep/users01.dbf
restoring datafile 00005 to /u01/app/oracle/product/10.2.0.4/oradata/emrep/mgmt.dbf
restoring datafile 00006 to /u01/app/oracle/product/10.2.0.4/oradata/emrep/mgmt_ecm_depot1.dbf
channel ORA_DISK_1: restored backup piece 1
piece handle=/u01/RMAN/respaldo05kckrv3_EMREP.bkp tag=TAG20140416T184555
channel ORA_DISK_1: restore complete
Finished restore at 16-APR-14


[root@talis ~]# su - oracle
[oracle@talis ~]$ . bd.env
[oracle@talis ~]$ sqlplus / as sysdba

SQL*Plus: Release 10.1.0.4.0 - Production on Thu Apr 16 14:36:10 2014

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


Connected to:
Oracle Database 10g Enterprise Edition Release 10.1.0.4.0 - Production
With the Partitioning, OLAP and Data Mining options

SQL> alter database open;
alter database open
*
ERROR at line 1:
ORA-01589: must use RESETLOGS or NORESETLOGS option for database open


SQL> alter database open resetlogs;

Database altered.

SQL> archive log list;
Database log mode              Archive Mode
Automatic archival             Enabled
Archive destination            USE_DB_RECOVERY_FILE_DEST
Oldest online log sequence     0
Next log sequence to archive   1
Current log sequence           1
SQL>


RECUPERACION DE UN DATAFILE


[oracle@rac1 emrep]$ cd /u01/app/oracle/product/10.2.0.4/oradata
[oracle@rac1 oradata]$ ls
emrep
[oracle@rac1 oradata]$ cd emrep/
[oracle@rac1 emrep]$ ls
control01.ctl  mgmt_ecm_depot1.dbf  redo04.log    undotbs01.dbf
control02.ctl  redo01.log           sysaux01.dbf  users01.dbf
control03.ctl  redo02.log           system01.dbf
mgmt.dbf       redo03.log           temp01.dbf
[oracle@rac1 emrep]$ rm -rf users01.dbf
[oracle@rac1 emrep]$ sqlplus / as sysdba

SQL*Plus: Release 10.1.0.4.0 - Production on Thu Apr 16 22:54:21 2014

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


Connected to:
Oracle Database 10g Enterprise Edition Release 10.1.0.4.0 - Production
With the Partitioning, OLAP and Data Mining options

SQL>
SQL> shut immediate;
ORA-01116: error in opening database file 4
ORA-01110: data file 4: '/u01/app/oracle/product/10.2.0.4/oradata/emrep/users01.dbf'
ORA-27041: unable to open file
Linux Error: 2: No such file or directory
Additional information: 3
SQL> shutdown abort;
ORACLE instance shut down.
SQL>startup
ORACLE instance started.

Total System Global Area  536871412 bytes
Fixed Size                   780056 bytes
Variable Size             179312872 bytes
Database Buffers          356515840 bytes
Redo Buffers                 262144 bytes
Database mounted.
ORA-01157: cannot identify/lock data file 4 - see DBWR trace file
ORA-01110: data file 4:
'/u01/app/oracle/product/10.2.0.4/oradata/emrep/users01.dbf'


SQL> shut immediate;    
SP2-0734: unknown command beginning "shut i..." - rest of line ignored.
SQL> shutdown abort;
ORACLE instance shut down.
SQL> exit
Disconnected from Oracle Database 10g Enterprise Edition Release 10.1.0.4.0 - Production
With the Partitioning, OLAP and Data Mining options
[oracle@rac1 emrep]$ rman target /

Recovery Manager: Release 10.1.0.4.0 - Production

Copyright (c) 1995, 2004, Oracle.  All rights reserved.

connected to target database (not started)

RMAN> startup mount;

Oracle instance started
database mounted

Total System Global Area     536871412 bytes

Fixed Size                      780056 bytes
Variable Size                179312872 bytes
Database Buffers             356515840 bytes
Redo Buffers                    262144 bytes


RMAN> restore datafile 4;

Starting restore at 16-APR-14
using channel ORA_DISK_1

channel ORA_DISK_1: starting datafile backupset restore
channel ORA_DISK_1: specifying datafile(s) to restore from backup set
restoring datafile 00004 to /u01/app/oracle/product/10.2.0.4/oradata/emrep/users01.dbf
channel ORA_DISK_1: restored backup piece 1
piece handle=/u02/RMAN/respaldo05kckrv3_EMREP.bkp tag=TAG20140416T184555
channel ORA_DISK_1: restore complete
Finished restore at 16-APR-14

RMAN> recover datafile 4;

Starting recover at 16-APR-14
using target database controlfile instead of recovery catalog
allocated channel: ORA_DISK_1
channel ORA_DISK_1: sid=161 devtype=DISK

starting media recovery
media recovery complete

Finished recover at 16-APR-14

RMAN> exit
Recovery Manager complete.

[oracle@rac1 emrep]$ sqlplus / as sysdba

SQL*Plus: Release 10.1.0.4.0 - Production on Thu Apr 16 23:07:27 2014

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


Connected to:
Oracle Database 10g Enterprise Edition Release 10.1.0.4.0 - Production
With the Partitioning, OLAP and Data Mining options

SQL> alter database open;

Database altered.


Listo!!!!!!!!!!!