2

How does one identify if the Oracle Data Guard feature is enabled in Oracle database?

If this can be determined by a query, what is the query for finding the same?

1
  • May i use this query for the same "select distinct status,type from v$archive_dest_status where status='VALID'"
    – Velkumar
    Commented Aug 12, 2015 at 5:36

3 Answers 3

3

There is a built-in procedure for that.

set serveroutput on
declare
  feature_boolean number;
  aux_count number;
  feature_info clob;
begin
  dbms_feature_data_guard(feature_boolean, aux_count, feature_info);
  dbms_output.put_line(feature_boolean);
  dbms_output.put_line(feature_info);
end;
/

Sample output when Data Guard is not used:

0
Data Guard usage not detected

Sample output when Data Guard is used:

1
Number of standbys: 1, Redo Apply used: TRUE, SQL Apply used: FALSE, Snapshot
Standby used: FALSE, Broker used: TRUE, Protection mode: MAXIMUM PERFORMANCE,
Log transports used: LGWR ASYNC, Fast-Start Failover used: FALSE, Real-Time
Apply used: TRUE, Compression used: FALSE, Flashback used: FALSE

The source of the above procedure is not wrapped, so one can browse it and find how the database detects Data Guard usage.

-- check for Data Guard usage by counting valid standby destinations
execute immediate 'select count(*) from v$archive_dest ' ||
    'where status = ''VALID'' and target = ''STANDBY'''
    into num_standbys;

if (num_standbys > 0) then
    feature_boolean := 1;

Basically, if the result of this query is greater than 0, than the Data Guard is in use as per the procedure:

select count(*) from v$archive_dest where status = 'VALID' and target = 'STANDBY';
3
  • In my case am in the need to use query to find the result. please suggest me the queries
    – Velkumar
    Commented Aug 10, 2015 at 7:18
  • @Velkumar Added a query. Commented Aug 10, 2015 at 10:28
  • May i use this query for the same "select distinct status,type from v$archive_dest_status where status='VALID'" From this i can assume database as dataguard if the type is any one of this PHYSICAL,LOGICAL,SNAPSHOT
    – Velkumar
    Commented Aug 12, 2015 at 5:38
2
SELECT NAME,VERSION,CURRENTLY_USED,FEATURE_INFO
FROM DBA_FEATURE_USAGE_STATISTICS
WHERE NAME = 'Data Guard'
1
  • But this query does not output cascade standby from Primary and 1st Standby instead only from Cascade Standby.
    – diptiman
    Commented Apr 27, 2023 at 14:55
0
sqlplus / as sysdba

show parameter LOG_ARCHIVE_CONFIG

if output is blank, it means Data Guard is not configured.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.