Data Guard
Data Guard
Data Guard
Learning is Fun-
tastic
Oracle DBA Tweets .... Learning is Fun-tastic .... You must stop talking about the problem
and start talking about the solution, start speaking words of victory. We should never
stop working on ourselves. Always be positive and keep smiling..have a great day
friends :) Source: Internet
RECOVERY_MODE
-----------------------
MANAGED REAL TIME APPLY
RECOVERY_MODE
-------------
MANAGED
On Primary Database
===================
select DEST_ID,DEST_NAME,DESTINATION,TARGET,STATUS,ERROR from v$archive_dest
where DESTINATION dest_id=2;
/
set numwidth 15
select max(sequence#) current_seq,archived,status from v$log;
/
On Standby Database
===================
SELECT THREAD#, LOW_SEQUENCE#, HIGH_SEQUENCE# FROM V$ARCHIVE_GAP
/
select PROCESS,STATUS,THREAD#,SEQUENCE#,BLOCK#,BLOCKS,DELAY_MINS from
v$managed_standby;
/
select max(sequence#),thread# from gv$archived_log where applied='YES' group by thread#;
/
set numwidth 15
select max(applied_seq#) last_seq from v$archive_dest_status;
/
FIND GAP
--------
select thread#,low_sequence#,high_sequence# from v$archive_log;
DELAY CHANGE
------------
SQL> alter system set log_archive_dest_2='ARCH DELAY=15 OPTIONAL REOPEN=60
SERVICE=S1';
============================================================================
======================================
Standby Database
================
select NAME,DATABASE_ROLE,OPEN_MODE,PROTECTION_MODE,PROTECTION_LEVEL,
CURRENT_SCN,FLASHBACK_ON,FORCE_LOGGING from v$database;
WAIT_FOR_LOG - Process is waiting for the archived redo log to be completed. Switch an
archive log on the primary and requery v$managed_standby to see if the status changes to
APPLYING_LOG.
WAIT_FOR_GAP - Process is waiting for the archive gap to be resolved. Review the alert log to
see if FAL_SERVER has been called to resolve the gap.
APPLYING_LOG - Process is applying the archived redo log to the standby database.
STARTING MRP0
-------------
ALTER DATABSE RECOVER MANAGED STANDBY DATABASE DISCONNECT FROM SESSION;
STOPING MRP0
------------
RECOVER MANAGED STANDBY DATABASE CANCEL;
select TIMESTAMP,completion_time
"ArchTime",SEQUENCE#,round((blocks*block_size)/(1024*1024),1)
"SizeM",round((TIMESTAMP-lag(TIMESTAMP,1,TIMESTAMP) OVER (order by
TIMESTAMP))*24*60*60,1) "Diff(sec)",round((blocks*block_size)/1024/
decode(((TIMESTAMP-lag(TIMESTAMP,1,TIMESTAMP) OVER (order by
TIMESTAMP))*24*60*60),0,1, (TIMESTAMP-lag(TIMESTAMP,1,TIMESTAMP) OVER (order by
TIMESTAMP))*24*60*60),1) "KB/sec", round((blocks*block_size)/(1024*1024)/
decode(((TIMESTAMP-lag(TIMESTAMP,1,TIMESTAMP)
OVER (order by TIMESTAMP))*24*60*60),0,1, (TIMESTAMP-lag(TIMESTAMP,1,TIMESTAMP)
OVER (order by TIMESTAMP))*24*60*60),3)
"MB/sec",round(((lead(TIMESTAMP,1,TIMESTAMP) over (order by TIMESTAMP))-
completion_time)*24*60*60,1) "Lag(sec)" from v$archived_log a, v$dataguard_status dgs
where a.name = replace(dgs.MESSAGE,'Media Recovery Log ','') and dgs.FACILITY = 'Log Apply
Services' order by TIMESTAMP desc;
/
--OR---
Here is another script with v$dataguard_status:
select *
from (select TIMESTAMP,
completion_time "ArchTime",
SEQUENCE#,
round((blocks * block_size) / (1024 * 1024), 1) "Size Meg",
round((TIMESTAMP - lag(TIMESTAMP, 1, TIMESTAMP)
OVER(order by TIMESTAMP)) * 24 * 60 * 60,
1) "Diff(sec)",
round((blocks * block_size) / 1024 /
decode(((TIMESTAMP - lag(TIMESTAMP, 1, TIMESTAMP)
OVER(order by TIMESTAMP)) * 24 * 60 * 60),
0,
1,
(TIMESTAMP - lag(TIMESTAMP, 1, TIMESTAMP)
OVER(order by TIMESTAMP)) * 24 * 60 * 60),
1) "KB/sec",
round((blocks * block_size) / (1024 * 1024) /
decode(((TIMESTAMP - lag(TIMESTAMP, 1, TIMESTAMP)
OVER(order by TIMESTAMP)) * 24 * 60 * 60),
0,
1,
(TIMESTAMP - lag(TIMESTAMP, 1, TIMESTAMP)
OVER(order by TIMESTAMP)) * 24 * 60 * 60),
3) "MB/sec",
round(((lead(TIMESTAMP, 1, TIMESTAMP) over(order by TIMESTAMP)) -
completion_time) * 24 * 60 * 60,
1) "Lag(sec)"
from v$archived_log a, v$dataguard_status dgs
where a.name = replace(dgs.MESSAGE, 'Media Recovery Log ', '')
and dgs.FACILITY = 'Log Apply Services'
order by TIMESTAMP desc)
where rownum < 10;
REGISTRYING LOGFILE
-------------------
alter database register logfile '/file/path/';
v$archive_dest_status - TO FIND THE LAST ARCHIVED LOG RECEIVED AND APPLIED ON THIS
SITE.
select archived_thread#,archived_seq#,applied_thread#,applied_seq# from
v$archive_dest_status;
v$log_history
select max(sequence#),latest_archive_log from v$log_history;
http://oraclerac.weebly.com/standby.html
============================================================================
======================================
NOTE: Pls check Metalink 232649.1 (Data Guard Gap Detection and Resolution)
On Standby server:
Run the below query to check the type of Standby database, PHYSCIAL or LOGICAL:
If there is a gap, then it is most likely that the log has been compressed on the Primary server,
and the Standby FAL service cannot retrieve the log.If so, then temporarily stop archivelog
compression job on the primary and unzip the required archive logs. After a few minutes, the
FAL service will retrieve the log and the Standby apply services will resume.Check the progress
by running the SQL in step-1 above.
If the logs haven't been processed after 5-10 minutes, then you will have to perform the
following tasks:
Step3: Copy the (zipped) log to the standby archive log destination on the Standby server,
(unzip the archive), and register,
Found this:
RECOVER MANAGED STANDBY DATABASE cancel;
ORA-16136: Managed Standby Recovery not active
startup nomount;
alter database mount standby database;
alter database recover managed standby database disconnect;
shutdown immediate
startup nomount
alter database mount standby database;
alter database recover automatic standby database;
shutdown immediate
startup nomount
alter database mount standby database;
alter database recover managed standby database disconnect;
Start Logical standby >> alter database start logical standby apply;
See how up to date a physical standby is: (Run this on the primary)
set numwidth 15
select max(sequence#) current_seq from v$log;
set lines 100 set numwidth 15 column ID format 99 column "SRLs" format 99 column active
format 99 col type format a4
============================================================================
======================================
Share 0
‹ Home ›
View web version
Powered by Blogger.