0% found this document useful (0 votes)
14 views14 pages

Oracle Data Guard Cheat Sheet A Must Have For DBAs ! 1745608429

This document serves as a cheat sheet for beginners on Data Guard commands and SQL queries for managing Physical and Logical Standby databases. It includes detailed commands for database registration, archive destinations, and monitoring Data Guard metrics, specifically tailored for Oracle Database version 11.2.0.1 on OEL(5.5). The document aims to provide essential information for troubleshooting Data Guard-related issues without using Grid Control.

Uploaded by

mohamedfaroukit
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
14 views14 pages

Oracle Data Guard Cheat Sheet A Must Have For DBAs ! 1745608429

This document serves as a cheat sheet for beginners on Data Guard commands and SQL queries for managing Physical and Logical Standby databases. It includes detailed commands for database registration, archive destinations, and monitoring Data Guard metrics, specifically tailored for Oracle Database version 11.2.0.1 on OEL(5.5). The document aims to provide essential information for troubleshooting Data Guard-related issues without using Grid Control.

Uploaded by

mohamedfaroukit
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 14

QUERIES AND COMMANDS FOR DATA GUARD ENVIRONMENT

DATA GUARD COMMANDS CHEAT SHEAT

This document is mainly created for beginners to understand DATA GUARD related SQL queries
and DGMGRL Commands. Completely it deals with the management of Physical and Logical Standby
databases without using Grid Control. These guide would help you to get crystal clear idea
and also necessary information for understanding to troubleshoot Data Guard related issues.

DISASTER RECOVERY ENVIRONMENT

DATABASE VERSION  11.2.0.1


OPERATING SYSTEM  OEL(5.5)

PRIMARY DB_UNIQUE_NAME  CRMS


STANDBY DB_UNIQUE_NAME  STBYCRMS

PRIMARY DATABASE SERVER  OEL5.DEV-SERVER.COM  DEV_ENV  192.168.222.133


STANDBY DATABASE SERVER  OEL5.UAT-SERVER.COM  UAT_ENV  192.168.222.134

DATABASE REGISTRATION

# On the Primary database

SYS> select name, db_unique_name, b.instance_name from v$database, v$instance b;

NAME DB_UNIQUE_NAME INSTANCE_NAME


------------ ---------------------- ----------------
CRMS crms crms

SYS> select protection_mode, database_role, switchover_status from v$database;

PROTECTION_MODE DATABASE_ROLE SWITCHOVER_STATUS


-------------------- --------------- --------------------
MAXIMUM PERFORMANCE PRIMARY TO STANDBY

# On the Standby database

SYS> select name, db_unique_name, b.instance_name from v$database, v$instance b;

NAME DB_UNIQUE_NAME INSTANCE_NAME


-------------- ------------------- ----------------------------
CRMS stbycrms stbycrms

SYS> select protection_mode, database_role, switchover_status from v$database;

PROTECTION_MODE DATABASE_ROLE SWITCHOVER_STATUS


-------------------- -------------------- ------------------
MAXIMUM PERFORMANCE PHYSICAL STANDBY NOT ALLOWED

Oracle DBA Technology explored by Gunasekaran , Thiyagu


QUERIES AND COMMANDS FOR DATA GUARD ENVIRONMENT

# On the Primary database

SYS> select log_mode, open_mode, controlfile_type from v$database;

LOG_MODE OPEN_MODE CONTROLFILE_TYPE


------------ -------------------- --------------------
ARCHIVELOG READ WRITE CURRENT

# On the Standby database

SYS> select log_mode, open_mode, controlfile_type from v$database;

LOG_MODE OPEN_MODE CONTROLFILE_TYPE


------------ -------------------- -----------------
ARCHIVELOG MOUNTED STANDBY

NOTE : It’s possible to open the Standby DB in READ-ONLY mode or READ-ONLY WITH APPLY mode.

SCRIPT TO COLLECT CONFIGURED DG PARAMETERS

$ cat dg_parameters.sql

SELECT name, display_value


