Vous êtes sur la page 1sur 7

---PARA VER LAS TX DE ARCHIVE--------DEBE SER COMO SYSTEM ----------------------------------------------------------BEGIN MWS_PCK_JOURNALMWTRX.

ActualizaJournalCajaTRX(:1, :2, :3, :4, :5, :6, :7, : 8); END; exec DBMS_LOGMNR.ADD_LOGFILE('/u04/backup/archive/arc_1_134700_617200041.arc'); exec dbms_logmnr.start_logmnr(); select min(to_char(COMMIT_TIMESTAMP,'DD/Mon/YY HH24:Mi:SS')) from V$LOGMNR_CONTE NTS; select USERNAME, SQL_REDO from V$LOGMNR_CONTENTS where rownum < 10; EXECUTE DBMS_LOGMNR.START_LOGMNR(OPTIONS => DBMS_LOGMNR.DICT_FROM_ONLINE_CATALOG ); exec DBMS_LOGMNR.END_LOGMNR()

---------------------------------------------------------------PARA VER LO QUE HICIERON LOS ARCHIVE-LOG-----------------------se genera el directorio UTL_FILE_DIR debe estar habilitado -----------------------------------------------------------------utl_file_dir=/u03/utlfiledir EXECUTE sys.dbms_logmnr_d.build('dictionary.ora','/u03/utlfiledir', options => SYS.dbms_logmnr_d.store_in_flat_file); execute dbms_logmnr.add_logfile( LogFileName => '/u01/backup/archive/arc_1_50077 _617200041.arc',Options => dbms_logmnr.ADDFILE); execute dbms_logmnr.add_logfile( LogFileName => '/u01/backup/archive/arc_1_50078 _617200041.arc',Options => dbms_logmnr.ADDFILE); execute dbms_logmnr.start_logmnr(DictFileName =>'/u03/utlfiledir/dictionary.ora'); SELECT SCN, to_char(TIMESTAMP, 'dd-mon-yyyy hh24:mi:ss'),SEG_OWNER,TABLE_NAME,OP ERATION,SQL_REDO,SQL_UNDO FROM v$logmnr_contents WHERE SEG_OWNER LIKE '%ADMI%' -------------------------------------------------------------------------------------crea un nueva lista execute dbms_logmnr.add_logfile( LogFileName => '/oracle/logs/log1.f', Options => dbms_logmnr.NEW);

