Stop log apply service (MRP) on standby :-
alter database recover managed standby database cancel;
shutdown immediate;
stop log shipping from primary and shutdown primary database:-
Note:- Run this on primary--> to get log_archive_dest location for standby db's please use below query:-
col status for a10
col destination for a50
select dest_name,status,destination from gv$archive_dest_status where destination is not null;
then :-
show parameter log_archive_dest_state_&n; ------> n is number from above query
alter system set log_archive_dest_state_&n='DEFER';
shutdown immediate;
To start primary database & enable log shipping use below steps:-
steps to be performed on PRIMARY DB:-
startup;
alter system set log_archive_dest_state_&n='ENABLE';
steps to be performed on STANDBY DB:-
startup nomount;
alter database mount standby database;
alter database recover managed standby database disconnect from session;
--------- to check status of mrp on standby and (lgwr or lns) on Primary -----
on standby:-
SQL > ! ps -ef | grep -e "pmon\|tnslsnr\|crs\|PARAM\|mrp" | grep -v grep
or
$ ps -ef | grep -e "pmon\|tnslsnr\|crs\|PARAM\|mrp" | grep -v grep
SQL>
-------------------------- Final all in one query for MRP DR ARCHIVE LOG GAP --------------
k.host_name,
k.instance_name,
m.process,
m.status,
a.arch_seq arch,
b.appl_seq appl,
(a.arch_seq-b.appl_seq)
difference from (select thread#, max(sequence#)
as arch_seq from gv$archived_log where archived = 'YES' group by thread#) a,
(select thread#, max(sequence#) as appl_seq from gv$archived_log where applied = 'YES' group by thread#) b,gv$instance k,gv$managed_standby m
where a.thread# = b.thread# (+) and b.thread# = k.thread# (+) and m.thread#<>0 and m.process like '%MRP%' order by a.thread#, a.arch_seq, b.appl_seq;
----------------------------------------------------------------------------------------------------
THREAD HOST_NAME INSTANCE_NAME PROCESS STATUS ARCH APPL DIFFERENCE
---------- ---------------------------------------------------------------- ---------------- --------- ------------ ---------- ---------- ----------
1 host1 instance1 MRP0 APPLYING_LOG 418336 418336 0
2 host2 instance2 MRP0 APPLYING_LOG 512681 512681 0
3 host3 instance3 MRP0 APPLYING_LOG 564134 564134 0
4 host4 instance4 MRP0 APPLYING_LOG 549583 549583 0