Upgrade Oracle from 10.2.0.2 to 10.2.0.4
1 INDICE 2
2 INTRODUCCIÓN
3 Operaciones previas.
4 Instalación Software.
5. Operaciones posteriores a la instalación.
6. Instalación Opatch y Cliente de Oracle.
2 INTRODUCCIÓN
Este documento consiste en los pasos a seguir para realizar correctamente el upgrade de Oracle 10.2.0.2 a Oracle 10.2.0.4, está basado en nuestras experiencias en tales tareas y en los documentos oficiales de Oracle, los cuales debemos consultar para resolver cualquier duda que nos pueda surgir.
3 OPERACIONES PREVIAS.
Con anterioridad a la instalación del software es necesario realizar una serie de operaciones preparatorias, que hay que realizar conectados como usuario oracle.
• Parar todos los procesos de Oracle
o La base de datos : sqlplus / as sysdba : shutdown immediate.
o El Listener: lsnrctl stop
o La Consola de Enterprise Manager : emctl stop dbconsole
• Eliminamos cualquier bloqueo que puedan tener las librerías de Oracle debido al funcionamiento de la base de datos.
o /usr/sbin/slibclean.
• Exportamos el display a la máquina remota desde la que hacemos la instalación, y lanzamos la instalación del software.
o Setenv DISPLAY ip:0.0
o cd /dir_soft_patchset/Disk1
o ./runInstaller.
4 INSTALACIÓN SOFTWARE.
5. OPERACIONES POSTERIORES A LA INSTALACIÓN.
Una vez finalizada la instalación del software, debemos proceder a actualizar los esquemas de sistema de la base de datos, para ello debemos seguir la siguiente secuencia de operaciones.
• Ejecutar la herramienta de información de pre_upgrade. Siguiendo el siguiente procedimiento.
o Arrancar la base de datos en modo UPGRADE.
SQL?> STARTUP UPGRADE;
o Configurar la salida del sistema a un fichero de log.
SQL?> SPOOL INFO_UP.LOG;
o Ejecutar la herramienta de información de pre_upgrade.
SQL?> @$ORACLE_HOME/rdbms/admin./utlu102i.sql;
o Al finalizar la ejecución liberar el spool para poder visualizar el constando del fichero de log.
SQL?> SPOOL OFF;
• A continuación visualizamos el fichero de log generado por la herramienta anteriormente ejecutada, la salida debe corresponderse aproximadamente con lo siguiente:
Oracle Database 10.2 Upgrade Information Utility 02-04-2008 11:48:11
.
**********************************************************************
Database:
**********************************************************************
--> name: X102040
--> version: 10.2.0.1.0
--> compatible: 10.2.0.1
--> blocksize: 8192
.
**********************************************************************
Tablespaces: [make adjustments in the current environment]
**********************************************************************
--> SYSTEM tablespace is adequate for the upgrade.
.... minimum required size: 505 MB
.... AUTOEXTEND additional space required: 15 MB
--> UNDOTBS1 tablespace is adequate for the upgrade.
.... minimum required size: 401 MB
.... AUTOEXTEND additional space required: 376 MB
--> SYSAUX tablespace is adequate for the upgrade.
.... minimum required size: 265 MB
.... AUTOEXTEND additional space required: 15 MB
--> TEMP tablespace is adequate for the upgrade.
.... minimum required size: 58 MB
.... AUTOEXTEND additional space required: 38 MB
--> EXAMPLE tablespace is adequate for the upgrade.
.... minimum required size: 69 MB
.
**********************************************************************
Update Parameters: [Update Oracle Database 10.2 init.ora or spfile]
**********************************************************************
WARNING: --> "shared_pool_size" needs to be increased to at least 167772160
WARNING: --> "java_pool_size" needs to be increased to at least 67108864
.
**********************************************************************
Components: [The following database components will be upgraded orinstalled]
**********************************************************************
--> Oracle Catalog Views [upgrade] VALID
--> Oracle Packages and Types [upgrade] VALID
--> JServer JAVA Virtual Machine [upgrade] VALID
--> Oracle XDK for Java [upgrade] VALID
--> Oracle Java Packages [upgrade] VALID
--> Oracle Text [upgrade] VALID
--> Oracle XML Database [upgrade] VALID
--> Oracle Workspace Manager [upgrade] VALID
--> Oracle Data Mining [upgrade] VALID
--> Messaging Gateway [upgrade] VALID
--> OLAP Analytic Workspace [upgrade] VALID
--> OLAP Catalog [upgrade] VALID
--> Oracle OLAP API [upgrade] VALID
--> Oracle interMedia [upgrade] VALID
--> Spatial [upgrade] VALID
--> Oracle Ultra Search [upgrade] VALID
--> Oracle Label Security [upgrade] VALID
--> Expression Filter [upgrade] VALID
--> EM Repository [upgrade] VALID
--> Rule Manager [upgrade] VALID
PL/SQL procedure successfully completed.
• En la salida anterior podemos observar que todos los prerequisitos para la actualización se cumplen, si no fuera así debemos tomar las acciones correctoras necesarias y una vez tomadas volver a completar el ciclo expuesto en el punto anterior. Comprobando con posterioridad si se cumplen los prerrequisitos.
• Una vez que los prerrequisitos son cumplidos pasamos a la actualización propiamente dicha, completando el siguiente ciclo de tareas.
o Iniciamos sesión con el usuario oracle.
o Iniciamos el listener de la base de datos.
Lsnrctl start?
o A continuación conectamos a la base de datos con perfil de dba.
Sqlplus / as sysdba?
o Iniciamos la base de datos en modo upgrade.
SQL?> STARTUP UPGRADE;
o Redirigimos la salida del sistema a un fichero de log.
SQL?> SPOOL UPGRADE.LOG;
o Ejecutamos el script de actualización.
? SQL>@$ORACLE_HOME/rdbms/admin./catupgrd.sql;
o Una vez terminada la ejecución liberamos el spool para poder acceder al fichero de log.
SQL?> SPOOL OFF;
o Revisamos el fichero de log generado por la ejecución de script.
Si encontramos algún error volveremos a ejecutar el citado? script.
o Reiniciamos la base de datos.
SQL?> SHUTDOWN IMMEDIATE;
? SQL> STARTUP;
o Ejecutamos el script utlrp.sql para recompilar todos aquellos paquetes que hayan quedado invalidados por el proceso de actualización.
SQL?> @$ORACLE_HOME/rdbms/admin./utlrp.sql
o Ejecutamos la siguiente consulta para comprobar el estado de los componentes después de al actualización.
SQL?> SELECT COMP_NAME, VERSION, STATUS FROM SYS.DBA_REGISTRY;
Si en la salida del comando nos salen todos los objetos? con STATUS VALID, el proceso ha sido un éxito, en caso contrario deberemos repetir el proceso de actualización desde el principio.
Errores encontrados durante el upgrade
###############################################################################
ERROR at line 1:
ORA-06575: Package or function VERSION_SCRIPT is in an invalid state
Subject: PLS-00920 ORA-06575 Running Catupgrd.sql from 10.2.0.2.0 patch set
Doc ID: 371144.1 Type: PROBLEM
Modified Date : 06-SEP-2006 Status: MODERATED
alter session set plsql_code_type = INTERPRETED;
alter session set plsql_compiler_flags= native, NON_DEBUG;
Original
alter session set plsql_code_type = NATIVE;
Errors in file /u400/afinprd/db/tech_st/10.2.0/admin/FCFIN1_fcprod1/bdump/fcfin1_j005_22180.trc:
ORA-00600: internal error code, arguments: [skkxerrp], [skkxdllload], [SlfFopen], [$ORACLE_HOME/plsql/nativelib/d51/FND_PROFI
LE__APPS__S__52420.sl], [No such file or directory], [], [], []
Se elimina cambiando la variable:
Cambiar la variable plsql_native_library_dir poniendo todo el path y no utilizar $ORACLE_HOME
Ejemplo: plsql_native_library_dir=/u400/afinprd/db/tech_st/10.2.0/plsql/nativelib
EL ERROR DE DESCONEXION QUE MARCA AL CORRER
@$ORACLE_HOME/rdbms/admin/utlrp.sql
PARA ESTO ES NECESRIO CAMBIR EL COMPILADOR C POR UN ANSI/C
Cambiar en el archivo (EN HP/PA)
/u400/afinprd/db/tech_st/10.2.0/plsql/spnc_commands
Este segmento de la línea
/usr/local/packages/compiler/opt/ansic/bin/cc
Por este:
/opt/ansic/bin/cc
NOTAS RELACIONADAS METALINK
Ntas relacionadas
456348.1 ORA-00600: [kokvctp1] while running utlrp.sql during an upgrade
413922.1 ORA-03113 Error When Executing Utlrp.sql
370517.1 Pls-00923: Native Compilation Failed With 10.2 Database
269012.1 PL/SQL Native Compilation in Oracle 10g
399827.1 Native Compilation Fails With PLS-00925 When Using Environment Variables
734079.1 FAQ and Known Issues with PLSQL Native Compilation.
1065811.6 UNDEFIND SYMBOLS WHEN RELINKING THE ORACLE KERNEL
error ------ cc: warning 480: The 02 option is available only with the C/ANSI C product
lunes, 31 de agosto de 2009
martes, 31 de marzo de 2009
Archivelogs Applied to Standby are NOT Deleted from Primary Site After Backup with DELETE INPUT
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
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
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)