FROM v$parameter
WHERE name IN
('db_name','db_unique_name','fal_client','fal_server'
, 'log_archive_config','log_archive_dest_1','log_archive_dest_2'
, 'log_archive_dest_state_2','db_file_name_convert','log_file_name_convert'
, 'local_listener','remote_login_passwordfile','standby_archive_dest'
, 'standby_file_management','log_archive_max_processes','dg_broker_start'
, 'dg_broker_config_file1','dg_broker_config_file2')
order by name;

# EXECUTE THE SCRIPT AT PRIMARY & STANDBY DATABASES

SYS> spool dg_parameters.txt


SYS> @dg_parameters.sql;
SYS> spool off;

FOR PRIMARY FOR STANDBY

SPOOL.txt SPOOL.txt

Oracle DBA Technology explored by Gunasekaran , Thiyagu


QUERIES AND COMMANDS FOR DATA GUARD ENVIRONMENT

# HOST NAME AND IP ADDRESS OF THE SERVER

SYS> select sys_context('userenv','server_host') as db_info from dual


UNION ALL select utl_inaddr.get_host_address as db_info from dual;
...

# Local archive destinations for Primary database

SYS> show parameter log_archive_dest_1;

NAME TYPE VALUE


---------------------- ----------- ------------------------------
log_archive_dest_1 string location=USE_DB_RECOVERY_FILE_DEST
valid_for=(ALL_LOGFILES,ALL_ROLES)
DB_UNIQUE_NAME=crms

# Remote (Standby) archive destination at Primary

SYS> show parameter log_archive_dest_2;

NAME TYPE VALUE


----------------------- ---------- ------------------------------
log_archive_dest_2 string service=stby_crmsdb LGWR ASYNC
VALID_FOR=(ONLINE_LOGFILES,PRIMARY_ROLE)
DB_UNIQUE_NAME=stbycrms

# FRA Location and allocated Size for Primary database

SYS> show parameter db_recovery_file_dest;

NAME TYPE VALUE


------------------------------ ---------- ------------------------------------------
db_recovery_file_dest string /u01/app/oracle/flash_recovery_area
db_recovery_file_dest_size big integer 520000M

# Allocated and used Space of FRA at Primary

SYS> SELECT name


, floor(space_limit/1024/1024) "SIZE IN MB"
, ceil(space_used/1024/1024) "USED IN MB"
FROM v$recovery_file_dest
ORDER BY name;

NAME SIZE IN MB USED IN MB


---------------------------------------- ---------- -------------
/u01/app/oracle/flash_recovery_area 52000 4000

Oracle DBA Technology explored by Gunasekaran , Thiyagu


QUERIES AND COMMANDS FOR DATA GUARD ENVIRONMENT

# Configured Archive destinations for Primary and Standby databases (at Primary database)

SYS> SELECT dest_id, dest_name, status, target, archiver, destination


FROM v$archive_dest where destination IS NOT NULL;

DEST_ID DEST_NAME STATUS TARGET ARCHIVER DESTINATION


-------- ------------------ -------- --------- ----------- ------------------------
1 LOG_ARCHIVE_DEST_1 VALID PRIMARY ARCH USE_DB_RECOVERY_FILE_DEST
2 LOG_ARCHIVE_DEST_2 VALID STANDBY LGWR stby_crmsdb

SYS> SELECT
ds.dest_id id, ad.dest_name, ad.status, ds.database_mode db_mode
, ad.archiver, ds.recovery_mode, ds.standby_logfile_count "SRLs"
, ds.standby_logfile_active active, ds.archived_seq#
FROM v$archive_dest_status ds, v$archive_dest ad
WHERE ds.dest_id = ad.dest_id
AND ad.status != 'INACTIVE' ORDER BY ds.dest_id;

# SRL - Standby Redo Log files at Primary database

SYS> select group#, thread#, status, (bytes/1024/1024) "File Size in MB" from v$standby_log;

GROUP# THREAD# STATUS File Size in MB


---------- ---------- ---------- -------------------
4 0 UNASSIGNED 500
5 0 UNASSIGNED 500
6 0 UNASSIGNED 500
7 0 UNASSIGNED 500