-execute dbms_logmnr.add_logfile( LogFileName => '/u01/backup/archive/arc_1_50078 _617200041.arc',Options => dbms_logmnr.ADDFILE); execute dbms_logmnr.add_logfile( LogFileName => '/u01/backup/archive/arc_1_50078_617200041.arc', Options => dbms_logmnr.REMOVEFILE); ---------para comenzar a usar execute dbms_logmnr.start_logmnr(DictFileName =>'/u03/utlfiledir/dictionary.ora'); execute dbms_logmnr.start_logmnr( DictFileName => `/oracle/dictionary.ora', StartTime => to_date(`01-Jan-98 08:30:00', 'DD-MON-YYYY HH:MI:SS') EndTime => to_date('01-Jan-1998 08:45:00', 'DD-MON-YYYY HH:MI:SS')); execute dbms_logmnr.start_logmnr( DictFileName => '/oracle/dictionary.ora', StartScn => 100, EndScn => 150); SELECT sql_redo, sql_undo FROM v$logmnr_contents; -------SELECT SCN,TIMESTAMP,SEG_OWNER,TABLE_NAME,OPERATION,SQL_REDO,SQL_UNDO FROM v$log mnr_contents WHERE SEG_OWNER LIKE '%ADMI%'; finished with LogMiner ---------------------EXEC DBMS_LOGMNR.END_LOGMNR(); select sequence#,dictionary_begin,dictionary_end from v$archived_log; ----------------------------select * from V$LOGMNR_CONTENTS select * from V$LOGMNR_DICTIONARY select * from V$LOGMNR_LOGS select * from V$LOGMNR_PARAMETERS Log Corruption -------------------BEGIN DBMS_LOGMNR.start_logmnr ( options => DBMS_LOGMNR.skip_corruption); END; / -------------------------contenido de un archivo .bat:

set oracle_sid=MISEDES1 rman target / cmdfile "C:SCRIPTS\BORRA_ARCHIVES\comandos_RMAN.txt" contenido del archivo comandos_RMAN.txt: rman target / CROSSCHECK ARCHIVELOG ALL; (sincroniza los archives). DELETE NOPROMPT ARCHIVELOG UNTIL TIME 'SYSDATE-1'; ----5 horas hacia atras DELETE NOPROMPT ARCHIVELOG UNTIL TIME 'SYSDATE-5/24'; #######delete noprompt archivelog obsolete; DELETE NOPROMPT ARCHIVELOG UNTIL SEQUENCE = 31274; DELETE NOPROMPT ARCHIVELOG UNTIL TIME 'SYSDATE-1'; DELETE ARCHIVELOG ALL; DELETE NOPROMPT EXPIRED ARCHIVELOG ALL; report obsolete; delete noprompt obsolete recovery window of 1 days; delete noprompt obsolete; #####delete noprompt backup of database completed before 'SYSDATE-1'; delete noprompt backup of database completed before 'SYSDATE'; (con este borra los ltimos 5 das hacia atrs, o sea, deja los ultimos 5 dias). ----------------------------------------------------------------archive en ora10 ---------------------------------------------------------------Primero que todo, respaldar archivo spfile y crear archivo de initorapla.ora (pf ile) Entrar a Linux con la cuenta oracle10 (Servidor SRVORA10), realizar el siguiente copy y crear directorio en /bk2 1.cp /app/oracle/product/10.1.0/db_1/dbs/spfileora10.ora /app/oracle/product/10.1. 0/db_1/dbs/spfileora10_24nov.ora mkdir /bk2/backup/archive 2.- crear el archivo pfile y cambio de parametro archive: sqlplus "/as sysdba" create pfile from spfile; alter system set log_archive_format='arc_%t_%s_%r.arc' scope=spfile; alter system set log_archive_dest_1='LOCATION=/bk2/backup/archive'; alter system set log_archive_dest_1='LOCATION=/u01/oracle/backup/archive';

alter system set log_archive_dest_1='LOCATION=/u01/backup/archive'; alter system set log_archive_dest_1='LOCATION=/u04/backup/archive'; ERP PRODUCION alter system set log_archive_dest_1='LOCATION=/u02/oracle/archive'; --------activar archive en RAC con ASM------------------------alter alter alter alter system system system system reset log_archive_start scope=spfile sid='*' ; set log_archive_dest_1='LOCATION=+DISKGROUP1'; set log_archive_format='arc_%t_%s_%r.arc' scope=spfile; set log_archive_dest_1='LOCATION=+DGCORE02';

alter system set log_archive_dest_1='LOCATION=/u01/backup/archive'; alter system set cluster_database=FALSE scope=spfile sid='*'; alter system set cluster_database=TRUE scope=spfile sid='*'; alter system set cluster_database_instances=2 scope=spfile sid='*'; alter system set instance_number=1 scope=spfile; create spfile='+dgcore04/core/spfilecore.ora' from pfile='/u01/app/oracle/produc t/10.2.0/dbcore2/dbs/init.ora'; create pfile from spfile='+DGCORE04/core/spfilecore.ora';

srvctl stop database -d CORQA create spfile from pfile; alter database archivelog; create spfile='+DGEXTRA01/dbfct/spfiledbfct.ora' from pfile='/u01/app/oracle/pr oduct/10.2.0/db_1/dbs/initdbct_pfile.ora';

srvctl start database -d CORQA

3.-para saber si esta archive archive log list; 4.-activar el modod archive log; sqlplus "/as sysdba" shutdown immediate; startup mount; alter database archivelog;

--------------verifico que este en archive archive log list; alter database open;

--------------------------------------------------------------------------------------archive en portal (windows) --------------------------------------------------------------------------------------Primero que todo, respaldar archivo spfile y crear archivo de initorapla.ora (pf ile) Entrar al Servidor SRVORAW10G, realizar el siguiente copy y crear directorio ---------------------------------------------------------------------------------1.copy d:\oracle\product\10.2.0\db_1\database\spfileoraw.ora d:\oracle\product\10.2.0\db_1\database\spfileoraw_18032008.ora crear directorios : i:\backup\archive i:\backup\hot i:\backup\log i:\backup\scripts copiar los siguientes archivos (PCDI23:: D:\PROCESO_ORACLE\PASO_ARCHIVE_ORAW) --------------------configs.bat configs.rcv resp_ol.rcv resp_ol.bat al directorio i:\backup\scripts ejecutar el archivo (que se ejecuta con RMAN) config.bat y luego agendar en window todos los dias a las 02:00 am (respaldo HOT de la base de datos ORAW mediante RMAN) " SE DEMORA 15 MINUTOS EL RESPALDO" i:\backup\scripts\resp_ol.bat

---------------------------------------------------------------------------------2.- crear el archivo pfile y cambio de parametro archive: sqlplus "/as sysdba" create pfile from spfile; alter system set log_archive_format='arc_%t_%s_%r.arc' scope=spfile; alter system set log_archive_dest_1='LOCATION=i:\backup\archive'; alter system set log_archive_dest_1='LOCATION=/u01/oracle/backup/archive'; ---------------------------------------------------------------------------------3.-para saber si esta archive archive log list; 4.-activar el modod archive log; sqlplus "/as sysdba" shutdown immediate; startup mount; alter database archivelog; --------------verifico que este en archive archive log list; alter database open;

-----------------------VUELTA ATRAS -----------------------alter system set log_archive_dest_1=''; desactivar el modod archive log; ------------------------------sqlplus "/as sysdba" shutdown immediate; startup mount; alter database noarchivelog; --------------verifico que este en NO archive archive log list; alter database open; DELETE BACKUP COMPLETED BEFORE 'SYSDATE-10' DEVICE TYPE DISK; DELETE NOPROMPT ARCHIVELOG UNTIL TIME 'SYSDATE-3';

#*** Maintenance steps CROSSCHECK COPY; CROSSCHECK BACKUP; CROSSCHECK ARCHIVELOG ALL; DELETE NOPROMPT OBSOLETE; DELETE NOPROMPT EXPIRED COPY; DELETE NOPROMPT EXPIRED BACKUP; DELETE NOPROMPT EXPIRED ARCHIVELOG ALL; ---------------------------------------------activar archive en RAC ---------------------------------------Login to one of the nodes (i.e. linux1) and disable the cluster instance paramet er by setting cluster_database to FALSE from the current instance: $ sqlplus "/ as sysdba" SQL> alter system set cluster_database=false scope=spfile sid='orcl1'; Shutdown all instances accessing the clustered database: $ srvctl stop database -d orcl Using the local instance, MOUNT the database: $ sqlplus "/ as sysdba" SQL> startup mount Enable archiving: SQL> alter database archivelog; Re-enable support for clustering by modifying the instance parameter cluster_dat abase to TRUE from the current instance: SQL> alter system set cluster_database=true scope=spfile sid='orcl1'; Shutdown the local instance: SQL> shutdown immediate Bring all instance back up using srvctl: $ srvctl start database -d orcl (Optional) Bring any services (i.e. TAF) back up using srvctl: $ srvctl start service -d orcl Login to the local instance and verify Archive Log Mode is enabled: $ sqlplus "/ as sysdba" SQL> archive log list Database log mode Automatic archival Archive destination Oldest online log sequence Next log sequence to archive Current log sequence

Archive Mode Enabled USE_DB_RECOVERY_FILE_DEST 83 84 84