How does one identify if Oracle Data Guard is enabled in Oracle database? 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?
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 &gt; 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';