# SRL - Standby Redo Log files at Standby database

SYS> select group#, thread#, status, (bytes/1024/1024) "File Size in MB" from v$standby_log;

GROUP# THREAD# STATUS File Size in MB


---------- ---------- ---------- -------------------
4 1 ACTIVE 500
5 1 UNASSIGNED 500
6 1 UNASSIGNED 500
7 0 UNASSIGNED 500

Oracle DBA Technology explored by Gunasekaran , Thiyagu


QUERIES AND COMMANDS FOR DATA GUARD ENVIRONMENT

# Maximum generated Sequence at Primary database

SYS> select thread#, max(sequence#) from v$archived_log group by thread#; or


SYS> select thread#, max(sequence#) from gv$archived_log group by thread#;

THREAD# MAX(SEQUENCE#)
---------- --------------
1 1255

# Maximum applied Sequence at Standby database

SYS> select thread#, max(sequence#) from v$archived_log where applied='YES' group by thread#;

THREAD# MAX(SEQUENCE#)
---------- --------------
1 1255

# On Primary database (Archived log info from the Primary database Control file)

SYS> select sequence#, first_time, next_time, applied from v$archived_log


order by sequence#;

SEQUENCE# FIRST_TIM NEXT_TIME APPLIED


---------- --------- --------- ---------
...
1253 15-JUN-16 15-JUN-16 YES
1253 15-JUN-16 15-JUN-16 NO
1254 15-JUN-16 15-JUN-16 YES
1254 15-JUN-16 15-JUN-16 NO
1255 15-JUN-16 15-JUN-16 YES
1255 15-JUN-16 15-JUN-16 NO

APPLIED  Indicates whether the archive log has been applied to its corresponding Standby
database (YES) or not (NO). The value is always NO for local destinations.

# On Standby database (Archived log info from the Standby database control file)

SYS> select sequence#, first_time, next_time, applied from v$archived_log


order by sequence#;

SEQUENCE# FIRST_TIM NEXT_TIME APPLIED


---------- --------- --------- ---------
...
1253 15-JUN-16 15-JUN-16 YES
1254 15-JUN-16 15-JUN-16 YES
1255 15-JUN-16 15-JUN-16 YES

Oracle DBA Technology explored by Gunasekaran , Thiyagu


QUERIES AND COMMANDS FOR DATA GUARD ENVIRONMENT

# Current Status of Data Guard related Process (at Physical Standby)

SYS> select process, status, thread#, sequence# from v$managed_standby;

PROCESS STATUS THREAD# SEQUENCE#


--------- ------------ ---------- ----------
ARCH CLOSING 1 1254
ARCH CLOSING 1 1255
ARCH CONNECTED 0 0
ARCH CLOSING 1 1249
MRP0 APPLYING_LOG 1 1256
RFS IDLE 1 1256
RFS IDLE 0 0
RFS IDLE 0 0
RFS IDLE 0 0

9 rows selected.

SYS> select client_process, process, thread#, sequence#, status FROM v$managed_standby


WHERE client_process='LGWR' or process='MRP0' ORDER BY process;

CLIENT_P PROCESS THREAD# SEQUENCE# STATUS


-------- --------- ---------- ---------- ------------
N/A MRP0 1 1256 APPLYING_LOG
LGWR RFS 1 1256 IDLE

# To check log Status at Standby database

SYS> SELECT 'Last Log applied: 'logs, to_char(next_time,'DD-MON-YY:HH24:MI:SS') "Time"


FROM v$archived_log WHERE sequence# = (select max(sequence#) from v$archived_log
WHERE applied='YES') UNION
SELECT 'Last Log received: 'logs, to_char(next_time,'DD-MON-YY:HH24:MI:SS') "Time"
FROM v$archived_log where sequence# = (select max(sequence#) from v$archived_log);

LOGS TIME
-------------------- ------------------
Last Log applied : 15-JUN-16:02:53:11
Last Log received : 15-JUN-16:02:53:11

