lunes, 23 de julio de 2012

Manually Resolving a Gap

Manually Resolving a Gap:

In some rare cases it might be necessary to manually resolve gaps. The following section describes how to query the appropriate views to determine if a gap exists.

On your physical standby database:

Query the V$ARCHIVE_GAP view:

SQL> SELECT * FROM V$ARCHIVE_GAP;


THREAD# LOW_SEQUENCE# HIGH_SEQUENCE#

----------- ------------- --------------

1 443 446


The query results show that your physical standby database is currently missing logs from sequence 443 to sequence 446 for thread 1. After you identify the gap, issue the following SQL statement on the primary database to locate the archived redo logs on your primary database:


SQL> SELECT NAME FROM V$ARCHIVED_LOG WHERE THREAD#=1 AND DEST_ID=1 AND SEQUENCE# BETWEEN 443 AND 446;


NAME


/u01/oradata/arch/arch_1_443.arc

/u01/oradata/arch/arch_1_444.arc

/u01/oradata/arch/arch_1_445.arc


Copy the logs returned by the query to your physical standby database and

register using the ALTER DATABASE REGISTER LOGFILE command.


SQL> ALTER DATABASE REGISTERLOGFILE '/u01/oradata/stby/arch/arch_1_443.arc';

SQL> ALTER DATABASE REGISTER LOGFILE '/u01/oradata/stby/arch/arch_1_444.arc';

SQL> ALTER DATABASE REGISTER LOGFILE '/u01/oradata/stby/arch/arch_1_445.arc';


Once the log files have been registered in the standby controlfile, you can restart the MRP process.


On a logical standby database:

Query the DBA_LOGSTDBY_LOG view.


SQL> SELECT THREAD#, SEQUENCE#, FILE_NAME FROM DBA_LOGSTDBY_LOG L WHERE NEXT_CHANGE# NOT IN (SELECT FIRST_CHANGE# FROM DBA_LOGSTDBY_LOG WHERE L.THREAD# =THREAD#) ORDER BY THREAD#,SEQUENCE#;


THREAD# SEQUENCE# FILE_NAME


1 451 /u01/oradata/logical_stby/arch/arch_1_451.arc

1 453 /u01/oradata/logical_stby/arch/arch_1_453.arc


Copy the missing logs to the logical standby system and register them using the ALTER DATABASE REGISTER LOGICAL LOGFILE statement on your logical standby db.


SQL> ALTER DATABASE REGISTER LOGICAL LOGFILE /u01/oradata/logical_stby/arch/arch_1_452.arc;