MERCADOS FINANCIEROS

jueves, 1 de octubre de 2015

RMAN RESTORE CASO 3 Restaurar la base de datos de producción para actualizar el ambiente de pruebas


Caso 3. Restaurar la base de datos de producción para actualizar el ambiente de pruebas (FONPETP en FONPETT  o en FONPETD):

 

En este escenario se toma un backup del ambiente de producción para actualizar el ambiente de pruebas. Existen diversos métodos para realizar esta actividad, sin embargo en este escenario se utiliza la metodología “restore clone from location”

  

Se ubican las piezas a restaurar. Usualmente aparecen con formato de nombre tipo copia + base de datos + nombre pieza + numero de pieza + canal + fecha. En este caso se restaurará una copia de seguridad del 6 de junio


Si las piezas se encuentran en otro servidor, será necesario transportarlas al servidor donde se restaurará.

 

[oracle@bdprod fonpetp]$ ls -lrt
total 38071164
-rw-r----- 1 oracle asmadmin    21397504 Nov 17  2013 ctlstby_FONPETP.17112013
-rw-r----- 1 oracle oinstall     1818624 Jan 28 20:53 full_FONPETP_9pov7qj0_1_1_20140128.bak
-rw-r----- 1 root   root     19688177664 May  4 08:28 full_FONPETP_ltp7angr_1_1_20140503.bak
-rw-r--r-- 1 root   root      8348484697 May  4 18:48 backup.zip
drwxr-xr-x 2 oracle oinstall        4096 Jun  5 12:22 scripts
-rw-r----- 1 oracle oinstall    21856256 Jun  5 21:04 s_849443012.1048.849443015
drwxr-xr-x 2 oracle oinstall       20480 Jun  6 21:10 logs
-rw-r----- 1 oracle asmadmin  5181661184 Jun  6 21:23 full_FONPETP_4upa6hdh_1_1_20140606.bak
-rw-r----- 1 oracle asmadmin  5348573184 Jun  6 21:30 full_FONPETP_4tpa6hdh_1_1_20140606.bak
-rw-r----- 1 oracle asmadmin   350995456 Jun  6 21:30 arch_FONPETP_50pa6ijh_1_1_20140606.bak
-rw-r----- 1 oracle asmadmin    21856256 Jun  6 21:31 ctrl_c-2150325182-20140606-00.bak
 
 
 
[oracle@bdprod fonpetp]$ scp -pr full_FONPETP_4upa6hdh_1_1_20140606.bak full_FONPETP_4tpa6hdh_1_1_20140606.bak archivelog_FONPETP_50pa6ijh_1_1_20140606.bak controlfile_c-2150325182-20140606-00.bak 172.24.21.36:/u02/backup
oracle@172.24.21.36's password: **********
full_FONPETP_4upa6hdh_1_1_20140606.bak                         100% 4942MB  88.2MB/s   00:56
full_FONPETP_4tpa6hdh_1_1_20140606.bak                         100% 5101MB  83.6MB/s   01:01
archivelog_FONPETP_50pa6ijh_1_1_20140606.bak                   100%  335MB  67.0MB/s   00:05
controlfile_c-2150325182-20140606-00.bak                       100%   21MB  20.8MB/s   00:01

 

Eliminar primero los archivos de la base de datos actual de desarrollo con la instancia abajo. No eliminar el spfile y crear de nuevo los directorios eliminados automáticamente por ASM.

 

[oracle@bddesarrollo ~]$ . oraenv
ORACLE_SID = [+ASM] ? fonpett
The Oracle base remains unchanged with value /u01/app/oracle
[oracle@bddesarrollo ~]$ sqlplus / as sysdba
 
SQL*Plus: Release 11.2.0.3.0 Production on Thu Oct 2 19:36:01 2014
 
Copyright (c) 1982, 2011, Oracle.  All rights reserved.
 
Connected to:
Oracle Database 11g Release 11.2.0.3.0 - 64bit Production
With the Automatic Storage Management option
 