# On Primary database
# Displays and logs events triggered by any message to the alert.log or trace files

SYS> select severity, error_code, to_char(timestamp,'DD-MON-YYYY HH24:MI:SS')


"timestamp", message from v$dataguard_status where dest_id=2;
...

Oracle DBA Technology explored by Gunasekaran , Thiyagu


QUERIES AND COMMANDS FOR DATA GUARD ENVIRONMENT

The view V$DATAGUARD_STATUS displays messages recently written to the alert.log file or
Server process trace files that concern Physical Standby databases or redo transport
Services for all Standby database types.

# On Primary database (To find messages/errors)

SYS> select message from v$dataguard_status;

MESSAGE
---------------------------------------------------------------------------------------------
LNS: Standby redo logfile selected for thread 1 sequence 1255 for destination LOG_ARCHIVE_DEST_2
LNS: Beginning to archive log 3 thread 1 sequence 1255
LNS: Completed archiving log 3 thread 1 sequence 1255
ARC2: Beginning to archive thread 1 sequence 1255 (6375081-6375114)
ARC2: Completed archiving thread 1 sequence 1255 (6375081-6375114)
LNS: Standby redo logfile selected for thread 1 sequence 1256 for destination LOG_ARCHIVE_DEST_2
LNS: Beginning to archive log 2 thread 1 sequence 1256

# On Standby database (To find messages/errors)

SYS> select message from v$dataguard_status;

MESSAGE
---------------------------------------------------------------------------------------------
...
ARC0: Beginning to archive thread 1 sequence 1254 (6375073-6375081)
ARC0: Completed archiving thread 1 sequence 1254 (0-0)
Media Recovery Waiting for thread 1 sequence 1255 (in transit)
ARC1: Beginning to archive thread 1 sequence 1255 (6375081-6375114)
Media Recovery Waiting for thread 1 sequence 1256
ARC1: Completed archiving thread 1 sequence 1255 (0-0)

# Execute the Script at Primary database to find archived log gap details

SYS> @archive_gap.sql;

DB_NAME HOSTNAME LOG_ARCHIVED LOG_APPLIED APPLIED_TIME LOG_GAP


---------- -------------- ------------ ----------- -------------- -------
CRMS OEL5 1336 1332 15-JUN/16:01 4

# On Standby database

SYS> select * from v$archive_gap;

THREAD# LOW_SEQUENCE# HIGH_SEQUENCE#


---------- ------------- --------------
1 1333 1334

You can get archive_gap.sql script here.

Oracle DBA Technology explored by Gunasekaran , Thiyagu


QUERIES AND COMMANDS FOR DATA GUARD ENVIRONMENT

# Find the missing sequence at Primary database

SYS> SELECT name


FROM v$archived_log
WHERE dest_id = 1
AND sequence# BETWEEN 1333 and 1336;

NAME
--------------------------------------------------------------------------------------
/u01/app/oracle/flash_recovery_area/CRMS/archivelog/2016_06_15/o1_mf_1_1333_cp1vsq53_.arc
/u01/app/oracle/flash_recovery_area/CRMS/archivelog/2016_06_15/o1_mf_1_1334_cp1vwskv_.arc
/u01/app/oracle/flash_recovery_area/CRMS/archivelog/2016_06_15/o1_mf_1_1335_cp1vxzds_.arc
/u01/app/oracle/flash_recovery_area/CRMS/archivelog/2016_06_15/o1_mf_1_1336_cp1vy2lr_.arc

FYI: Incase listed archived logs already deleted at Primary, you need to roll forward
Standby database using RMAN incremental backup based on last SCN of the Standby database.

DATA GUARD METRICS

# Displays Information about Redo Data metrics (at Standby database)

SYS> select name, value from v$dataguard_stats; or # Transport lag, Apply lag,
SYS> select * from v$dataguard_stats; # Apply finish time, Estimated Startup time
...

V$DATAGUARD_STATS displays information about Data Guard metrics when queried on a Standby
database. I.e. it is describing redo data generated by the primary database that is not
yet available on the standby database and how much redo has not yet been applied to the
Standby database. No rows are returned when queried on a primary database.

