Symptoms
This is a Data Guard configuration.Logs from primary are shipped to the standby site and there is an apply delay of 24 hours in place.Archivelogs are backed up on the primary site with DELETE INPUT option but occasionally, whenthere is a gap in the log sequence on the standby site (which can be forced by deferring thestandby log destination) rman will stop deleting logs after backup, raising the following warning for every log:WARNING: archive log not deleted, not yet applied by standbyFrom this point onwards, no logs are deleted from the primary site.
The same problem can occur if archiving is interrupted for any reason; once this occurs, no logs from the Primary site can be deleted when 'backup archivelog all delete input' is used.
Cause
Bug 4919478: Some archived logs successfully applied to standby are not removed by RMAN'backup archivelog all delete input' command..
Solution
Do not use 'delete input' option to housekeep archivelogs after backup. Instead:
Change:
RMAN> backup archivelog all delete input;
To something like:
RMAN> backup archivelog all not backed up 2 times;
delete noprompt archivelog until time 'sysdate -2' backed up 2 times to device type sbt;
Change the time spec according to your requirements - this example retains 2 days worth of archivelogs on disk.
This is the recommended method for housekeeping logs in a Data Guard environment - see
martes, 31 de marzo de 2009
miércoles, 18 de marzo de 2009
Identificación de Índices inutilizados
Esto se logra con el comando ALTER INDEX MONITORING USAGE
Esto es de mucha ayuda ya que nos ayuda con los siguientes problemas.
- Consumen espacio que puede ser muy necesario.
- Degrada el rendimiento a causa de una innecesaria sobre carga durante operaciones DML.
La información que aquí se presenta es en base a notas de metalink 136642.
¿Cómo identificamos un Índice que no se está utilizando?.
1.- Hay que poner el índice bajo monitoreo.
SQL> alter index I_EMP monitoring usage;
Index altered.
SQL> select * from v$object_usage;
INDEX_NAME TABLE_NAME MON USED START_MONITORING END_MONITORING
--------------- --------------- --- ---- ------------------- -------------------
I_EMP EMP YES NO 03/14/2001 09:17:19
2.- Checar si el índice está usando la columna USED en V$OBJECT_USAGE
SQL> select sal from emp where ename='SMITH';
SAL
----------
800
Execution Plan
----------------------------------------------------------
0 SELECT STATEMENT Optimizer=CHOOSE
1 0 TABLE ACCESS (BY INDEX ROWID) OF 'EMP'
2 1 INDEX (RANGE SCAN) OF 'I_EMP' (NON-UNIQUE)
The explain plan indicates the index is used.
SQL> select * from v$object_usage;
INDEX_NAME TABLE_NAME MON USED START_MONITORING END_MONITORING
--------------- --------------- --- ---- ------------------- -------------------
I_EMP EMP YES YES 03/14/2001 09:17:19
Si el índice no está en uso entonces podremos borrar el índice.
3.- Para detener el monitoreo en algún indice lo hacemos con el comando siguiente.
SQL> alter index i_emp nomonitoring usage; Index altered.
SQL> select * from v$object_usage;
INDEX_NAME TABLE_NAME MON USED START_MONITORING END_MONITORING
--------------- --------------- --- ---- ------------------- -------------------
I_EMP EMP NO YES 03/14/2001 09:17:19 03/14/2001 09:55:24
Una vez que se active de nuevo el monitoreo la columna la columna de MONITORING y USAGE se vuelven a limpiar.
martes, 17 de marzo de 2009
Pasos para generar una standby database
Pasos para generar una standby database.
BD PRIMARIA
1.- Verificar que este en archived log.
Enable Forced Logging
SQL> ALTER DATABASE FORCE LOGGING;
SQL> archive log list
Database log mode Archive Mode
Automatic archival Enabled
Archive destination /u07/ordm030/oraarch
Oldest online log sequence 31
Next log sequence to archive 33
Current log sequence 33
2.- Crear un pfile para la standby.
NOTA: Antes se debe verificar que la BD este trabajando con SPFILE.
SQL> create pfile=’/u01/standby.ora’ from spfile;
Pasar el pfile que se genero al HOST donde va a vivir el dataguard.
3.- Modificar parametros en archivo de dataguard.
Cambiar los siguientes paramentros en el archivo PFILE en el host del dataguard /u01/standby.ora con un editor ejemplo “vi” con los valores que le correspondan.
#CAMBIOS PARA STANDBY
*.log_archive_dest_1='LOCATION=/u07/oracle/oraarch'
*.log_archive_format='fcrdm004_%t_%s.arc'
*.standby_archive_dest='/u07/oracle/oraarch'
*.remote_archive_enable = TRUE
*.standby_file_management=manual
*.log_archive_start=TRUE
NOTA: EN CASO DE QUE LAS RUTAS SEAN DIFERENTES TAMBIEN TENEMOS QUE MODIFICAR LAS RUTAS DE LOS ARCHIVOS COMO UDUMP,CDUMP,BDUMP,Archives, etc.
4.- Levantar la BD standby en modo nomount.
Antes verificar variables de ambiente
SQL> startup pfile=’/u01/standby.ora’ nomount;
Agregar entrada en el tnsnames de la BD productiva.
Configurar listener en BD standby en el server alterno.
5.- En la BD productiva
Agregar entrada en el tnsnames de la BD standby con el alias de standby. Y probar conexión Tnsping.
Y hacer los siguientes cambios en los parametros.
*.log_archive_dest_1='LOCATION=/u01/ordm004/oraarch'
*.log_archive_format='fcrdm004_%t_%s.arc'
*.log_archive_dest_2= ‘SERVICE=standby DELAY=720' SCOPE=BOTH;
*.log_archive_dest_state_1=ENABLE
*.log_archive_dest_state_2=ENABLE
*.log_archive_start=TRUE
Para poder hacer estas modificaciones la BD tiene que estar corriendo con el SPFILE y se hacen con el comando alter system set desde SQL.El delay es el tiempo en minutos de debaran pasar para aplicar el archivo archive.
6.- Respaldar BD productiva.
Antes de hacer el respaldo se debe verificar que la BD este registradae en el catalog. Y que tenga la entrada en el tnsnames de la BD de rman.
oracle@rp7410-fcret1n2> /u01/oracle/product/9.2.0/bin/rman target / CATALOG rman/rman@fcogridc
run
{
allocate channel ch01 type 'SBT_TAPE'
parms 'ENV=(NSR_SERVER=fconwbck.femcom.net,NSR_DATA_VOLUME_POOL=POOL ORACLE FCRDM030 SEMANAL),SBT_LIBRARY=/u01/oracle/product/9
.2.0/lib/libobk.sl';
allocate channel ch02 type 'SBT_TAPE'
parms 'ENV=(NSR_SERVER=fconwbck.femcom.net,NSR_DATA_VOLUME_POOL=POOL ORACLE FCRDM030 SEMANAL),SBT_LIBRARY=/u01/oracle/product/9
.2.0/lib/libobk.sl';
allocate channel ch03 type 'SBT_TAPE'
parms 'ENV=(NSR_SERVER=fconwbck.femcom.net,NSR_DATA_VOLUME_POOL=POOL ORACLE FCRDM030 SEMANAL),SBT_LIBRARY=/u01/oracle/product/9
.2.0/lib/libobk.sl';
allocate channel ch04 type 'SBT_TAPE'
parms 'ENV=(NSR_SERVER=fconwbck.femcom.net,NSR_DATA_VOLUME_POOL=POOL ORACLE FCRDM030 SEMANAL),SBT_LIBRARY=/u01/oracle/product/9
.2.0/lib/libobk.sl';
allocate channel ch05 type 'SBT_TAPE'
parms 'ENV=(NSR_SERVER=fconwbck.femcom.net,NSR_DATA_VOLUME_POOL=POOL ORACLE FCRDM030 SEMANAL),SBT_LIBRARY=/u01/oracle/product/9
.2.0/lib/libobk.sl';
allocate channel ch06 type 'SBT_TAPE'
parms 'ENV=(NSR_SERVER=fconwbck.femcom.net,NSR_DATA_VOLUME_POOL=POOL ORACLE FCRDM030 SEMANAL),SBT_LIBRARY=/u01/oracle/product/9
.2.0/lib/libobk.sl';
allocate channel ch07 type 'SBT_TAPE'
parms 'ENV=(NSR_SERVER=fconwbck.femcom.net,NSR_DATA_VOLUME_POOL=POOL ORACLE FCRDM030 SEMANAL),SBT_LIBRARY=/u01/oracle/product/9
.2.0/lib/libobk.sl';
allocate channel ch08 type 'SBT_TAPE'
parms 'ENV=(NSR_SERVER=fconwbck.femcom.net,NSR_DATA_VOLUME_POOL=POOL ORACLE FCRDM030 SEMANAL),SBT_LIBRARY=/u01/oracle/product/9
.2.0/lib/libobk.sl';
backup incremental level 0 database
include current controlfile for standby;
sql "alter system archive log current";
backup archivelog all format 'fcrdm030_%t_%s.arc' delete input;
release channel ch01;
release channel ch02;
release channel ch03;
release channel ch04;
release channel ch05;
release channel ch06;
release channel ch07;
release channel ch08;
}
Nota: se debe incluir la sentencia include current controlfile for standby;
Para poder hacer el restore desde rman.Tambien se deberan cambiar
7.- Restaurar la BD en el HOST del DataGuard.
En el host del Datagurd correr el comando de rman que va a duplicar y activar la standby.
NOTA:La BD standby debera estar montada y debe de ser conectada como auxiliar en RMAN.
rman target sys/dba2f3mc0@FCRDM030 CATALOG rman/rman@fcogridc auxiliary / trace /home/ordm007/duplicate_FCRDM007.log
run
{
allocate auxiliary channel ch01 type 'SBT_TAPE'
parms 'ENV=(NSR_SERVER=10.80.8.172,NSR_CLIENT=10.80.1.145,NSR_DATA_VOLUME_POOL=POOL ORACLE FCRDM030 SEMANAL),SBT_LIBRARY=/u01/ordmprd/product/9
.2.0/lib/libobk.so';
allocate auxiliary channel ch02 type 'SBT_TAPE'
parms 'ENV=(NSR_SERVER=10.80.8.172,NSR_CLIENT=10.80.1.145,NSR_DATA_VOLUME_POOL=POOL ORACLE FCRDM030 SEMANAL),SBT_LIBRARY=/u01/ordmprd/product/9
.2.0/lib/libobk.so';
allocate auxiliary channel ch03 type 'SBT_TAPE'
parms 'ENV=(NSR_SERVER=10.80.8.172,NSR_CLIENT=10.80.1.145,NSR_DATA_VOLUME_POOL=POOL ORACLE FCRDM030 SEMANAL),SBT_LIBRARY=/u01/ordmprd/product/9
.2.0/lib/libobk.so';
allocate auxiliary channel ch04 type 'SBT_TAPE'
parms 'ENV=(NSR_SERVER=10.80.8.172,NSR_CLIENT=10.80.1.145,NSR_DATA_VOLUME_POOL=POOL ORACLE FCRDM030 SEMANAL),SBT_LIBRARY=/u01/ordmprd/product/9
.2.0/lib/libobk.so';
allocate auxiliary channel ch05 type 'SBT_TAPE'
parms 'ENV=(NSR_SERVER=10.80.8.172,NSR_CLIENT=10.80.1.145,NSR_DATA_VOLUME_POOL=POOL ORACLE FCRDM030 SEMANAL),SBT_LIBRARY=/u01/ordmprd/product/9
.2.0/lib/libobk.so';
allocate auxiliary channel ch06 type 'SBT_TAPE'
parms 'ENV=(NSR_SERVER=10.80.8.172,NSR_CLIENT=10.80.1.145,NSR_DATA_VOLUME_POOL=POOL ORACLE FCRDM030 SEMANAL),SBT_LIBRARY=/u01/ordmprd/product/9
.2.0/lib/libobk.so';
allocate auxiliary channel ch07 type 'SBT_TAPE'
parms 'ENV=(NSR_SERVER=10.80.8.172,NSR_CLIENT=10.80.1.145,NSR_DATA_VOLUME_POOL=POOL ORACLE FCRDM030 SEMANAL),SBT_LIBRARY=/u01/ordmprd/product/9
.2.0/lib/libobk.so';
allocate auxiliary channel ch08 type 'SBT_TAPE'
parms 'ENV=(NSR_SERVER=10.80.8.172,NSR_CLIENT=10.80.1.145,NSR_DATA_VOLUME_POOL=POOL ORACLE FCRDM030 SEMANAL),SBT_LIBRARY=/u01/ordmprd/product/9
.2.0/lib/libobk.so';
duplicate target database for standby NOFILENAMECHECK
dorecover;
release channel ch01;
release channel ch02;
release channel ch03;
release channel ch04;
release channel ch05;
release channel ch06;
release channel ch07;
release channel ch08;
}
8.- VERIFICAR QUE LOS ARCHIVES SE ESCRIBAN EN LA BD DATAGUARD.
Checar en el alert log de la BD productiva para la vlidar que los este mandando par al bd standby asi como en el filesystem de host de la standby.
Y en la vista v$archived_log
Procedimiento para activar y desactivar el standby database de México.
1.- Para cancel el proceso de recuperación y dar de baja la BD.
Con el usuario ORDM007 (ya tiene cargadas las variables de ambiente en el .profile)
ordm007@rx8640-fcrdmdb2 > sqlplus /nolog
SQL> conn /as sysdba
SQL> recover managed standby database cancel;
Para bajar la Base de Datos.
SQL> shutdown immediate;
2.- Arrancar la BD standby
Con el usuario ORDM007 (ya tiene cargadas las variables de ambiente en el .profile)
ordm007@rx8640-fcrdmdb2 > sqlplus /nolog
SQL> conn /as sysdba
SQL> startup nomunt;
SQL> alter database mount standby database;
3.- Para activar el proceso de recuperación.
SQL> ALTER DATABASE RECOVER MANAGED STANDBY DATABASE DISCONNECT FROM SESSION;
4.- Para abrir la BD en modo de solo lectura
Con el usuario ORDM007 (ya tiene cargadas las variables de ambiente en el .profile)
ordm007@rx8640-fcrdmdb2 > sqlplus /nolog
SQL> conn /as sysdba
SQL> recover managed standby database cancel;
SQL> alter database open read only;
5.- Para activar la BD standby
Con el usuario ORDM007 (ya tiene cargadas las variables de ambiente en el .profile)
ordm007@rx8640-fcrdmdb2 > sqlplus /nolog
SQL> conn /as sysdba
SQL> recover managed standby database cancel;
SQL> alter database open read only; SQL> ALTER DATABASE ACTIVATE STANDBY DATABASE;
Nota: Este comando se solo y unicamente si la BD primaria esta perdida ya que esto implica volver a sincronizar las BD’s.
Procedimiento para apagar y prender una BD Oracle
Levanatr BD
Con el usuario ORDM007 (ya tiene cargadas las variables de ambiente en el .profile)
ordm007@rx8640-fcrdmdb2 > sqlplus /nolog
SQL> conn /as sysdba
SQL> startup
ordm007@rx8640-fcrdmdb2 > lsnrctl start
Bajar BD
Con el usuario ORDM007 (ya tiene cargadas las variables de ambiente en el .profile)
ordm007@rx8640-fcrdmdb2 > sqlplus /nolog
SQL> conn /as sysdba
SQL> shutdown immediate
ordm007@rx8640-fcrdmdb2 > lsnrctl stop
PARA CAMBIAR EL DELAY DE LA APLICACIÓN DE LOS ARCHIVES.ALTER SYSTEM SET LOG_ARCHIVE_DEST_2='SERVICE=standby DELAY=720' SCOPE=BOTH; Donde 720 son los minutos que la BD standby tendra que esperar despues de que se genero y de que recibio el archivo antes de aplicar los archives.
BD PRIMARIA
1.- Verificar que este en archived log.
Enable Forced Logging
SQL> ALTER DATABASE FORCE LOGGING;
SQL> archive log list
Database log mode Archive Mode
Automatic archival Enabled
Archive destination /u07/ordm030/oraarch
Oldest online log sequence 31
Next log sequence to archive 33
Current log sequence 33
2.- Crear un pfile para la standby.
NOTA: Antes se debe verificar que la BD este trabajando con SPFILE.
SQL> create pfile=’/u01/standby.ora’ from spfile;
Pasar el pfile que se genero al HOST donde va a vivir el dataguard.
3.- Modificar parametros en archivo de dataguard.
Cambiar los siguientes paramentros en el archivo PFILE en el host del dataguard /u01/standby.ora con un editor ejemplo “vi” con los valores que le correspondan.
#CAMBIOS PARA STANDBY
*.log_archive_dest_1='LOCATION=/u07/oracle/oraarch'
*.log_archive_format='fcrdm004_%t_%s.arc'
*.standby_archive_dest='/u07/oracle/oraarch'
*.remote_archive_enable = TRUE
*.standby_file_management=manual
*.log_archive_start=TRUE
NOTA: EN CASO DE QUE LAS RUTAS SEAN DIFERENTES TAMBIEN TENEMOS QUE MODIFICAR LAS RUTAS DE LOS ARCHIVOS COMO UDUMP,CDUMP,BDUMP,Archives, etc.
4.- Levantar la BD standby en modo nomount.
Antes verificar variables de ambiente
SQL> startup pfile=’/u01/standby.ora’ nomount;
Agregar entrada en el tnsnames de la BD productiva.
Configurar listener en BD standby en el server alterno.
5.- En la BD productiva
Agregar entrada en el tnsnames de la BD standby con el alias de standby. Y probar conexión Tnsping.
Y hacer los siguientes cambios en los parametros.
*.log_archive_dest_1='LOCATION=/u01/ordm004/oraarch'
*.log_archive_format='fcrdm004_%t_%s.arc'
*.log_archive_dest_2= ‘SERVICE=standby DELAY=720' SCOPE=BOTH;
*.log_archive_dest_state_1=ENABLE
*.log_archive_dest_state_2=ENABLE
*.log_archive_start=TRUE
Para poder hacer estas modificaciones la BD tiene que estar corriendo con el SPFILE y se hacen con el comando alter system set desde SQL.El delay es el tiempo en minutos de debaran pasar para aplicar el archivo archive.
6.- Respaldar BD productiva.
Antes de hacer el respaldo se debe verificar que la BD este registradae en el catalog. Y que tenga la entrada en el tnsnames de la BD de rman.
oracle@rp7410-fcret1n2> /u01/oracle/product/9.2.0/bin/rman target / CATALOG rman/rman@fcogridc
run
{
allocate channel ch01 type 'SBT_TAPE'
parms 'ENV=(NSR_SERVER=fconwbck.femcom.net,NSR_DATA_VOLUME_POOL=POOL ORACLE FCRDM030 SEMANAL),SBT_LIBRARY=/u01/oracle/product/9
.2.0/lib/libobk.sl';
allocate channel ch02 type 'SBT_TAPE'
parms 'ENV=(NSR_SERVER=fconwbck.femcom.net,NSR_DATA_VOLUME_POOL=POOL ORACLE FCRDM030 SEMANAL),SBT_LIBRARY=/u01/oracle/product/9
.2.0/lib/libobk.sl';
allocate channel ch03 type 'SBT_TAPE'
parms 'ENV=(NSR_SERVER=fconwbck.femcom.net,NSR_DATA_VOLUME_POOL=POOL ORACLE FCRDM030 SEMANAL),SBT_LIBRARY=/u01/oracle/product/9
.2.0/lib/libobk.sl';
allocate channel ch04 type 'SBT_TAPE'
parms 'ENV=(NSR_SERVER=fconwbck.femcom.net,NSR_DATA_VOLUME_POOL=POOL ORACLE FCRDM030 SEMANAL),SBT_LIBRARY=/u01/oracle/product/9
.2.0/lib/libobk.sl';
allocate channel ch05 type 'SBT_TAPE'
parms 'ENV=(NSR_SERVER=fconwbck.femcom.net,NSR_DATA_VOLUME_POOL=POOL ORACLE FCRDM030 SEMANAL),SBT_LIBRARY=/u01/oracle/product/9
.2.0/lib/libobk.sl';
allocate channel ch06 type 'SBT_TAPE'
parms 'ENV=(NSR_SERVER=fconwbck.femcom.net,NSR_DATA_VOLUME_POOL=POOL ORACLE FCRDM030 SEMANAL),SBT_LIBRARY=/u01/oracle/product/9
.2.0/lib/libobk.sl';
allocate channel ch07 type 'SBT_TAPE'
parms 'ENV=(NSR_SERVER=fconwbck.femcom.net,NSR_DATA_VOLUME_POOL=POOL ORACLE FCRDM030 SEMANAL),SBT_LIBRARY=/u01/oracle/product/9
.2.0/lib/libobk.sl';
allocate channel ch08 type 'SBT_TAPE'
parms 'ENV=(NSR_SERVER=fconwbck.femcom.net,NSR_DATA_VOLUME_POOL=POOL ORACLE FCRDM030 SEMANAL),SBT_LIBRARY=/u01/oracle/product/9
.2.0/lib/libobk.sl';
backup incremental level 0 database
include current controlfile for standby;
sql "alter system archive log current";
backup archivelog all format 'fcrdm030_%t_%s.arc' delete input;
release channel ch01;
release channel ch02;
release channel ch03;
release channel ch04;
release channel ch05;
release channel ch06;
release channel ch07;
release channel ch08;
}
Nota: se debe incluir la sentencia include current controlfile for standby;
Para poder hacer el restore desde rman.Tambien se deberan cambiar
7.- Restaurar la BD en el HOST del DataGuard.
En el host del Datagurd correr el comando de rman que va a duplicar y activar la standby.
NOTA:La BD standby debera estar montada y debe de ser conectada como auxiliar en RMAN.
rman target sys/dba2f3mc0@FCRDM030 CATALOG rman/rman@fcogridc auxiliary / trace /home/ordm007/duplicate_FCRDM007.log
run
{
allocate auxiliary channel ch01 type 'SBT_TAPE'
parms 'ENV=(NSR_SERVER=10.80.8.172,NSR_CLIENT=10.80.1.145,NSR_DATA_VOLUME_POOL=POOL ORACLE FCRDM030 SEMANAL),SBT_LIBRARY=/u01/ordmprd/product/9
.2.0/lib/libobk.so';
allocate auxiliary channel ch02 type 'SBT_TAPE'
parms 'ENV=(NSR_SERVER=10.80.8.172,NSR_CLIENT=10.80.1.145,NSR_DATA_VOLUME_POOL=POOL ORACLE FCRDM030 SEMANAL),SBT_LIBRARY=/u01/ordmprd/product/9
.2.0/lib/libobk.so';
allocate auxiliary channel ch03 type 'SBT_TAPE'
parms 'ENV=(NSR_SERVER=10.80.8.172,NSR_CLIENT=10.80.1.145,NSR_DATA_VOLUME_POOL=POOL ORACLE FCRDM030 SEMANAL),SBT_LIBRARY=/u01/ordmprd/product/9
.2.0/lib/libobk.so';
allocate auxiliary channel ch04 type 'SBT_TAPE'
parms 'ENV=(NSR_SERVER=10.80.8.172,NSR_CLIENT=10.80.1.145,NSR_DATA_VOLUME_POOL=POOL ORACLE FCRDM030 SEMANAL),SBT_LIBRARY=/u01/ordmprd/product/9
.2.0/lib/libobk.so';
allocate auxiliary channel ch05 type 'SBT_TAPE'
parms 'ENV=(NSR_SERVER=10.80.8.172,NSR_CLIENT=10.80.1.145,NSR_DATA_VOLUME_POOL=POOL ORACLE FCRDM030 SEMANAL),SBT_LIBRARY=/u01/ordmprd/product/9
.2.0/lib/libobk.so';
allocate auxiliary channel ch06 type 'SBT_TAPE'
parms 'ENV=(NSR_SERVER=10.80.8.172,NSR_CLIENT=10.80.1.145,NSR_DATA_VOLUME_POOL=POOL ORACLE FCRDM030 SEMANAL),SBT_LIBRARY=/u01/ordmprd/product/9
.2.0/lib/libobk.so';
allocate auxiliary channel ch07 type 'SBT_TAPE'
parms 'ENV=(NSR_SERVER=10.80.8.172,NSR_CLIENT=10.80.1.145,NSR_DATA_VOLUME_POOL=POOL ORACLE FCRDM030 SEMANAL),SBT_LIBRARY=/u01/ordmprd/product/9
.2.0/lib/libobk.so';
allocate auxiliary channel ch08 type 'SBT_TAPE'
parms 'ENV=(NSR_SERVER=10.80.8.172,NSR_CLIENT=10.80.1.145,NSR_DATA_VOLUME_POOL=POOL ORACLE FCRDM030 SEMANAL),SBT_LIBRARY=/u01/ordmprd/product/9
.2.0/lib/libobk.so';
duplicate target database for standby NOFILENAMECHECK
dorecover;
release channel ch01;
release channel ch02;
release channel ch03;
release channel ch04;
release channel ch05;
release channel ch06;
release channel ch07;
release channel ch08;
}
8.- VERIFICAR QUE LOS ARCHIVES SE ESCRIBAN EN LA BD DATAGUARD.
Checar en el alert log de la BD productiva para la vlidar que los este mandando par al bd standby asi como en el filesystem de host de la standby.
Y en la vista v$archived_log
Procedimiento para activar y desactivar el standby database de México.
1.- Para cancel el proceso de recuperación y dar de baja la BD.
Con el usuario ORDM007 (ya tiene cargadas las variables de ambiente en el .profile)
ordm007@rx8640-fcrdmdb2 > sqlplus /nolog
SQL> conn /as sysdba
SQL> recover managed standby database cancel;
Para bajar la Base de Datos.
SQL> shutdown immediate;
2.- Arrancar la BD standby
Con el usuario ORDM007 (ya tiene cargadas las variables de ambiente en el .profile)
ordm007@rx8640-fcrdmdb2 > sqlplus /nolog
SQL> conn /as sysdba
SQL> startup nomunt;
SQL> alter database mount standby database;
3.- Para activar el proceso de recuperación.
SQL> ALTER DATABASE RECOVER MANAGED STANDBY DATABASE DISCONNECT FROM SESSION;
4.- Para abrir la BD en modo de solo lectura
Con el usuario ORDM007 (ya tiene cargadas las variables de ambiente en el .profile)
ordm007@rx8640-fcrdmdb2 > sqlplus /nolog
SQL> conn /as sysdba
SQL> recover managed standby database cancel;
SQL> alter database open read only;
5.- Para activar la BD standby
Con el usuario ORDM007 (ya tiene cargadas las variables de ambiente en el .profile)
ordm007@rx8640-fcrdmdb2 > sqlplus /nolog
SQL> conn /as sysdba
SQL> recover managed standby database cancel;
SQL> alter database open read only; SQL> ALTER DATABASE ACTIVATE STANDBY DATABASE;
Nota: Este comando se solo y unicamente si la BD primaria esta perdida ya que esto implica volver a sincronizar las BD’s.
Procedimiento para apagar y prender una BD Oracle
Levanatr BD
Con el usuario ORDM007 (ya tiene cargadas las variables de ambiente en el .profile)
ordm007@rx8640-fcrdmdb2 > sqlplus /nolog
SQL> conn /as sysdba
SQL> startup
ordm007@rx8640-fcrdmdb2 > lsnrctl start
Bajar BD
Con el usuario ORDM007 (ya tiene cargadas las variables de ambiente en el .profile)
ordm007@rx8640-fcrdmdb2 > sqlplus /nolog
SQL> conn /as sysdba
SQL> shutdown immediate
ordm007@rx8640-fcrdmdb2 > lsnrctl stop
PARA CAMBIAR EL DELAY DE LA APLICACIÓN DE LOS ARCHIVES.ALTER SYSTEM SET LOG_ARCHIVE_DEST_2='SERVICE=standby DELAY=720' SCOPE=BOTH; Donde 720 son los minutos que la BD standby tendra que esperar despues de que se genero y de que recibio el archivo antes de aplicar los archives.
Lost current Redo Log file
1. startup error message
ORA-00313: open failed for members of log group 1 of thread 1
ORA-00312: online log 1 thread 1: 'D:\ORACLE\ORADATA\TEST\REDO01.LOG'
ORA-27041: unable to open file
OSD-04002: unable to open file
O/S-Error: (OS 2) cannot find file
5.1.2 Current Redolog CorruptionTwo case:A. shutdown normally, no transaction to recovery, recreate log group with 'alter database clear unarchived logfile group n'B. active transaction exists. database need media recovery. log group need synchronized. there are 2 methods:a. imcomplete recovery. keep the consistence of database. but this method requires archivelog mode and valid backup.b. force recovery. but may cause inconsistence.
5.1.2.1 recovery with backup1. accounting a error when open database
ORA-00313: open failed for members of log group 1 of thread 1
ORA-00312: online log 1 thread 1: 'D:\ORACLE\ORADATA\TEST\REDO01.LOG'
ORA-27041: unable to open file
OSD-04002: unable to open file
O/S-Error: (OS 2) OS cannot found file
2. check V$log, and notice the current redolog corrupted
SQL> select group#,sequence#,archived,status from v$log;
GROUP# SEQUENCE# ARCHIVED STATUS
---------- ---------- -------- ----------------
1 1 NO CURRENT
2 2 YES INACTIVE
3 3 YES INACTIVE
3. cannot clear the current redolog
SQL> alter database clear unarchived logfile group 1;
alter database clear unarchived logfile group 1
*
ERROR at line 1:
ORA-01624: log 1 needed for crash recovery of thread 1
ORA-00312: online log 1 thread 1: 'D:\ORACLE\ORADATA\TEST\REDO01.LOG'
4. copy a full backup and recover database
until scn or until cnacel
recover database until cancel
select auto recover with all the valid archivelogs and redologs, and
recover database until cancel
enter cancel to do a incomplete recovery (that's need recover twice)
Example:
SQL> recover database until cancel;
Auto
...
SQL> recover database until cancel;
Cancel;
5. open database with: alter database open resetlogsDescription:1. incomplete recovery may cause data lost of current redolog.2. need archivelog mode and full backup.3. backup database after recovery.4. strongly recomment that make log mirror on different disks.
5.1.2.2 force recovery without backup1. accounting a error
ORA-00313: open failed for members of log group 1 of thread 1
ORA-00312: online log 1 thread 1: 'D:\ORACLE\ORADATA\TEST\REDO01.LOG'
ORA-27041: unable to open file
OSD-04002: unable to open file
O/S-Error: (OS 2)
2、notice curruent redolog corrupted
SQL> select group#,sequence#,archived,status from v$log;
GROUP# SEQUENCE# ARCHIVED STATUS
---------- ---------- -------- ----------------
1 1 NO CURRENT
2 2 YES INACTIVE
3 3 YES INACTIVE
3、cannot clear
SQL> alter database clear unarchived logfile group 1;
alter database clear unarchived logfile group 1
*
ERROR at line 1:
ORA-01624: log 1 needed for crash recovery of thread 1
ORA-00312: online log 1 thread 1: 'D:\ORACLE\ORADATA\TEST\REDO01.LOG'
4、shutdown database
SQL>shutdown immediate
5、add the following parameter to init.ora
_allow_resetlogs_corruption=TRUE
6、restart database and recover with 'until cancel'
SQL>recover database until cancel;
Cancel
SQL>alter database open resetlogs;
7、full export database after open database successfully
8、shutdown database, remove init parameter
_all_resetlogs_corrupt
9、recreate database
10、import and finish recovery
11、recomment to run
ANALYZE TABLE ...VALIDATE STRUCTURE CASCADE;
Description1. use this method only when no other method. because it may cause database inconsistent2. cause data loss, but less than recover with backup. because the data without commit be recovered too.3. strongly recomment run complete recreation and valication check.4. should backup database fullly.5. strongly recomment that make log mirror on different disks, no data loss can be accept on production environment.
Reference http://www.itpub.net/thread-126320-1-1.html
ORA-00313: open failed for members of log group 1 of thread 1
ORA-00312: online log 1 thread 1: 'D:\ORACLE\ORADATA\TEST\REDO01.LOG'
ORA-27041: unable to open file
OSD-04002: unable to open file
O/S-Error: (OS 2) cannot find file
5.1.2 Current Redolog CorruptionTwo case:A. shutdown normally, no transaction to recovery, recreate log group with 'alter database clear unarchived logfile group n'B. active transaction exists. database need media recovery. log group need synchronized. there are 2 methods:a. imcomplete recovery. keep the consistence of database. but this method requires archivelog mode and valid backup.b. force recovery. but may cause inconsistence.
5.1.2.1 recovery with backup1. accounting a error when open database
ORA-00313: open failed for members of log group 1 of thread 1
ORA-00312: online log 1 thread 1: 'D:\ORACLE\ORADATA\TEST\REDO01.LOG'
ORA-27041: unable to open file
OSD-04002: unable to open file
O/S-Error: (OS 2) OS cannot found file
2. check V$log, and notice the current redolog corrupted
SQL> select group#,sequence#,archived,status from v$log;
GROUP# SEQUENCE# ARCHIVED STATUS
---------- ---------- -------- ----------------
1 1 NO CURRENT
2 2 YES INACTIVE
3 3 YES INACTIVE
3. cannot clear the current redolog
SQL> alter database clear unarchived logfile group 1;
alter database clear unarchived logfile group 1
*
ERROR at line 1:
ORA-01624: log 1 needed for crash recovery of thread 1
ORA-00312: online log 1 thread 1: 'D:\ORACLE\ORADATA\TEST\REDO01.LOG'
4. copy a full backup and recover database
until scn or until cnacel
recover database until cancel
select auto recover with all the valid archivelogs and redologs, and
recover database until cancel
enter cancel to do a incomplete recovery (that's need recover twice)
Example:
SQL> recover database until cancel;
Auto
...
SQL> recover database until cancel;
Cancel;
5. open database with: alter database open resetlogsDescription:1. incomplete recovery may cause data lost of current redolog.2. need archivelog mode and full backup.3. backup database after recovery.4. strongly recomment that make log mirror on different disks.
5.1.2.2 force recovery without backup1. accounting a error
ORA-00313: open failed for members of log group 1 of thread 1
ORA-00312: online log 1 thread 1: 'D:\ORACLE\ORADATA\TEST\REDO01.LOG'
ORA-27041: unable to open file
OSD-04002: unable to open file
O/S-Error: (OS 2)
2、notice curruent redolog corrupted
SQL> select group#,sequence#,archived,status from v$log;
GROUP# SEQUENCE# ARCHIVED STATUS
---------- ---------- -------- ----------------
1 1 NO CURRENT
2 2 YES INACTIVE
3 3 YES INACTIVE
3、cannot clear
SQL> alter database clear unarchived logfile group 1;
alter database clear unarchived logfile group 1
*
ERROR at line 1:
ORA-01624: log 1 needed for crash recovery of thread 1
ORA-00312: online log 1 thread 1: 'D:\ORACLE\ORADATA\TEST\REDO01.LOG'
4、shutdown database
SQL>shutdown immediate
5、add the following parameter to init
_allow_resetlogs_corruption=TRUE
6、restart database and recover with 'until cancel'
SQL>recover database until cancel;
Cancel
SQL>alter database open resetlogs;
7、full export database after open database successfully
8、shutdown database, remove init parameter
_all_resetlogs_corrupt
9、recreate database
10、import and finish recovery
11、recomment to run
ANALYZE TABLE ...VALIDATE STRUCTURE CASCADE;
Description1. use this method only when no other method. because it may cause database inconsistent2. cause data loss, but less than recover with backup. because the data without commit be recovered too.3. strongly recomment run complete recreation and valication check.4. should backup database fullly.5. strongly recomment that make log mirror on different disks, no data loss can be accept on production environment.
Reference http://www.itpub.net/thread-126320-1-1.html
Suscribirse a:
Entradas (Atom)