SYS@fonpetd> shu immediate;
Database closed.
Database dismounted.
ORACLE instance shut down.
SYS@fonpetd> exit
Disconnected from Oracle Database 11g Release 11.2.0.3.0 - 64bit Production
With the Automatic Storage Management option
[oracle@bddesarrollo ~]$ . oraenv
ORACLE_SID = [fonpetd] ? +ASM
The Oracle base remains unchanged with value /u01/app/oracle
[oracle@bddesarrollo ~]$ asmcmd
You may delete multiple files and/or directories.
Are you sure? (y/n) y
ASMCMD> mkdir +DG_DATA/fonpett/datafile
ASMCMD> rm +DG_DATA/fonpett/controlfile/*
You may delete multiple files and/or directories.
Are you sure? (y/n) y
ASMCMD> mkdir +DG_DATA/fonpett/controlfile
You may delete multiple files and/or directories.
Are you sure? (y/n) y
ASMCMD> mkdir +DG_DATA/fonpett/tempfile
ASMCMD> exit
ASMCMD> mkdir +DG_DATA/fonpett/onlinelog
ASMCMD> rm +DG_DATA/fonpett/onlinelog/*
You may delete multiple files and/or directories.
Are you sure? (y/n) y

 

Iniciar la base de datos en modo nomount y dejarla lista para la restauración

 

[oracle@bddesarrollo ~]$ . oraenv
ORACLE_SID = [+ASM] ? fonpett
The Oracle base remains unchanged with value /u01/app/oracle
[oracle@bddesarrollo ~]$ sqlplus / as sysdba
 
SQL*Plus: Release 11.2.0.3.0 Production on Thu Oct 2 19:42:44 2014
 
Copyright (c) 1982, 2011, Oracle.  All rights reserved.
 
Connected to an idle instance.
 
SYS@fonpetd> alter system set db_name='FONPETP' scope=spfile;
 
System altered.
 
SYS@fonpetd> alter system set db_file_name_convert='+DG_DATA/fonpetp','+DG_DATA/fonpetd' scope=spfile;
 
System altered.
 
SYS@fonpetd> alter system set log_file_name_convert='+DG_DATA/fonpetp','+DG_DATA/fonpetd' scope=spfile;
 
System altered.
 
SYS@fonpetd> startup nomount;
ORACLE instance started.
 
Total System Global Area 1402982400 bytes
Fixed Size                  2228304 bytes
Variable Size            1090523056 bytes
Database Buffers          301989888 bytes
Redo Buffers                8241152 bytes
SYS@fonpetd> exit

 

En el servidor donde se restaurará usando RMAN se aloja el canal auxiliar y se inicia la restauracion. En este escenario se restaurará la base de datos fonpetp en fonpett

 

[oracle@bdpruebas ~]$ . oraenv
ORACLE_SID = [oracle] ? fonpett
The Oracle base remains unchanged with value /u01/app/oracle
[oracle@bdpruebas ~]$ rman auxiliary /
 
Recovery Manager: Release 11.2.0.3.0 - Production on Sat Jun 7 02:36:58 2014
 
Copyright (c) 1982, 2011, Oracle and/or its affiliates.  All rights reserved.
 
connected to auxiliary database: FONPETP (not mounted)
 
RMAN> run
{
DUPLICATE DATABASE 'FONPETP' DBID 2150325182 TO fonpetd backup location '/u02/backup/rman/prueba_restauracion/';
}
 
Starting Duplicate Db at 07/06/2014 02:37:01
 
contents of Memory Script:
{
   sql clone "create spfile from memory";
}
executing Memory Script
 
sql statement: create spfile from memory
 
contents of Memory Script:
{
   shutdown clone immediate;
   startup clone nomount;
}
executing Memory Script
 
Oracle instance shut down
 
connected to auxiliary database (not started)
Oracle instance started
 
Total System Global Area    3206836224 bytes
 
Fixed Size                     2232640 bytes
Variable Size                671092416 bytes
Database Buffers            2516582400 bytes
Redo Buffers                  16928768 bytes
 
contents of Memory Script:
{
   sql clone "alter system set  db_name =
 ''FONPETP'' comment=
 ''Modified by RMAN duplicate'' scope=spfile";
   sql clone "alter system set  db_unique_name =
 ''FONPETT'' comment=
 ''Modified by RMAN duplicate'' scope=spfile";
   shutdown clone immediate;
   startup clone force nomount
   restore clone primary controlfile from  '/u02/backup/controlfile_c-2150325182-20140606-00.bak';
   alter clone database mount;
}
executing Memory Script
 
sql statement: alter system set  db_name =  ''FONPETP'' comment= ''Modified by RMAN duplicate'' scope=spfile
 
sql statement: alter system set  db_unique_name =  ''FONPETT'' comment= ''Modified by RMAN duplicate'' scope=spfile
 
Oracle instance shut down
 
Oracle instance started
 
Total System Global Area    3206836224 bytes
 
Fixed Size                     2232640 bytes
Variable Size                671092416 bytes
Database Buffers            2516582400 bytes
Redo Buffers                  16928768 bytes
 
Starting restore at 07/06/2014 02:37:24
allocated channel: ORA_AUX_DISK_1
channel ORA_AUX_DISK_1: SID=469 device type=DISK
 
channel ORA_AUX_DISK_1: restoring control file
channel ORA_AUX_DISK_1: restore complete, elapsed time: 00:00:07
output file name=+DG_DATA/fonpett/control01.ctl
output file name=+DG_FRA/fonpett/control02.ctl
Finished restore at 07/06/2014 02:37:32
 
database mounted
released channel: ORA_AUX_DISK_1
allocated channel: ORA_AUX_DISK_1
channel ORA_AUX_DISK_1: SID=469 device type=DISK
 
contents of Memory Script:
{
   set until scn  75254117;
   set newname for clone datafile  1 to new;
   set newname for clone datafile  2 to new;
   set newname for clone datafile  3 to new;
   set newname for clone datafile  4 to new;
   set newname for clone datafile  5 to new;
   set newname for clone datafile  6 to new;
   set newname for clone datafile  7 to new;
   set newname for clone datafile  8 to new;
   set newname for clone datafile  9 to new;
   set newname for clone datafile  10 to new;
   set newname for clone datafile  11 to new;
   set newname for clone datafile  12 to new;
   set newname for clone datafile  13 to new;
   set newname for clone datafile  14 to new;
   set newname for clone datafile  15 to new;
   restore
   clone database
   ;
}
executing Memory Script
 
executing command: SET until clause
 
executing command: SET NEWNAME
 
executing command: SET NEWNAME
 
executing command: SET NEWNAME
 
executing command: SET NEWNAME
 
executing command: SET NEWNAME
 
executing command: SET NEWNAME
 
executing command: SET NEWNAME
 
executing command: SET NEWNAME
 
executing command: SET NEWNAME
 
executing command: SET NEWNAME
 
executing command: SET NEWNAME
 
executing command: SET NEWNAME
 
executing command: SET NEWNAME
 
executing command: SET NEWNAME
 
executing command: SET NEWNAME
 
Starting restore at 07/06/2014 02:37:38
using channel ORA_AUX_DISK_1
 
channel ORA_AUX_DISK_1: starting datafile backup set restore
channel ORA_AUX_DISK_1: specifying datafile(s) to restore from backup set
channel ORA_AUX_DISK_1: restoring datafile 00001 to +DG_DATA
channel ORA_AUX_DISK_1: restoring datafile 00003 to +DG_DATA
channel ORA_AUX_DISK_1: restoring datafile 00004 to +DG_DATA
channel ORA_AUX_DISK_1: restoring datafile 00006 to +DG_DATA
channel ORA_AUX_DISK_1: restoring datafile 00009 to +DG_DATA
channel ORA_AUX_DISK_1: restoring datafile 00013 to +DG_DATA
channel ORA_AUX_DISK_1: restoring datafile 00014 to +DG_DATA
channel ORA_AUX_DISK_1: reading from backup piece /u02/backup/full_FONPETP_4tpa6hdh_1_1_20140606.bak
channel ORA_AUX_DISK_1: piece handle=/u02/backup/full_FONPETP_4tpa6hdh_1_1_20140606.bak tag=TAG20140606T211007
channel ORA_AUX_DISK_1: restored backup piece 1
channel ORA_AUX_DISK_1: restore complete, elapsed time: 00:13:46
channel ORA_AUX_DISK_1: starting datafile backup set restore
channel ORA_AUX_DISK_1: specifying datafile(s) to restore from backup set
channel ORA_AUX_DISK_1: restoring datafile 00002 to +DG_DATA
channel ORA_AUX_DISK_1: restoring datafile 00005 to +DG_DATA
channel ORA_AUX_DISK_1: restoring datafile 00007 to +DG_DATA
channel ORA_AUX_DISK_1: restoring datafile 00008 to +DG_DATA
channel ORA_AUX_DISK_1: restoring datafile 00010 to +DG_DATA
channel ORA_AUX_DISK_1: restoring datafile 00011 to +DG_DATA
channel ORA_AUX_DISK_1: restoring datafile 00012 to +DG_DATA
channel ORA_AUX_DISK_1: restoring datafile 00015 to +DG_DATA
channel ORA_AUX_DISK_1: reading from backup piece /u02/backup/full_FONPETP_4upa6hdh_1_1_20140606.bak
channel ORA_AUX_DISK_1: piece handle=/u02/backup/full_FONPETP_4upa6hdh_1_1_20140606.bak tag=TAG20140606T211007
channel ORA_AUX_DISK_1: restored backup piece 1
channel ORA_AUX_DISK_1: restore complete, elapsed time: 00:13:55
Finished restore at 07/06/2014 03:05:21
 
contents of Memory Script:
{
   switch clone datafile all;
}
executing Memory Script
 
datafile 1 switched to datafile copy
input datafile copy RECID=16 STAMP=849582321 file name=+DG_DATA/fonpett/datafile/system.310.849580661
datafile 2 switched to datafile copy
input datafile copy RECID=17 STAMP=849582321 file name=+DG_DATA/fonpett/datafile/sysaux.261.849581489
datafile 3 switched to datafile copy
input datafile copy RECID=18 STAMP=849582321 file name=+DG_DATA/fonpett/datafile/undotbs1.309.849580663
datafile 4 switched to datafile copy
input datafile copy RECID=19 STAMP=849582321 file name=+DG_DATA/fonpett/datafile/users.306.849580663
datafile 5 switched to datafile copy
input datafile copy RECID=20 STAMP=849582321 file name=+DG_DATA/fonpett/datafile/indic_fonpet_movim_01.303.849581487
datafile 6 switched to datafile copy
input datafile copy RECID=21 STAMP=849582321 file name=+DG_DATA/fonpett/datafile/indic_fonpet_param.307.849580663
datafile 7 switched to datafile copy
input datafile copy RECID=22 STAMP=849582322 file name=+DG_DATA/fonpett/datafile/indic_fonpet_movim.300.849581487
datafile 8 switched to datafile copy
input datafile copy RECID=23 STAMP=849582322 file name=+DG_DATA/fonpett/datafile/indic_fonpet_movim_reorg0.262.849581489
datafile 9 switched to datafile copy
input datafile copy RECID=24 STAMP=849582322 file name=+DG_DATA/fonpett/datafile/ts_fonpet_param.305.849580663
datafile 10 switched to datafile copy
input datafile copy RECID=25 STAMP=849582322 file name=+DG_DATA/fonpett/datafile/ts_fonpet_movim_01.304.849581487
datafile 11 switched to datafile copy
input datafile copy RECID=26 STAMP=849582322 file name=+DG_DATA/fonpett/datafile/indic_fonpet_movim_02.301.849581487
datafile 12 switched to datafile copy
input datafile copy RECID=27 STAMP=849582322 file name=+DG_DATA/fonpett/datafile/ts_fonpet_movim_02.264.849581487
datafile 13 switched to datafile copy
input datafile copy RECID=28 STAMP=849582322 file name=+DG_DATA/fonpett/datafile/ts_fonpet_rep.308.849580663
datafile 14 switched to datafile copy
input datafile copy RECID=29 STAMP=849582322 file name=+DG_DATA/fonpett/datafile/ts_fonpet_movim.263.849580661
datafile 15 switched to datafile copy
input datafile copy RECID=30 STAMP=849582322 file name=+DG_DATA/fonpett/datafile/ts_fonpet_movim.302.849581487
 
contents of Memory Script:
{
   set until scn  75254117;
   recover
   clone database
    delete archivelog
   ;
}
executing Memory Script
 
executing command: SET until clause
 
Starting recover at 07/06/2014 03:05:23
using channel ORA_AUX_DISK_1
 
starting media recovery
 
channel ORA_AUX_DISK_1: starting archived log restore to default destination
channel ORA_AUX_DISK_1: restoring archived log
archived log thread=1 sequence=4539
channel ORA_AUX_DISK_1: reading from backup piece /u02/backup/archivelog_FONPETP_50pa6ijh_1_1_20140606.bak
channel ORA_AUX_DISK_1: piece handle=/u02/backup/archivelog_FONPETP_50pa6ijh_1_1_20140606.bak tag=TAG20140606T213022
channel ORA_AUX_DISK_1: restored backup piece 1
channel ORA_AUX_DISK_1: restore complete, elapsed time: 00:00:07
archived log file name=/u01/app/oracle/product/11.2.0/dbhome_1/dbs/arch1_4539_838067579.dbf thread=1 sequence=4539
channel clone_default: deleting archived log(s)
archived log file name=/u01/app/oracle/product/11.2.0/dbhome_1/dbs/arch1_4539_838067579.dbf RECID=1 STAMP=849582327
media recovery complete, elapsed time: 00:00:02
Finished recover at 07/06/2014 03:05:33
Oracle instance started
 
Total System Global Area    3206836224 bytes
 
Fixed Size                     2232640 bytes
Variable Size                671092416 bytes
Database Buffers            2516582400 bytes
Redo Buffers                  16928768 bytes
 
contents of Memory Script:
{
   sql clone "alter system set  db_name =
 ''FONPETT'' comment=
 ''Reset to original value by RMAN'' scope=spfile";
   sql clone "alter system reset  db_unique_name scope=spfile";
   shutdown clone immediate;
   startup clone nomount;
}
executing Memory Script
 
sql statement: alter system set  db_name =  ''FONPETT'' comment= ''Reset to original value by RMAN'' scope=spfile
 
sql statement: alter system reset  db_unique_name scope=spfile
 
Oracle instance shut down
 
connected to auxiliary database (not started)
Oracle instance started
 
Total System Global Area    3206836224 bytes
 
Fixed Size                     2232640 bytes
Variable Size                671092416 bytes
Database Buffers            2516582400 bytes
Redo Buffers                  16928768 bytes
sql statement: CREATE CONTROLFILE REUSE SET DATABASE "FONPETT" RESETLOGS ARCHIVELOG
  MAXLOGFILES     16
  MAXLOGMEMBERS      3
  MAXDATAFILES      100
  MAXINSTANCES     8
  MAXLOGHISTORY     2920
 LOGFILE
  GROUP   1  SIZE 50 M ,
  GROUP   2  SIZE 50 M ,
  GROUP   3  SIZE 50 M ,
  GROUP   8  SIZE 50 M ,
  GROUP   9  SIZE 50 M ,
  GROUP  10  SIZE 50 M ,
  GROUP  11  SIZE 50 M ,
  GROUP  12  SIZE 50 M
 DATAFILE
  '+DG_DATA/fonpett/datafile/system.310.849580661'
 CHARACTER SET WE8ISO8859P1
 
 
contents of Memory Script:
{
   set newname for clone tempfile  1 to new;
   switch clone tempfile all;
   catalog clone datafilecopy  "+DG_DATA/fonpett/datafile/sysaux.261.849581489",
 "+DG_DATA/fonpett/datafile/undotbs1.309.849580663",
 "+DG_DATA/fonpett/datafile/users.306.849580663",
 "+DG_DATA/fonpett/datafile/indic_fonpet_movim_01.303.849581487",
 "+DG_DATA/fonpett/datafile/indic_fonpet_param.307.849580663",
 "+DG_DATA/fonpett/datafile/indic_fonpet_movim.300.849581487",
 "+DG_DATA/fonpett/datafile/indic_fonpet_movim_reorg0.262.849581489",
 "+DG_DATA/fonpett/datafile/ts_fonpet_param.305.849580663",
 "+DG_DATA/fonpett/datafile/ts_fonpet_movim_01.304.849581487",
 "+DG_DATA/fonpett/datafile/indic_fonpet_movim_02.301.849581487",
 "+DG_DATA/fonpett/datafile/ts_fonpet_movim_02.264.849581487",
 "+DG_DATA/fonpett/datafile/ts_fonpet_rep.308.849580663",
 "+DG_DATA/fonpett/datafile/ts_fonpet_movim.263.849580661",
 "+DG_DATA/fonpett/datafile/ts_fonpet_movim.302.849581487";
   switch clone datafile all;
}
executing Memory Script
 
executing command: SET NEWNAME
 
renamed tempfile 1 to +DG_DATA in control file
 
cataloged datafile copy
datafile copy file name=+DG_DATA/fonpett/datafile/sysaux.261.849581489 RECID=1 STAMP=849582366
cataloged datafile copy
datafile copy file name=+DG_DATA/fonpett/datafile/undotbs1.309.849580663 RECID=2 STAMP=849582366
cataloged datafile copy
datafile copy file name=+DG_DATA/fonpett/datafile/users.306.849580663 RECID=3 STAMP=849582366
cataloged datafile copy
datafile copy file name=+DG_DATA/fonpett/datafile/indic_fonpet_movim_01.303.849581487 RECID=4 STAMP=849582366
cataloged datafile copy
datafile copy file name=+DG_DATA/fonpett/datafile/indic_fonpet_param.307.849580663 RECID=5 STAMP=849582366
cataloged datafile copy
datafile copy file name=+DG_DATA/fonpett/datafile/indic_fonpet_movim.300.849581487 RECID=6 STAMP=849582366
cataloged datafile copy
datafile copy file name=+DG_DATA/fonpett/datafile/indic_fonpet_movim_reorg0.262.849581489 RECID=7 STAMP=849582366
cataloged datafile copy
datafile copy file name=+DG_DATA/fonpett/datafile/ts_fonpet_param.305.849580663 RECID=8 STAMP=849582366
cataloged datafile copy
datafile copy file name=+DG_DATA/fonpett/datafile/ts_fonpet_movim_01.304.849581487 RECID=9 STAMP=849582366
cataloged datafile copy
datafile copy file name=+DG_DATA/fonpett/datafile/indic_fonpet_movim_02.301.849581487 RECID=10 STAMP=849582366
cataloged datafile copy
datafile copy file name=+DG_DATA/fonpett/datafile/ts_fonpet_movim_02.264.849581487 RECID=11 STAMP=849582366
cataloged datafile copy
datafile copy file name=+DG_DATA/fonpett/datafile/ts_fonpet_rep.308.849580663 RECID=12 STAMP=849582366
cataloged datafile copy
datafile copy file name=+DG_DATA/fonpett/datafile/ts_fonpet_movim.263.849580661 RECID=13 STAMP=849582366
cataloged datafile copy
datafile copy file name=+DG_DATA/fonpett/datafile/ts_fonpet_movim.302.849581487 RECID=14 STAMP=849582366
 
datafile 2 switched to datafile copy
input datafile copy RECID=1 STAMP=849582366 file name=+DG_DATA/fonpett/datafile/sysaux.261.849581489
datafile 3 switched to datafile copy
input datafile copy RECID=2 STAMP=849582366 file name=+DG_DATA/fonpett/datafile/undotbs1.309.849580663
datafile 4 switched to datafile copy
input datafile copy RECID=3 STAMP=849582366 file name=+DG_DATA/fonpett/datafile/users.306.849580663
datafile 5 switched to datafile copy
input datafile copy RECID=4 STAMP=849582366 file name=+DG_DATA/fonpett/datafile/indic_fonpet_movim_01.303.849581487
datafile 6 switched to datafile copy
input datafile copy RECID=5 STAMP=849582366 file name=+DG_DATA/fonpett/datafile/indic_fonpet_param.307.849580663
datafile 7 switched to datafile copy
input datafile copy RECID=6 STAMP=849582366 file name=+DG_DATA/fonpett/datafile/indic_fonpet_movim.300.849581487
datafile 8 switched to datafile copy
input datafile copy RECID=7 STAMP=849582366 file name=+DG_DATA/fonpett/datafile/indic_fonpet_movim_reorg0.262.849581489
datafile 9 switched to datafile copy
input datafile copy RECID=8 STAMP=849582366 file name=+DG_DATA/fonpett/datafile/ts_fonpet_param.305.849580663
datafile 10 switched to datafile copy
input datafile copy RECID=9 STAMP=849582366 file name=+DG_DATA/fonpett/datafile/ts_fonpet_movim_01.304.849581487
datafile 11 switched to datafile copy
input datafile copy RECID=10 STAMP=849582366 file name=+DG_DATA/fonpett/datafile/indic_fonpet_movim_02.301.849581487
datafile 12 switched to datafile copy
input datafile copy RECID=11 STAMP=849582366 file name=+DG_DATA/fonpett/datafile/ts_fonpet_movim_02.264.849581487
datafile 13 switched to datafile copy
input datafile copy RECID=12 STAMP=849582366 file name=+DG_DATA/fonpett/datafile/ts_fonpet_rep.308.849580663
datafile 14 switched to datafile copy
input datafile copy RECID=13 STAMP=849582366 file name=+DG_DATA/fonpett/datafile/ts_fonpet_movim.263.849580661
datafile 15 switched to datafile copy
input datafile copy RECID=14 STAMP=849582366 file name=+DG_DATA/fonpett/datafile/ts_fonpet_movim.302.849581487
Reenabling controlfile options for auxiliary database
Executing: alter database force logging
 
contents of Memory Script:
{
   Alter clone database open resetlogs;
}
executing Memory Script
 
database opened
Finished Duplicate Db at 07/06/2014 03:06:20
Recovery Manager complete.

 
El avance de la restauracion puede supervisarse con los siguientes comandos:
 

SQL> SET LINES 1000
SQL> SET PAGES 1000
SQL> COL DETALLE FORMAT A40
SQL> COL STATUS FORMAT A18
SQL> COL HORAS FORMAT 99.9
SQL> COL MB/SEC FORMAT 999
SQL> COL TIME FORMAT A11
SQL> COL FILENAME FORMAT A60
SQL> COMPUTE SUM OF TOTMB ON TYPE
SQL> COMPUTE SUM OF MB ON TYPE
SQL> COL SID FORMAT 99999
SQL> BREAK ON TYPE SKIP 1
SQL> COL DETALLE NOPRINT
 
SQL> SELECT B.TYPE, S.STATUS ||'/'|| DECODE(B.STATUS,'UNKNOWN','',B.STATUS) STATUS, TO_CHAR(CLOSE_TIME, 'MM/DD HH:MI') AS TIME, S.SID,
S.OSUSER||'@'||S.MACHINE||'/'||S.terminal||'->'||SUBSTR(S.PROGRAM,1,INSTR(S.PROGRAM,' ')) AS DETALLE,
ROUND(TOTAL_BYTES/1024/1024) TOTMB, ROUND(BYTES/1024/1024) MB,
ROUND((ELAPSED_TIME)/60/60/24,1) AS HORAS, ROUND(EFFECTIVE_BYTES_PER_SECOND/1024/1024) AS "MB/SEC",
substr(FILENAME,(instr(FILENAME,'/',-1,1)+1),length(FILENAME)) FILENAME
FROM V$BACKUP_ASYNC_IO B, V$SESSION S
--FROM V$BACKUP_SYNC_IO B, V$SESSION S
WHERE B.SID = S.SID
--AND S.SID=1138
AND (B.TYPE = 'AGGREGATE' OR B.IO_COUNT != 0)
ORDER BY 1, CLOSE_TIME;
 
 
TYPE      STATUS             TIME           SID  TOTMB    MB HORAS MB/SEC FILENAME
--------- ------------------ ----------- ------ ------ ----- ----- ------ --------------------------------------------
AGGREGATE ACTIVE/            06/07 02:37    469           21    .0     21
          ACTIVE/            06/07 02:51    469        36755   1.0     45
          ACTIVE/                           469        13707
*********                                       ------ -----
sum                                                    50483
 
INPUT     ACTIVE/FINISHED    06/07 02:37    469           21    .0      7 controlfile_c-2150325182-20140606-00.bak
          ACTIVE/FINISHED    06/07 02:37    469           21    .0        control01.ctl
          INACTIVE/FINISHED  06/07 02:37      5            1    .0        archivelog_FONPETP_50pa6ijh_1_1_20140606.bak
          INACTIVE/FINISHED  06/07 02:37      5            1    .0        full_FONPETP_4upa6hdh_1_1_20140606.bak
          INACTIVE/FINISHED  06/07 02:37      5            1    .0        full_FONPETP_4tpa6hdh_1_1_20140606.bak
          ACTIVE/FINISHED    06/07 02:51    469         5101   1.0      6 full_FONPETP_4tpa6hdh_1_1_20140606.bak
          ACTIVE/IN PROGRESS                469         1662              full_FONPETP_4upa6hdh_1_1_20140606.bak
*********                                       ------ -----
sum                                                     6808
 
OUTPUT    ACTIVE/FINISHED    06/07 02:37    469     21    21    .0     21 control01.ctl
          ACTIVE/FINISHED    06/07 02:37    469   1024  1024    .0     85 ts_fonpet_rep.308.849580663
          ACTIVE/FINISHED    06/07 02:38    469   1024  1024    .0     37 undotbs1.309.849580663
          ACTIVE/FINISHED    06/07 02:38    469    100   100    .0      3 ts_fonpet_param.305.849580663
          ACTIVE/FINISHED    06/07 02:38    469    179   179    .0      5 users.306.849580663
          ACTIVE/FINISHED    06/07 02:38    469    567   567    .1     12 indic_fonpet_param.307.849580663
          ACTIVE/FINISHED    06/07 02:39    469   1134  1134    .1     13 system.310.849580661
          ACTIVE/FINISHED    06/07 02:51    469  32728 32728   1.0     40 ts_fonpet_movim.263.849580661
          ACTIVE/IN PROGRESS                469   1894  1226              sysaux.261.849581489
          ACTIVE/IN PROGRESS                469   2500  1876              indic_fonpet_movim_reorg0.262.849581489
          ACTIVE/IN PROGRESS                469   3000  1226              ts_fonpet_movim_02.264.849581487
          ACTIVE/IN PROGRESS                469   3303  2822              indic_fonpet_movim.300.849581487
          ACTIVE/IN PROGRESS                469   5000  1226              ts_fonpet_movim.302.849581487
          ACTIVE/IN PROGRESS                469   5064  2569              indic_fonpet_movim_01.303.849581487
          ACTIVE/IN PROGRESS                469   8334  1226              ts_fonpet_movim_01.304.849581487
          ACTIVE/IN PROGRESS                469   4908  1535              indic_fonpet_movim_02.301.849581487
*********                                       ------ -----
sum                                              70780 50483
 
16 rows selected.
 
SQL> SELECT OPNAME, lpad(trunc(TIME_REMAINING/60),2,'0')||':'||lpad(((TIME_REMAINING/60)-trunc(TIME_REMAINING/60))*60,2,'0') time
FROM V$SESSION_LONGOPS
WHERE SOFAR <> TOTALWORK;
 
OPNAME                                                           TIME
---------------------------------------------------------------- -----------
RMAN: full datafile restore                                      08:45
RMAN: aggregate input                                            :

 

Una vez finalizado el proceso de clonación se procede a validar el nombre de la base de datos y el estado de los archivos de datos

 

[oracle@bdpruebas ~]$ . oraenv
ORACLE_SID = [fonpett] ? fonpett
The Oracle base remains unchanged with value /u01/app/oracle
[oracle@bdpruebas ~]$ sqlplus dba_fonpet as sysdba
 
SQL*Plus: Release 11.2.0.3.0 Production on Sat Jun 7 03:07:22 2014
 
Copyright (c) 1982, 2011, Oracle.  All rights reserved.
 
Connected to:
Oracle Database 11g Release 11.2.0.3.0 - 64bit Production
With the Automatic Storage Management option
 
SYS@fonpett> show parameter db_name
 
NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
db_name                              string      FONPETT
SYS@fonpett> show parameter db_unique_name
 
NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
db_unique_name                       string      FONPETT
SYS@fonpett> show parameter instance_name
 
NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
instance_name                        string      fonpett
SYS@fonpett> set lines 1000 pages 1000 trimspool on
SYS@fonpett> col name format a70
SYS@fonpett> select name, bytes, status from v$datafile;
NAME                                                                        BYTES STATUS
---------------------------------------------------------------------- ---------- -------
+DG_DATA/fonpett/datafile/system.310.849580661                         1189085184 SYSTEM
+DG_DATA/fonpett/datafile/sysaux.261.849581489                         1986002944 ONLINE
+DG_DATA/fonpett/datafile/undotbs1.309.849580663                       1073741824 ONLINE
+DG_DATA/fonpett/datafile/users.306.849580663                           187432960 ONLINE
+DG_DATA/fonpett/datafile/indic_fonpet_movim_01.303.849581487          5309988864 ONLINE
+DG_DATA/fonpett/datafile/indic_fonpet_param.307.849580663              594214912 ONLINE
+DG_DATA/fonpett/datafile/indic_fonpet_movim.300.849581487             3463774208 ONLINE
+DG_DATA/fonpett/datafile/indic_fonpet_movim_reorg0.262.849581489      2621440000 ONLINE
+DG_DATA/fonpett/datafile/ts_fonpet_param.305.849580663                 104857600 ONLINE
+DG_DATA/fonpett/datafile/ts_fonpet_movim_01.304.849581487             8738701312 ONLINE
+DG_DATA/fonpett/datafile/indic_fonpet_movim_02.301.849581487          5146411008 ONLINE
+DG_DATA/fonpett/datafile/ts_fonpet_movim_02.264.849581487             3145728000 ONLINE
+DG_DATA/fonpett/datafile/ts_fonpet_rep.308.849580663                  1073741824 ONLINE
+DG_DATA/fonpett/datafile/ts_fonpet_movim.263.849580661                3.4318E+10 ONLINE
+DG_DATA/fonpett/datafile/ts_fonpet_movim.302.849581487                5242880000 ONLINE
 
15 rows selected.

viernes, 25 de septiembre de 2015

Creating Encrypted RMAN Backups and Recovery

NOTA: VALIDAR EL DEFAULT DEL ALGORITH ENCRYPTION

PARA CAMBIAR.

RMAN> CONFIGURE ENCRYPTION ALGORITHM 'AES192';

RMAN> CONFIGURE ENCRYPTION ALGORITHM 'AES256';


RMAN> CONFIGURE ENCRYPTION ALGORITHM 'AES128';

old RMAN configuration parameters:
CONFIGURE ENCRYPTION ALGORITHM 'AES192';
new RMAN configuration parameters:
CONFIGURE ENCRYPTION ALGORITHM 'AES128';
new RMAN configuration parameters are successfully stored

RMAN>  CONFIGURE ENCRYPTION ALGORITHM clear;

old RMAN configuration parameters:

CONFIGURE ENCRYPTION ALGORITHM 'AES128';
RMAN configuration parameters are successfully reset to default value

RMAN> 

new RMAN configuration parameters:
CONFIGURE ENCRYPTION ALGORITHM 'AES192';
new RMAN configuration parameters are successfully stored

RMAN> CONFIGURE ENCRYPTION ALGORITHM CLEAR;

old RMAN configuration parameters:
CONFIGURE ENCRYPTION ALGORITHM 'AES192';
RMAN configuration parameters are successfully reset to default value

Creating Encrypted RMAN Backups and Recovery

It is very simple to restore the database created by RMAN using simple commands.  If someone has stolen the  backup of the database, they can easily restore it and steal all our data, too.  To prevent that from happening, encrypt the backup that has been made. By querying the v$rman_encryption_algorithms view, a list of RMAN encryption algorithms can be obtained:
SQL>
set line 200

select
algorithm_id, algorithm_name, algorithm_description, is_default
from
v$rman_encryption_algorithms;

ALGORITHM_ID ALGORITHM_NAME  ALGORITHM_DESCRIPTION        IS_DEFAULT
------------   -----------   ------------------------     ----------
1              AES128                 AES 128-bit key     YES
2              AES192                 AES 192-bit key     NO
3              AES256                 AES 256-bit key     NO
SQL>
There are three forms of encryption in Oracle 10g: transparent, password and dual mode.
  • To use transparent mode encryption, Oracle Encryption Wallet should be used.
  • To use password mode, a password should be provide by the DBA which will be used in encryption.
  • By using dual mode encryption, both above mentioned modes will be used.
In the following example, we will show how to use password mode to encrypt our backup. Use the set encryption on command and the password using the identified by command, and encrypt the backup that is taken in this session.   Use the only keyword at the end to use only password encryption.  If the keyword only is missed, RMAN uses dual mode encryption and demands the presence of Oracle Encryption Wallet, too.

    RMAN> set encryption algorithm 'AES192';

RMAN> set encryption on identified by 'oracle' only;
Backup the users tablespace:
RMAN>; backup tablespace users;
Now try to restore it:
RMAN> restore tablespace users;
ORA-19913: unable to decrypt backup
ORA-28365: wallet is not open
As this shows, it is impossible to restore already encrypted backup without using the password.  In this situation, if someone has stolen our backup, they will not be able to restore it and steal our data, too, without providing the correct password. Now provide the password and restore the backup:
RMAN> set decryption identified by 'oracle';
RMAN> restore tablespace users;

RMAN> recover database;
Using the password, tablespace is restored successfully.  If we provide a wrong password, it will not restore the backup:
RMAN> set decryption identified by 'wrong'; #wrong password
RMAN> restore tablespace users;
ORA-19913: unable to decrypt backup
ORA-28365: wallet is not open
RMAN>
By default, RMAN uses the AES 128-bit key algorithm for encryption.  The algorithm can be easily changed using the configure encryption algorithm command as follows:
RMAN> show encryption algorithm;
RMAN configuration parameters are:
configure encryption algorithm 'AES128'; #default

RMAN> configure encryption algorithm 'AES256';
new RMAN configuration parameters:
configure encryption algorithm 'AES256';
new RMAN configuration parameters are successfully stored

RMAN> show encryption algorithm;
RMAN configuration parameters are:
configure encryption algorithm 'AES256';
Again, anytime this configuration is cleared, the encryption algorithmcan be returned to its default value as follows:
RMAN> configure encryption algorithm clear;

old RMAN configuration parameters:
configure encryption algorithm 'AES256';
RMAN configuration parameters are successfully reset to default value

RMAN> show encryption algorithm;
RMAN configuration parameters are:
configure encryption algorithm 'AES128'; # default
RMAN>
To use Oracle Encryption Wallet, we need to configure RMAN to perform an encrypted backup of any tablespace or whole database automatically.  For this, use the configure encryption for command.  In the following example, we configure RMAN to create an encrypted backup of the database, and exclude users tablespace from encryption:
RMAN> show all;
RMAN configuration parameters are:
configure encryption for database off; # default
configure encryption algorithm 'AES128'; # default

RMAN> configure encryption for database on;
new RMAN configuration parameters:
configure encryption for database on;
new RMAN configuration parameters are successfully stored

RMAN> configure encryption for tablespace users off;
tablespace users will not be encrypted in future backup sets
new RMAN configuration parameters are successfully stored

RMAN> show all;
RMAN configuration parameters are:
configure encryption for database on;
configure encryption algorithm 'AES128'; # default
configure encryption for tablespace 'users' off;
To return back to default value, clear the encryption configuration parameter:
RMAN> configure encryption for database clear;
old RMAN configuration parameters:
configure encryption for database on;
RMAN configuration parameters are successfully reset to default value 

RMAN> configure encryption for tablespace users clear;
tablespace users will default to database encryption configuration
old RMAN configuration parameters are successfully deleted

RMAN> show all;
RMAN configuration parameters are:
configure encryption for database off; # default


jueves, 24 de septiembre de 2015

CAMBIAR REDUNDANCY +ASM

Change ASM disk group from normal redundancy to external redundancy


Hello,
1
When the disk group was created with normal redundancy, the only way to change is to drop the disk group and recreate a new one.
1) shutdown database
shutdown immediate;
2) startup in mount mode
startup mount;
3) make database full backup, archivelog backup, spfile backup and controlfile backup
RMAN> backup device type disk format '/u02/backup/backup/database_backup%U' database;

RMAN> backup device type disk format '/u02/backup/backup/archivelog%U' archivelog all;

SQL>  create pfile='/u02/backup/initorcl.ora' from spfile;

SQL>  alter database backup controlfile to '/u02/backup/control.ctl';
4) shutdown database;
shutdown immediate;
5) login as sysasm and drop disk group
[oracle@oel6 backup]$ . oraenv
ORACLE_SID = [orcl] ? +ASM
sqlplus / as sysasm

SQL> drop diskgroup DISKS including contents;

SQL> shutdown immedaite;

SQL> startup nomount;
6) run asmca and create new disk group with external redundancy
2
SQL> select status from v$instance;
STATUS
————
STARTED
7) ASM instance is already started, now we must restore database and all related files.
[oracle@oel6]$ . oraenv
ORACLE_SID = [+ASM] ? orcl
sqlplus / as sysdba

SQL> startup nomount pfile='/u02/backup/initorcl.ora';

SQL> create spfile='+DISKS' from pfile='/u02/backup/initorcl.ora';

SQL> !rman target /

RMAN> restore controlfile from '/u02/backup/control.ctl';

RMAN> alter database mount;

RMAN> restore database;

RMAN> recover database;

unable to find archived log
archived log thread=1 sequence=8
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of recover command at 09/25/2013 12:11:31
RMAN-06054: media recovery requesting unknown archived log for thread 1 with sequence 8 and starting SCN of 21904164
While recovery it will give an error for archive log missing, this is expected we need to open the database with resetlogs as
RMAN> alter database open resetlogs;
8)
for using correct spfile:
ASMCMD> cp '/u0/app/oracle/product/11.2.0/dbhome_1/dbs/spfileorcl.ora' '+DISKS/ORCL/spfileorcl.ora' 
delete spfile from file system
rm -rf /u0/app/oracle/product/11.2.0/dbhome_1/dbs/spfileorcl.ora
edit /u0/app/oracle/product/11.2.0/dbhome_1/dbs/initorcl.ora, which must contains link to our spfile in disk group.
*.SPFILE='+DISKS/orcl/spfileorcl.ora'
3
that’s all.

miércoles, 23 de septiembre de 2015

jueves, 17 de septiembre de 2015

Guia Basica RMAN

Guía Básica de RMAN (actualizada)


Conexión a RMAN

La forma más simple de conectarse a RMAN es la siguiente (con el usuario oracle):
$ rman target /

Recovery Manager: Release 10.2.0.1.0 - Production on Wed Mar 8 13:16:22 2006

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

connected to target database: LCBDPROD (DBID=2582320114)

RMAN>
Si queremos que nuestras actividades se registren en un archivo log:
$ rman target / log /ruta/archivo.log [append]

Parámetros de configuración de RMAN

RMAN viene configurado con una serie de parámetros predefinidos, mismos que podemos ver con el comando show:
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 '/oracle/10.2.0/dbs_1/dbs/snapcf_LCBDPROD1.f'; 
 # default

Respaldos incrementales

Un respaldo incremental consta de dos niveles: 0 (respaldo completo de la base de datos y que sirve de base a los respaldos incrementales) y 1 (respaldos incrementales en los que solamente se respaldan los bloques que han cambiado desde el último respaldo). Adicionalmente, es posible “actualizar” el respaldo de nivel 0 con los cambios del respaldo de nivel 1. Un respaldo de este tipo se haría de la siguiente forma:
Paso 1. Respaldo completo (nivel 0):
RMAN> backup incremental level 0 tag ‘INC_L0’ database ;
Paso 2: Primer respaldo incremental (nivel 1):
RMAN> backup incremental level 1 for recover of copy tag ‘INC_L0’ database ;
Paso 3: Aplicar el respaldo incremental al respaldo de nivel 0, es decir, aplicar los cambios en los bloques al respaldo base.
RMAN> recover copy of database with tag ‘INC_L0’ ;
Para que el desempeño del respaldo incremental sea óptimo, es necesario habilitar la opción llamada block change tracking, que es un archivo que lleva el registro de los bloques que van cambiado desde el último respaldo. Si no está habilitado, RMAN tiene que leer todos los bloques de la base de datos para determinar cual respaldar, haciendo el respaldo tan caro como un full backup. Para habilitar block change tracking:
SQL> ALTER DATABASE ENABLE BLOCK CHANGE TRACKING ;
El archivo de tracking se genera automáticamente en el área de flashback.

Respaldo de los respaldos

Si los respaldos se están haciendo en flashback recovery area, es conveniente respaldar también esta área que se encuentra en disco.
RMAN> backup recovery area ;
Esto respalda todos los archivos de recuperación en flashback recovery area: full backups, copies, incrementals, respaldos de controlfiles, y archivelogs. No se respaldan block change tracking files, controfiles actuales ni redo logs. El único destino válido para estos respaldos es cinta.

Políticas de retención

Las políticas de retención nos ayudan a determinar qué respaldos todavía son necesarios y cuáles ya no debido a que han quedado obsoletos por un respaldo más reciente. Hay dos tipos de políticas de retención y son mutuamente excluyentes: redundancy y recovery window.
  • Redundancy: determina cuantas copias de un archivo se necesitan antes de considerar una copia obsoleta. Si la redundancia es 1, cada que se respalde un archivo (copia), todas las copias anteriores son obsoletas. REDUNDANCY=1 es la política de retención por default.
  • Recovery Window: determina el tiempo que debe ser retenido un archivo antes de ser obsoleto.
Para cambiar la política de retención:
RMAN> configure retention policy to redundancy X ;
ó
RMAN> configure retention policy to recovery window of X days ;
Con nuestra política definida, podemos revisar los respaldos que ya son obsoletos:
RMAN> report obsolete ;
Y borrarlos si determinamos que ya no son necesarios:
RMAN> delete obsolete ; <-- borrar="" nos="" pregunta="" queremos="" realmente="" rman="" si=""> delete force noprompt obsolete ; <-- borra="" confirmaci="" n.="" pre="" sin="">Oracle automáticamente borrará respaldos obsoletos si flashback recovery area comienza a tener problemas de espacio.

Configuración de cintas

RMAN no puede escribir directamente a cintas, por lo que es necesario configurar una librería que generalmente es proporcionada por el fabricante de la unidad de respaldo a cinta. En versiones anteriores de RMAN dicha librería se configuraba en $ORACLE_HOME/lib, sin embargo, en 10g Oracle recomienda que se especifique la librería directamente:
RMAN> configure channel device type sbt
2> parms= ‘SBT_LIBRARY=/path/librería’ ;

Reporte de operaciones

Podemos usar los comandos LIST y REPORT para generar reportes de actividades realizadas con RMAN:
list backup summary;
list backup by datafile;
list backup of database;
list backup of archivelog all;
list backup of controlfile;
report obsolete ;
report need backup ;

Scripts

Archivos de comandos: Un archivo de comandos es un archivo de texto conteniendo comandos RMAN, y que puede ser llamado de la siguiente forma:
RMAN> @/ruta/script.txt 
ó 
$ rman target / @/ruta/script.txt
Comando RUN: El comando RUN agrupa comandos de RMAN para ser ejecutados como uno solo. Si uno de los comandos falla, el resto ya no es ejecutado.
RUN {
 BACKUP ARCHIVELOG ALL DELETE ALL INPUT;
 BACKUP INCREMENTAL LEVEL 0 TAG mon_bkup DATABASE;
}

Casos de recuperación

Se puede ejecutar el comando RESTORE … VALIDATE para confirmar que una operación puede ser ejecutada correctamente. RMAN automáticamente decide qué archivos son necesarios para la recuperación y verifica que sean utilizables.
RMAN> restore database validate ;
Caso 1. Recuperación completa de la base de datos cuando se tiene el archivo de control y la base de datos está montada:
RMAN> restore database ;
RMAN> recover database ;
Caso 2. Se tiene la situación del caso 1 pero se desea recuperar a un punto pasado en el tiempo:
RMAN> run {set until time = ’04-MAR-06 12:00:00’;
2> restore database ;
3> recover database ;
4> }
Caso 3. Recuperación de un datafile
Identificar el número de datafile:
SQL> select file#, name from v$datafile ;

Poner offline el datafile, ya sea desde SQL*Plus o desde RMAN:
RMAN> sql ‘alter database datafile 8 offline’ ;

Recuperar el datafile:
RMAN> run {restore datafile 8 ;
2> recover datafile 8 ;
3> sql ‘alter database datafile 8 online’ ;
4> }
Caso 4. Recuperación de un tablespace.
RMAN> run {sql ‘alter tablespace users offline’ ;
2> restore tablespace users ;
3> recover tablespace users ;
4> sql ‘alter tablespace users online’ ;
5> }
El comando run es para correr las instrucciones en modo script, pero también pueden ser ejecutadas una por una:
RMAN> sql ‘alter tablespace users offline’ ;
RMAN> restore tablespace users ;
RMAN> recover tablespace users ;
RMAN> sql ‘alter tablespace users online’ ;
Caso 5. Recuperación de bloques corruptos RMAN es la herramienta ideal para recuperación de bloques corruptos (ORA-1578). El error nos dice cuál es el bloque corrupto:
ORA-1578: ORACLE data block corrupted (file # 7, block # 1234)
Mismos que también podemos consultar en la vista v$database_block_corruption. Para recuperar todos los bloques corruptos:
RMAN> blockrecover corruption list ;
O podemos recuperar bloques individuales:
RMAN> blockrecover datafile 7 block 1234[, datafile 10 block 3265, ...] ;

miércoles, 19 de agosto de 2015

.PROFILE ORACLE RAC

case ${SHELL} in
*bash)
    typeset +x PS1="\u@\h:\w\\$ "
    ;;
esac
export AWT_TOOLKIT=XToolkit
export ORACLE_BASE=/u01/app/oracledb
export ORACLE_HOME=/u01/app/oracledb/product/11.2.0/db_1
export ORACLE_SID=orclrac1
export NLS_DATE_FORMAT='DD/MM/YYYY HH24:MI:SS'
export PATH=$ORACLE_HOME/bin:$ORACLE_HOME/OPatch:/usr/sbin:/bin:/usr/X11/bin:/usr/dt/bin:/usr/openwin/bin:/usr/ccs/bin:/usr/local/bin::/usr/local/bin:/home/oracle:.
export LD_LIBRARY_PATH=$ORACLE_HOME/lib:$ORACLE_HOME/oracm/lib
export CLASSPATH=$ORACLE_HOME/jdbc:$ORACLE_HOME/jlib:$ORACLE_HOME/rdbms/jlib$ORACLE_HOME/network/jlib
export TEMP=/tmp
export TMPDIR=/tmp
ulimit -n 65536

# Alias
alias sql='sqlplus / as sysdba'

lunes, 3 de agosto de 2015

ORACLE VM


En el sitio:



1) Medio de oracle linux 6u6

Oracle Linux Release 6 Update 6 for x86_64 (64 Bit)          V52218-01          3.7G


2) Oracle VM

Oracle VM Server 3.3.2 for x86_64 (64 bit)            V75786-01          545M

Oracle VM Manager 3.3.1            V75789-01          2.6G

3) Oracle Virtual Appliance


Oracle VM Template for Oracle Enterprise Manager Cloud 12c Release 4 (12.1.0.4.0) 12.1.0.4.0 Disk 1of5      V45413-01          4.1G

Oracle VM Template for Oracle Enterprise Manager Cloud 12c Release 4 (12.1.0.4.0) 12.1.0.4.0 Disk 2of5      V45414-01          4.1G

Oracle VM Template for Oracle Enterprise Manager Cloud 12c Release 4 (12.1.0.4.0) 12.1.0.4.0 Disk 3of5      V45415-01          4.1G

Oracle VM Template for Oracle Enterprise Manager Cloud 12c Release 4 (12.1.0.4.0) 12.1.0.4.0 Disk 4of5      V45416-01          4.1G

Oracle VM Template for Oracle Enterprise Manager Cloud 12c Release 4 (12.1.0.4.0) 12.1.0.4.0 Disk 5of5      V45417-01          2.5G

mount /dev/sr0 /mnt
 
services iptables off
chconfig iptables off

Parchar El oms
cd bin en middleware
./encli login -username sysman
welcome1
./emcli import -update -file=parche