# To find out speed of media recovery at Standby database (apply rate)

SYS> select * from v$recovery_progress; or


SYS> select to_char(start_time, 'DD-MON-RR HH24:MI:SS') start_time, item,
ROUND(sofar/1024,2) "MB/Sec" FROM v$recovery_progress
WHERE (item='Active Apply Rate' or item='Average Apply Rate');

START_TIME ITEM MB/Sec


------------------ -------------------------------- ----------
15-JUN-16 22:10:17 Active Apply Rate 2.34
15-JUN-16 22:10:17 Average Apply Rate .78

The view V$RECOVERY_PROGRESS can be used to track database recovery operations to ensure
that they are not stalled, and also to estimate the time required to complete the operation
In progress.

Oracle DBA Technology explored by Gunasekaran , Thiyagu


QUERIES AND COMMANDS FOR DATA GUARD ENVIRONMENT

# To find Last applied log Timestamp

SYS> select to_char(max(first_time),'hh24:mi:ss dd/mm/yyyy') "LAST LOG APPLIED TIME"


from v$archived_log where applied='YES';

LAST LOG APPLIED TIME


----------------------
00:00:31 26/07/2016

 FIRST_TIME  Timestamp of the first change


 NEXT_TIME  Timestamp of the next change.

# Check received sequence at Standby database

SYS> select registrar, creator, thread#, sequence#, first_change#, next_change#


FROM v$archived_log;

REGISTR CREATOR THREAD# SEQUENCE# FIRST_CHANGE# NEXT_CHANGE#


------- ------- ---------- ---------- ------------- ------------
RFS ARCH 1 1686 7020792 7020795
RFS ARCH 1 1687 7020795 7020801
RFS ARCH 1 1688 7020801 7020804
RFS ARCH 1 1689 7020804 7020808
RFS ARCH 1 1690 7020808 7020813
RFS ARCH 1 1691 7020813 7020816
RFS ARCH 1 1692 7020816 7025792

# Verify the last sequence# received and applied at Standby database

SYS> select arch.thread# "thread",


