dataguard
Differences
This shows you the differences between two versions of the page.
| Both sides previous revisionPrevious revision | |||
| dataguard [2018/12/08 12:49] – created 0.0.0.0 | dataguard [2021/11/16 19:09] (current) – external edit 127.0.0.1 | ||
|---|---|---|---|
| Line 1: | Line 1: | ||
| - | ====== Dataguard ====== | + | * [[https:// |
| + | * [[https:// | ||
| + | * [[http:// | ||
| + | * [[http:// | ||
| + | * [[http:// | ||
| + | * [[https:// | ||
| + | * [[https:// | ||
| + | * [[http:// | ||
| + | ==== Convert a Standby to a Primary | ||
| + | [[https:// | ||
| + | < | ||
| + | alter database recover managed standby cancel; | ||
| + | alter database recover managed standby database finish; -- initiates failover on the target standby, finish applying all received redo data and recovers current standby logs | ||
| + | alter database activate standby database; | ||
| + | </ | ||
| - | * [[https:// | + | ==== Start up the apply on a physical standby ==== |
| - | * [[http:// | + | < |
| - | * [[http:// | + | |
| - | * [[http:// | + | |
| - | * [[https:// | + | |
| - | * [[https:// | + | |
| - | * [[http:// | + | |
| - | =====Start up the apply on a physical standby===== | + | |
| | | ||
| alter database mount standby database; | alter database mount standby database; | ||
| alter database recover managed standby database disconnect; | alter database recover managed standby database disconnect; | ||
| + | </ | ||
| - | =====Stop the apply on a physical standby===== | + | ==== Stop the apply on a physical standby ==== |
| + | < | ||
| alter database recover managed standby database cancel; | alter database recover managed standby database cancel; | ||
| + | </ | ||
| - | =====Register a missing logfile===== | + | ==== Register a missing logfile ==== |
| + | < | ||
| alter database register physical logfile '< | alter database register physical logfile '< | ||
| - | =====Show apply activity on the standby===== | + | </ |
| - | < | + | ==== Show apply activity on the standby ==== |
| + | < | ||
| + | select process | ||
| + | , status | ||
| + | , client_process | ||
| + | , sequence# | ||
| + | , block# | ||
| + | , active_agents | ||
| + | , known_agents | ||
| + | from | ||
| + | / | ||
| + | </ | ||
| shows something like this | shows something like this | ||
| - | < | + | < |
| + | PROCESS | ||
| + | --------- ------------ -------- ---------- ---------- ------------- ------------ | ||
| + | ARCH CLOSING | ||
| + | ARCH CONNECTED | ||
| + | ARCH CLOSING | ||
| + | ARCH CLOSING | ||
| + | MRP0 APPLYING_LOG N/A 197888 | ||
| + | RFS | ||
| + | RFS | ||
| + | RFS | ||
| + | RFS | ||
| + | RFS | ||
| + | RFS | ||
| - | =====See Dataguard error log messages===== | + | 11 rows selected. |
| + | </ | ||
| + | |||
| + | ==== See Dataguard error log messages ==== | ||
| If data guard is not functioning correctly, check the errors in this log. | If data guard is not functioning correctly, check the errors in this log. | ||
| - | < | + | < |
| + | select gvi.thread# | ||
| + | , timestamp | ||
| + | , message | ||
| + | from | ||
| + | , gv$instance | ||
| + | where gvds.inst_id = gvi.inst_id | ||
| + | and severity | ||
| + | order by timestamp | ||
| + | , thread# | ||
| + | / | ||
| + | </ | ||
| and | and | ||
| - | < | + | < |
| + | select thread# | ||
| + | , dest_id | ||
| + | , gvad.status | ||
| + | , error | ||
| + | , fail_sequence | ||
| + | from | ||
| + | , gv$instance | ||
| + | where gvad.inst_id = gvi.inst_id | ||
| + | and destination | ||
| + | order by thread# | ||
| + | , dest_id | ||
| + | / | ||
| + | </ | ||
| - | =====Check which logs are missing===== | + | ==== Check which logs are missing ==== |
| Assuming dest_2 is the standby | Assuming dest_2 is the standby | ||
| + | < | ||
| | | ||
| - | , | + | , |
| (select thread# | (select thread# | ||
| - | , | + | , |
| - | from v$archived_log | + | from v$archived_log |
| - | where dest_id=1) local | + | where dest_id=1) local |
| - | | + | |
| (select sequence# | (select sequence# | ||
| from v$archived_log | from v$archived_log | ||
| - | where dest_id=2 and | + | where dest_id=2 and |
| thread# = local.thread# | thread# = local.thread# | ||
| + | </ | ||
| - | =====Stop/ | + | ==== Stop/Start log file shipping ==== |
| On the primary | On the primary | ||
| + | < | ||
| alter system set log_archive_dest_state_2 = ' | alter system set log_archive_dest_state_2 = ' | ||
| alter system set log_archive_dest_state_2 = ' | alter system set log_archive_dest_state_2 = ' | ||
| + | </ | ||
| - | =====Start FAL tracing on the primary===== | + | ==== Start FAL tracing on the primary ==== |
| + | < | ||
| alter system set LOG_ARCHIVE_TRACE = 128; | alter system set LOG_ARCHIVE_TRACE = 128; | ||
| - | =====Stop the DataGuard broker===== | + | </ |
| + | ==== Stop the DataGuard broker ==== | ||
| + | < | ||
| alter system set dg_broker_start=false; | alter system set dg_broker_start=false; | ||
| - | =====Are we a standby? | + | </ |
| + | ==== Are we a standby? ==== | ||
| + | < | ||
| | | ||
| | | ||
| - | =====Show various details on health of standby database===== | + | </ |
| - | < | + | ==== Show various details on health of standby database ==== |
| - | =====See how up-to-date a standby is===== | + | < |
| + | -- This script is to be run on the Standby of a Data Guard Physical Standby Site | ||
| + | |||
| + | set echo off | ||
| + | set feedback off | ||
| + | column timecol new_value tstamp | ||
| + | column spool_extension new_value suffix | ||
| + | select to_char(sysdate,' | ||
| + | column output new_value dbname | ||
| + | select value || ' | ||
| + | |||
| + | -- Output the results to this file | ||
| + | |||
| + | spool dg_Standby_diag_&& | ||
| + | set lines 132 | ||
| + | set pagesize 500 | ||
| + | set numformat 999999999999999 | ||
| + | set trim on | ||
| + | set trims on | ||
| + | |||
| + | -- Get the current Date | ||
| + | |||
| + | set feedback on | ||
| + | select systimestamp from dual; | ||
| + | |||
| + | -- Standby Site Details | ||
| + | set heading off | ||
| + | set feedback off | ||
| + | select ' | ||
| + | select ' | ||
| + | set heading on | ||
| + | set feedback on | ||
| + | |||
| + | col db_unique_name format a15 | ||
| + | col flashb_on format a10 | ||
| + | |||
| + | select DB_UNIQUE_NAME, | ||
| + | | ||
| + | from v$database; | ||
| + | |||
| + | -- Current SCN - this value on the primary and standby sites where real time apply is in place should be nearly the same | ||
| + | |||
| + | select DB_UNIQUE_NAME, | ||
| + | |||
| + | -- Incarnation Information | ||
| + | -- | ||
| + | |||
| + | set heading off | ||
| + | set feedback off | ||
| + | select ' | ||
| + | select ' | ||
| + | set heading on | ||
| + | set feedback on | ||
| + | |||
| + | select INCARNATION# | ||
| + | |||
| + | |||
| + | set heading off | ||
| + | set feedback off | ||
| + | select ' | ||
| + | select ' | ||
| + | set heading on | ||
| + | set feedback on | ||
| + | -- Current Archive Locations | ||
| + | -- | ||
| + | |||
| + | column host_name format a30 tru | ||
| + | column version format a10 tru | ||
| + | select INSTANCE_NAME, | ||
| + | |||
| + | column destination format a35 wrap | ||
| + | column process format a7 | ||
| + | column archiver format a8 | ||
| + | column dest_id format 99999999 | ||
| + | |||
| + | select DEST_ID, | ||
| + | from v$archive_dest | ||
| + | where DESTINATION IS NOT NULL; | ||
| + | |||
| + | column name format a22 | ||
| + | column value format a100 | ||
| + | select NAME,VALUE from v$parameter where NAME like ' | ||
| + | |||
| + | set heading off | ||
| + | set feedback off | ||
| + | select ' | ||
| + | select ' | ||
| + | set heading on | ||
| + | set feedback on | ||
| + | |||
| + | column error format a55 tru | ||
| + | select DEST_ID, | ||
| + | where DESTINATION IS NOT NULL; | ||
| + | |||
| + | column message format a80 | ||
| + | select MESSAGE, TIMESTAMP | ||
| + | from v$dataguard_status | ||
| + | where SEVERITY in (' | ||
| + | order by TIMESTAMP; | ||
| + | |||
| + | -- Redo Log configuration | ||
| + | -- The size of the standby redo logs must match exactly the size on the online redo logs | ||
| + | |||
| + | set heading off | ||
| + | set feedback off | ||
| + | select 'Data Guard Redo Log Configuration' | ||
| + | select ' | ||
| + | set heading on | ||
| + | set feedback on | ||
| + | |||
| + | select GROUP# STANDBY_GROUP#, | ||
| + | |||
| + | select GROUP# ONLINE_GROUP#, | ||
| + | |||
| + | -- Data Guard Parameters | ||
| + | -- | ||
| + | set heading off | ||
| + | set feedback off | ||
| + | select 'Data Guard Related Parameters' | ||
| + | select ' | ||
| + | set heading on | ||
| + | set feedback on | ||
| + | |||
| + | column name format a30 | ||
| + | column value format a100 | ||
| + | select NAME,VALUE from v$parameter where NAME IN (' | ||
| + | |||
| + | -- Managed Recovery State | ||
| + | |||
| + | set heading off | ||
| + | set feedback off | ||
| + | select 'Data Guard Apply Status' | ||
| + | select ' | ||
| + | set heading on | ||
| + | set feedback on | ||
| + | |||
| + | select systimestamp from dual; | ||
| + | |||
| + | column client_pid format a10 | ||
| + | select PROCESS, | ||
| + | from v$managed_standby | ||
| + | |||
| + | exec DBMS_LOCK.SLEEP(10); | ||
| + | |||
| + | select systimestamp from dual; | ||
| + | |||
| + | select PROCESS, | ||
| + | from v$managed_standby | ||
| + | |||
| + | exec DBMS_LOCK.SLEEP(10); | ||
| + | |||
| + | select systimestamp from dual; | ||
| + | |||
| + | select PROCESS, | ||
| + | from v$managed_standby | ||
| + | |||
| + | |||
| + | set heading off | ||
| + | set feedback off | ||
| + | select 'Data Guard Apply Lag' from dual; | ||
| + | select ' | ||
| + | set heading on | ||
| + | set feedback on | ||
| + | |||
| + | column name format a12 | ||
| + | column lag_time format a20 | ||
| + | column datum_time format a20 | ||
| + | column time_computed format a20 | ||
| + | SELECT NAME, VALUE LAG_TIME, DATUM_TIME, TIME_COMPUTED | ||
| + | from V$DATAGUARD_STATS where name like 'apply lag'; | ||
| + | |||
| + | -- If there is a lag remove the comment for the select below | ||
| + | --SELECT * FROM V$STANDBY_EVENT_HISTOGRAM WHERE NAME = 'apply lag' | ||
| + | |||
| + | set heading off | ||
| + | set feedback off | ||
| + | select 'Data Guard Gap Problems' | ||
| + | select ' | ||
| + | set heading on | ||
| + | set feedback on | ||
| + | |||
| + | select * from v$archive_gap; | ||
| + | |||
| + | set heading off | ||
| + | set feedback off | ||
| + | select 'Data Guard Errors in the Last Hour' from dual; | ||
| + | select ' | ||
| + | set heading on | ||
| + | set feedback on | ||
| + | |||
| + | select TIMESTAMP, | ||
| + | |||
| + | </ | ||
| + | ==== See how up-to-date a standby is ==== | ||
| On the primary | On the primary | ||
| - | < | + | < |
| + | set numwidth 15 | ||
| + | select max(sequence# | ||
| + | from | ||
| + | </ | ||
| On the standby | On the standby | ||
| - | < | + | < |
| + | set numwidth 15 | ||
| + | select max(applied_seq# | ||
| + | from | ||
| + | |||
| + | select arch.thread# | ||
| + | , arch.sequence# | ||
| + | , appl.sequence# | ||
| + | , (arch.sequence# | ||
| + | from ( | ||
| + | | ||
| + | , | ||
| + | | ||
| + | | ||
| + | | ||
| + | select thread#, max(first_time) | ||
| + | from | ||
| + | group by thread# | ||
| + | ) | ||
| + | ) arch | ||
| + | , | ||
| + | ( | ||
| + | | ||
| + | , | ||
| + | | ||
| + | | ||
| + | | ||
| + | from | ||
| + | group by thread# | ||
| + | ) | ||
| + | ) appl | ||
| + | where 1=1 | ||
| + | and arch.thread# | ||
| + | order by 1; | ||
| + | </ | ||
| or | or | ||
| - | <code> | + | < |
| - | =====See how up-to-date a standby is (another version)===== | + | select a.thread# |
| - | < | + | , b.last_seq |
| + | , a.applied_seq | ||
| + | , to_char(a.last_app_timestamp,' | ||
| + | , b.last_seq-a.applied_seq | ||
| + | from | ||
| + | , max(sequence#) applied_seq | ||
| + | , max(next_time) last_app_timestamp | ||
| + | from | ||
| + | where applied | ||
| + | group by thread# | ||
| + | ) a | ||
| + | , (select thread# | ||
| + | , max(sequence# | ||
| + | from | ||
| + | group by thread# | ||
| + | ) b | ||
| + | where a.thread# | ||
| + | / | ||
| - | =====Show info on all log destinations===== | + | </ |
| + | ==== See how up-to-date a standby is (another version) ==== | ||
| + | < | ||
| + | PRIMARY_SQL> | ||
| + | select thread# | ||
| + | , max(sequence# | ||
| + | from | ||
| + | , v$database | ||
| + | where val.resetlogs_change# | ||
| + | group by thread# | ||
| + | order by 1 | ||
| + | / | ||
| + | |||
| + | STANDBY_SQL> | ||
| + | select thread# | ||
| + | , max(sequence# | ||
| + | from | ||
| + | , v$database | ||
| + | where val.resetlogs_change# | ||
| + | group by thread# | ||
| + | order by 1 | ||
| + | / | ||
| + | |||
| + | STANDBY_SQL> | ||
| + | select thread# | ||
| + | , max(sequence# | ||
| + | from | ||
| + | , v$database | ||
| + | where val.resetlogs_change# | ||
| + | and val.applied | ||
| + | group by thread# | ||
| + | order by 1 | ||
| + | / | ||
| + | </ | ||
| + | |||
| + | ==== Show info on all log destinations ==== | ||
| On the primary | On the primary | ||
| - | < | + | < |
| + | set lines 100 | ||
| + | set numwidth 15 | ||
| + | column ID format 99 | ||
| + | column " | ||
| + | column active format 99 | ||
| + | col type format a4 | ||
| - | =====Display log destinations options===== | + | select ds.dest_id id |
| + | , ad.status | ||
| + | , ds.database_mode db_mode | ||
| + | , ad.archiver type | ||
| + | , ds.recovery_mode | ||
| + | , ds.protection_mode | ||
| + | , ds.standby_logfile_count " | ||
| + | , ds.standby_logfile_active active | ||
| + | , ds.archived_seq# | ||
| + | from | ||
| + | , v$archive_dest | ||
| + | where 1=1 | ||
| + | and ds.dest_id = ad.dest_id | ||
| + | and ad.status != ' | ||
| + | order by ds.dest_id; | ||
| + | </ | ||
| + | |||
| + | ==== Display log destinations options ==== | ||
| On the standby | On the standby | ||
| - | < | + | < |
| + | set numwidth 8 | ||
| + | set lines 100 | ||
| + | column id format 99 | ||
| + | |||
| + | select dest_id id | ||
| + | , archiver | ||
| + | , transmit_mode | ||
| + | , affirm | ||
| + | , async_blocks | ||
| + | , net_timeout | ||
| + | , delay_mins | ||
| + | , reopen_secs | ||
| + | , register | ||
| + | , binding | ||
| + | from | ||
| + | order by dest_id; | ||
| + | </ | ||
| - | =====Show any standby logs===== | + | ==== Show any standby logs ==== |
| + | < | ||
| set lines 100 | set lines 100 | ||
| set pages 999 | set pages 999 | ||
| Line 88: | Line 484: | ||
| | | ||
| | | ||
| + | </ | ||
| - | =====Dataguard broker (dgmgrl) setup for management of physical standby databases===== | + | ==== Dataguard broker (dgmgrl) setup for management of physical standby databases ==== |
| - | Assuming primary and standby already exist and have standby redologs setup, force logging etc...<br /> | + | Assuming primary and standby already exist and have standby redologs setup, force logging etc...\\ |
| - | Example: server1 - db_primary, server2 - db_standby<br /> | + | Example: server1 - db_primary, server2 - db_standby\\ |
| - | ====Preparation==== | + | === Preparation === |
| On both systems... | On both systems... | ||
| - | < | + | < |
| - | ====Create a configuration==== | + | alter system set dg_broker_start=true; |
| + | </ | ||
| + | === Create a configuration === | ||
| From server1 | From server1 | ||
| - | < | + | < |
| + | dgmgrl sys/sys@db_primary | ||
| + | |||
| + | create configuration dg_config as primary database is db_primary connect identifier is db_primary; | ||
| + | </ | ||
| Configuration created, add the physical standby to it | Configuration created, add the physical standby to it | ||
| - | < | + | < |
| - | ====Configuration complete, enable it==== | + | add database db_standby as connect identifier is db_standby maintained as physical; |
| - | < | + | </ |
| - | ====Show configuration==== | + | === Configuration complete, enable it === |
| - | < | + | < |
| - | ====Show individual database information==== | + | enable configuration; |
| - | < | + | </ |
| - | ====Switchover primary to standby and vice versa==== | + | === Show configuration === |
| + | < | ||
| + | show configuration; | ||
| + | </ | ||
| + | === Show individual database information === | ||
| + | < | ||
| + | show database db_primary; | ||
| + | show database db_standby; | ||
| + | </ | ||
| + | ==== Switchover primary to standby and vice versa ==== | ||
| From server1 | From server1 | ||
| - | < | + | < |
| - | ====Switch back to the original situation==== | + | dgmgrl sys/sys@db_primary |
| + | switchover to db_standby; | ||
| + | </ | ||
| + | === Switch back to the original situation === | ||
| From server2 | From server2 | ||
| - | < | + | < |
| - | ====Failover==== | + | dgmgrl sys/sys@db_standby |
| - | The difference between switchover and failover is that you control a switchover, a failover happens bacause the primary db is no longer available<br /> | + | switchover to db_primary; |
| + | </ | ||
| + | ==== Switchover without using dgmgrl ==== | ||
| + | From server1, connect to the primary | ||
| + | < | ||
| + | connect / as sysdba | ||
| + | alter database commit to switchover to standby; | ||
| + | </ | ||
| + | Now shut it down and restart it as a standby | ||
| + | < | ||
| + | shutdown immediate; | ||
| + | startup nomount; | ||
| + | alter database mount standby database; | ||
| + | alter database recover managed standby database disconnect from session; | ||
| + | </ | ||
| + | === From server2, connect to the standby === | ||
| + | < | ||
| + | connect / as sysdba | ||
| + | alter database commit to switchover to primary; | ||
| + | </ | ||
| + | Now shut it down and restart it as a primary | ||
| + | < | ||
| + | shutdown immediate; | ||
| + | startup; | ||
| + | </ | ||
| + | |||
| + | ==== Failover ==== | ||
| + | The difference between switchover and failover is that you control a switchover, a failover happens bacause the primary db is no longer available\\ | ||
| From server2 | From server2 | ||
| - | < | + | < |
| - | Backup this database immediately as it is now the only database and has no standby. This can be done with RMAN while it is running.<br /> | + | dgmgrl sys/sys@db_standby |
| - | If flashback was not enabled, the old primary is now useless and will need to be recreated as a standby.<br /> | + | failover to db_standby; |
| - | If, however flashback was enabled, we can use this to restart the old primary as a standby.<br /> | + | </ |
| + | Backup this database immediately as it is now the only database and has no standby. This can be done with RMAN while it is running.\\ | ||
| + | If flashback was not enabled, the old primary is now useless and will need to be recreated as a standby.\\ | ||
| + | If, however flashback was enabled, we can use this to restart the old primary as a standby.\\ | ||
| From server1 | From server1 | ||
| - | < | + | < |
| - | ====If flashback was not enabled, recreate old primary as a standby something like this==== | + | dgmgrl sys/sys@db_primary |
| - | < | + | reinstate database db_primary; |
| - | < | + | </ |
| - | <code>23@@</code> | + | === If flashback was not enabled, recreate old primary as a standby something like this === |
| - | <code>24@@</ | + | < |
| - | < | + | sqlplus / as sysdba |
| + | shu abort; | ||
| + | exit; | ||
| + | </ | ||
| + | < | ||
| + | rm $ORACLE_HOME/ | ||
| + | rm -Rf /oracle/< | ||
| + | rm -Rf /oracle/<SID>/fra/* | ||
| + | rm -Rf /oracle/<SID>/admin/* | ||
| + | mkdir -p / | ||
| + | mkdir -p /oracle/<SID>/fra/ | ||
| + | mkdir -p / | ||
| + | </ | ||
| + | < | ||
| + | echo " | ||
| + | export ORACLE_SID=db | ||
| + | sqlplus / as sysdba | ||
| + | startup nomount pfile='/ | ||
| + | exit | ||
| + | </ | ||
| + | < | ||
| + | rman target sys/ | ||
| - | =====Dataguard broker managed standby (dgmgrl) not applying logs after restart===== | + | duplicate target database |
| - | After restarting the Primary and Standby databases manually, the redo logs were not being applied on the standby.<br /> | + | for standby |
| + | from active database | ||
| + | dorecover | ||
| + | spfile | ||
| + | set db_unique_name=' | ||
| + | set db_file_name_convert='/ | ||
| + | set log_file_name_convert='/ | ||
| + | nofilenamecheck; | ||
| + | </ | ||
| + | < | ||
| + | dgmgrl sys/ | ||
| + | enable database db_primary; | ||
| + | show configuration; | ||
| + | </ | ||
| + | |||
| + | ==== Dataguard broker managed standby (dgmgrl) not applying logs after restart ==== | ||
| + | After restarting the Primary and Standby databases manually, the redo logs were not being applied on the standby.\\ | ||
| The command used to start the standby database was: | The command used to start the standby database was: | ||
| - | < | + | < |
| + | alter database recover managed standby database using current logfile disconnect from session; | ||
| + | </ | ||
| It seems this is not good enough, we see a problem in the broker configuration... | It seems this is not good enough, we see a problem in the broker configuration... | ||
| - | (0) OTMPRODS oracle@ravotm14:/ | + | < |
| + | (0) OTMPRODS oracle@ravotm14:/ | ||
| | | ||
| - | + | </ | |
| + | |||
| + | < | ||
| | | ||
| - | + | </ | |
| + | |||
| + | < | ||
| | | ||
| | | ||
| | | ||
| | | ||
| - | + | </ | |
| + | |||
| + | < | ||
| | | ||
| - | + | </ | |
| + | |||
| + | < | ||
| | | ||
| | | ||
| | | ||
| | | ||
| - | + | </ | |
| + | |||
| + | < | ||
| | | ||
| - | + | </ | |
| + | |||
| + | < | ||
| | | ||
| | | ||
| - | + | </ | |
| + | |||
| + | < | ||
| | | ||
| + | </ | ||
| We need to re-enable the Standby database in the broker configuration | We need to re-enable the Standby database in the broker configuration | ||
| + | < | ||
| | | ||
| | | ||
| | | ||
| - | + | </ | |
| + | |||
| + | < | ||
| | | ||
| - | + | </ | |
| + | |||
| + | < | ||
| Protection Mode: MaxPerformance | Protection Mode: MaxPerformance | ||
| Databases: | Databases: | ||
| otmprod | otmprod | ||
| otmprods - **Physical standby database** | otmprods - **Physical standby database** | ||
| - | + | </ | |
| + | |||
| + | < | ||
| | | ||
| - | + | </ | |
| + | |||
| + | < | ||
| | | ||
| | | ||
| + | </ | ||
| Now check alert log. All is working again. | Now check alert log. All is working again. | ||
| - | =====(Re)Build a physical standby from an active primary database===== | + | ==== (Re)Build a physical standby from an active primary database ==== |
| Run from the standby server. Trivial mods to parameterise it soon! | Run from the standby server. Trivial mods to parameterise it soon! | ||
| - | < | + | < |
| + | - !/usr/ | ||
| + | - ----------- | ||
| + | - How to call: ./ | ||
| + | - ----------- | ||
| + | - Set environment Variables | ||
| + | - ######################################### | ||
| + | export ORACLE_SID=$1 | ||
| + | ORAENV_ASK=" | ||
| + | . oraenv | ||
| + | ORAENV_ASK=" | ||
| + | echo ' ORACLE_HOME is ==> ' $ORACLE_HOME | ||
| + | export PATH=$ORACLE_HOME/ | ||
| - | =====Recover a physical standby from an gap using SCN based incremental (catch up) backup===== | + | $ORACLE_HOME/ |
| + | connect target sys/ | ||
| + | connect auxiliary sys/ | ||
| + | |||
| + | DUPLICATE TARGET DATABASE | ||
| + | FOR STANDBY | ||
| + | FROM ACTIVE DATABASE | ||
| + | SPFILE | ||
| + | SET db_unique_name=' | ||
| + | set LOG_ARCHIVE_DEST_1=' | ||
| + | SET LOG_ARCHIVE_DEST_2=' | ||
| + | SET FAL_SERVER=' | ||
| + | SET FAL_CLIENT=' | ||
| + | SET LOCAL_LISTENER=' | ||
| + | NOFILENAMECHECK; | ||
| + | |||
| + | EORMAN | ||
| + | |||
| + | </ | ||
| + | |||
| + | ==== Recover a physical standby from an gap using SCN based incremental (catch up) backup ==== | ||
| Essential steps using nfs mounted filesystem (/ | Essential steps using nfs mounted filesystem (/ | ||
| - | < | + | < |
| + | Primary | ||
| + | SQL> alter system set log_archive_dest_state_2=defer scope=both; | ||
| + | |||
| + | Standby | ||
| + | SQL> select min(checkpoint_change# | ||
| + | |||
| + | Primary | ||
| + | RMAN> backup incremental from scn < | ||
| + | |||
| + | Standby | ||
| + | SQL> alter database recover managed standby database cancel; | ||
| + | |||
| + | Standby | ||
| + | RMAN> catalog start with '/ | ||
| + | RMAN> recover database noredo; | ||
| + | |||
| + | Primary | ||
| + | SQL> backup current controlfile for standby format '/ | ||
| + | |||
| + | Standby | ||
| + | RMAN> report schema; | ||
| + | RMAN> shutdown immediate; | ||
| + | RMAN> startup nomount; | ||
| + | RMAN> restore standby controlfile from '/ | ||
| + | SQL> alter database mount; | ||
| + | RMAN> report schema; | ||
| + | RMAN> run { | ||
| + | set newname for datafile 1 to ' | ||
| + | set newname for datafile 2 to ' | ||
| + | set newname for datafile 3 to ' | ||
| + | set newname for datafile 4 to ' | ||
| + | switch datafile all; | ||
| + | } | ||
| + | RMAN> run { | ||
| + | set newname for tempfile 1 to ' | ||
| + | switch tempfile all; | ||
| + | } | ||
| + | RMAN> report schema; | ||
| + | |||
| + | Primary | ||
| + | SQL> alter system set log_archive_dest_state_2=enable scope=both; | ||
| + | |||
| + | Standby | ||
| + | SQL> alter database recover managed standby database cancel; | ||
| + | SQL> alter database recover managed standby database using current logfile disconnect from session; | ||
| + | SQL> select inst_id, process, thread#, sequence#, blocks, status from gv$managed_standby where process like ' | ||
| + | |||
| + | </ | ||
| + | |||
| + | ==== Other resources ==== | ||
| + | * [[http:// | ||
| + | * [[http:// | ||
| + | * [[http:// | ||
| + | * [[http:// | ||
| - | =====Other resources===== | ||
| - | * [[http:// | ||
| - | * [[http:// | ||
| - | * [[http:// | ||
| - | * [[http:// | ||
dataguard.1544273360.txt.gz · Last modified: 2018/12/08 12:49 by 0.0.0.0