arch.sequence# "LAST SEQUENCE RECEIVED",
appl.sequence# "LAST SEQUENCE APPLIED",
(arch.sequence# - appl.sequence#) "DIFFERENCE"
FROM (select thread#, sequence# from v$archived_log
WHERE(thread#, first_time ) IN (select thread#, max(first_time)
FROM v$archived_log group by thread#))arch, (select thread#, sequence#
FROM v$log_history
WHERE (thread#, first_time)
IN (select thread#, max(first_time)
FROM v$log_history group by thread#)) appl
WHERE arch.thread# = appl.thread# order by 1;

Thread Last Sequence Received Last Sequence Applied Difference


---------- ---------------------- --------------------- ----------
1 1692 1692 0

Oracle DBA Technology explored by Gunasekaran , Thiyagu


QUERIES AND COMMANDS FOR DATA GUARD ENVIRONMENT

This query shows what process is servicing to the archived destinations.


(The destinations are local or remote)

# listing defined archived destinations (at Primary database)

SYS> SELECT thread#, dest_id, destination, gvad.status, target, schedule, process,


FROM gv$archive_dest gvad, gv$instance gvi
WHERE gvad.inst_id = gvi.inst_id
AND destination is NOT NULL
ORDER BY thread#, dest_id;

THREAD# DEST_ID DESTINATION STATUS TARGET SCHEDULE PROCES


---------- ---------- --------------------------- --------- ------- -------- --------
1 1 USE_DB_RECOVERY_FILE_DEST VALID PRIMARY ACTIVE ARCH
1 2 stby_crmsdb VALID STANDBY ACTIVE LGWR

# listing defined archived destinations (at Standby database)

SYS> SELECT thread#, dest_id, destination, gvad.status, target, schedule, process,


FROM gv$archive_dest gvad, gv$instance gvi
WHERE gvad.inst_id = gvi.inst_id
AND destination is NOT NULL
ORDER BY thread#, dest_id;

THREAD# DEST_ID DESTINATION STATUS TARGET SCHEDULE PROCES


---------- ---------- --------------------------- --------- ------- -------- --------
1 1 USE_DB_RECOVERY_FILE_DEST VALID LOCAL ACTIVE ARCH
1 2 crmsdb VALID REMOTE PENDING LGWR
1 32 USE_DB_RECOVERY_FILE_DEST VALID LOCAL ACTIVE RFS

For a physical standby should have at least 1 remote destination that points the Primary.

# Local and Remote destination at Standby database

SYS> select dest_id, process, transmit_mode, async_blocks, net_timeout,


delay_mins, reopen_secs, register from v$archive_dest;

DEST_ID PROCESS TRANSMIT_MODE ASYNC_BLOCKS NET_TIMEOUT DELAY_MINS REOPEN_SECS REG


--------- ---------- ------------ ------------ ----------- ---------- ----------- ----
1 ARCH SYNCHRONOUS 0 0 0 300 YES
2 LGWR ASYNCHRONOUS 16381 30 0 300 YES
3 ARCH SYNCHRONOUS 0 0 0 0 NO
..
...
31 ARCH SYNCHRONOUS 0 0 0 0 NO
32 RFS SYNCHRONOUS 0 0 0 300 YES

Oracle DBA Technology explored by Gunasekaran , Thiyagu


QUERIES AND COMMANDS FOR DATA GUARD ENVIRONMENT

# To check what MRP is waiting

SYS> select a.event, a.wait_time, a.seconds_in_wait from v$session_wait a, v$session b


WHERE a.sid=b.sid and b.sid=(select SID from v$session
WHERE PADDR=(select PADDR from v$bgprocess where NAME='MRP0'));
...

# To obtain Archive lag histogram

SYS> select * from v$standby_event_histogram;


...

Archive Lag Histogram: The V$STANDBY_EVENT_HISTOGRAM view came with 11gR2; histogram that
shows the historical occurrence (history of apply lag) values in terms of seconds since
the Standby database last started.

# ORL (Online Redo Log) Files at Primary database

SYS> select group#, status, members, (bytes/1024/1024) "ORL File Size in MB" FROM v$log;

GROUP# STATUS MEMBERS ORL File Size in MB


---------- ---------------- ---------- ------------------------
1 ACTIVE 1 50
2 INACTIVE 1 50
3 CURRENT 1 50

# ORL (Online Redo Log) Files at Standby database

SYS> select group#, status, members,(bytes/1024/1024)"ORL File Size in MB" from v$log;

GROUP# STATUS MEMBERS ORL File Size in MB


---------- ---------- ---------------- ----------------------------------
1 CLEARING 1 50
3 CLEARING_CURRENT 1 50
2 CLEARING 1 50

# SRL Files at Standby database

SYS> select group#, thread#, status, used, archived, (bytes/1024/1024)


"SRL File Size in MB" from v$standby_log;

GROUP# THREAD# STATUS USED ARCHIVED SRL File Size in MB


---------- ---------- ---------- ---------- --------- -------------------
4 1 UNASSIGNED 512 NO 50
5 1 ACTIVE 14647808 YES 50
6 1 UNASSIGNED 512 NO 50
7 0 UNASSIGNED 512 NO 50

Oracle DBA Technology explored by Gunasekaran , Thiyagu


QUERIES AND COMMANDS FOR DATA GUARD ENVIRONMENT

This following query shows any errors that occurred the last time an attempt to archive to
the destination was attempted. If ERROR is blank and status is VALID then the archive
completed correctly.

SYS> select dest_id, status, error from v$archive_dest;


SYS> select dest_id, dest_name, status, transmit_mode, archiver, reopen_secs,
error FROM v$archive_dest WHERE dest_id='&x';

Enter value for x: 1


old 3: where DEST_ID='&x'
new 3: where DEST_ID='1'

DEST_ID DEST_NAME STATUS TRANSMIT_MOD ARCHIVER REOPEN_SECS ERROR


---------- ---------------------- --------- ------------ ---------- ----------- ------
1 LOG_ARCHIVE_DEST_1 VALID SYNCHRONOUS ARCH 300

SYS> /

Enter value for x: 2


old 3: where DEST_ID='&x'
new 3: where DEST_ID='2'

DEST_ID DEST_NAME STATUS TRANSMIT_MOD ARCHIVER REOPEN_SECS ERROR


---------- ---------------------- --------- ------------ ---------- ----------- ------
2 LOG_ARCHIVE_DEST_2 VALID ASYNCHRONOUS LGWR 300

# Verify Real-Time-Apply enabled or not (at Standby database)

SYS> SELECT dest_id, recovery_mode from v$archive_dest_status;

DEST_ID RECOVERY_MODE
---------- -----------------------
1 MANAGED REAL TIME APPLY

# At Primary database (need to mention correct dest_id as per configuration)

SYS> select recovery_mode from v$archive_dest_status where dest_id = 2;

RECOVERY_MODE
-----------------------
MANAGED REAL TIME APPLY

# At Standby database (need to mention correct dest_id as per configuration)

SYS> select recovery_mode from v$archive_dest_status where dest_id = 1;

RECOVERY_MODE
-----------------------
MANAGED REAL TIME APPLY

Oracle DBA Technology explored by Gunasekaran , Thiyagu


QUERIES AND COMMANDS FOR DATA GUARD ENVIRONMENT

# Disabling

SYS> alter system set log_archive_dest_state_2='DEFER';


System altered.

SYS> alter system set log_archive_dest_state_2='ENABLE';


System altered.

# Some Processes related to Data Guard environment at Primary database

SYS> select process, client_process, thread#, sequence#, status from v$managed_standby;

PROCESS CLIENT_P THREAD# SEQUENCE# STATUS


--------- -------- ---------- ---------- ------------
ARCH ARCH 1 1702 CLOSING
ARCH ARCH 1 1700 CLOSING
ARCH ARCH 0 0 CONNECTED
ARCH ARCH 1 1701 CLOSING
LNS LNS 1 1703 WRITING

# Some Processes related to Data Guard environment at Standby database

SYS> select process, client_process, thread#, sequence#, status from v$managed_standby;

PROCESS CLIENT_P THREAD# SEQUENCE# STATUS


--------- -------- ---------- ---------- ------------
ARCH ARCH 1 1702 CLOSING
ARCH ARCH 1 1701 CLOSING
ARCH ARCH 0 0 CONNECTED
ARCH ARCH 1 1700 CLOSING
RFS N/A 0 0 IDLE
RFS UNKNOWN 0 0 IDLE
RFS LGWR 1 1703 IDLE
RFS UNKNOWN 0 0 IDLE
MRP0 N/A 1 1702 APPLYING_LOG

9 rows selected.

ARCH Archiver Process


LNS Log Network Server
RFS Remote File Server
MRP0 Managed Recovery Process

# Redo Apply at Standby database

SYS> select program from v$session where program like '%MRP%';


...

Oracle DBA Technology explored by Gunasekaran , Thiyagu


QUERIES AND COMMANDS FOR DATA GUARD ENVIRONMENT

SYS> select process, status, sequence# from v$managed_standby


WHERE process like '%MRP%';

PROCESS STATUS SEQUENCE#


--------- ------------ ----------
MRP0 APPLYING_LOG 1702

Following Shell command lists the archive log apply records of standby database alert log
with the corresponding times at the end of the line.

$ tail -10000 /u01/app/oracle/diag/rdbms/stbycrms/stbycrms/trace/alert_stbycrms.log|


awk -v x="" '{if (index($0,"Media Recovery Log ")!=0) print $0" "x; else
if($1=="Mon"||$1=="Tue"||$1=="Wed"||$1=="Thu"||$1=="Fri"||$1=="Sat"||$1=="Sun") x=$0}'

Oracle DBA Technology explored by Gunasekaran , Thiyagu

You might also like