Oracle introduced Remote Management Framework (RMF) in 12.2 which allows creating AWR reports on standby database when active data guard is in use. This post list the steps for setting up the RMF so AWR reports could be generated on standby. The post use the data guard configuration set up on 18.3, which is mentioned in a previous post. Current data guard setup and standby open mode is as follows.
On primary run the following to configure the primary node with RMF. Configure node require a unique name for each node configured. If none is provided, the db_unique_name will be used instead.
To generate AWR report create two snapshots on the remote database.
However, after a switchover, when roles changes the automatic snapshot taking will stop, both on new primary (old standby) and new standby (old primary). In order to automatic AWR snapshot to continue do the following after a switchover. As the first step unregistered the new primary (old standby) as a remote database.
Useful Metalink Note
How to Generate AWRs in Active Data Guard Standby Databases [ID 2409808.1]
Related Posts
Enabling Automatic AWR Snapshots on PDB
DGMGRL> show configurationOracle provide a pre-created user sys$umf (locked by default) which has all the necessary privileges to carry out the RMF related work. Unlock this user from primary DB and set a password.
Configuration - paas_iaas_dg
Protection Mode: MaxAvailability
Members:
fradb_fra1kk - Primary database
londb - Physical standby database
Fast-Start Failover: DISABLED
Configuration Status:
SUCCESS (status updated 11 seconds ago)
DGMGRL> show database londb
Database - londb
Role: PHYSICAL STANDBY
Intended State: APPLY-ON
Transport Lag: 0 seconds (computed 0 seconds ago)
Apply Lag: 0 seconds (computed 0 seconds ago)
Average Apply Rate: 1.00 KByte/s
Real Time Query: ON
Instance(s):
lonDB
Database Status:
SUCCESS
alter user sys$umf identified by rmfuser account unlock;Next create two database link that sys$umf user will use to connect to and from the standby DB. The TNS entries used here were created in the previous post. Before creating database link take a note of the global_names parameter. If this is set to true, then DB links are expected to be the same name as the DB they connect to. If not ORA-02085 error could be encountered when trying to use the DB links.
create database link fra_to_lon CONNECT TO sys$umf IDENTIFIED BY rmfuser using 'LONDBTNS';Check the DB links are working by querying remote instance using them. Run both on primary and standby.
create database link lon_to_fra CONNECT TO sys$umf IDENTIFIED BY rmfuser using 'FRADBTNS';
SQL> select instance_name from v$instance@fra_to_lon;
INSTANCE_NAME
----------------
lonDB
SQL> select instance_name from v$instance@lon_to_fra;
INSTANCE_NAME
----------------
fraDB
On primary run the following to configure the primary node with RMF. Configure node require a unique name for each node configured. If none is provided, the db_unique_name will be used instead.
SQL> exec dbms_umf.configure_node ('fraDB');On standby run the following to configure the standby with RMF. In this case a unique name for standby and the db link name from standby to primary is given as inputs.
PL/SQL procedure successfully completed.
SQL> exec dbms_umf.configure_node ('lonDB','lon_to_fra');Create the RMF topology by running following on primary.
PL/SQL procedure successfully completed.
SQL> exec DBMS_UMF.create_topology ('FRA_LON_TOPOLOGY');View the registered nodes. Only primary is registered so far.
PL/SQL procedure successfully completed.
SQL> select * from dba_umf_topology;
TOPOLOGY_NAME TARGET_ID TOPOLOGY_VERSION TOPOLOGY
-------------------- ---------- ---------------- --------
FRA_LON_TOPOLOGY 1423735874 1 ACTIVE
SQL> select * from dba_umf_registration;Register the standby with the topology. The meaning of the input parameters could be found here. Execute the following on primary.
TOPOLOGY_NAME NODE_NAME NODE_ID NODE_TYPE AS_SO AS_CA STATE
-------------------- ---------- ---------- ---------- ----- ----- --------------------
FRA_LON_TOPOLOGY fraDB 1423735874 0 FALSE FALSE OK
exec DBMS_UMF.register_node ('FRA_LON_TOPOLOGY', 'lonDB', 'fra_to_lon', 'lon_to_fra', 'FALSE', 'FALSE');Check both nodes are registered.
SQL> select * from dba_umf_registration;Register the AWR service on the remote node.
TOPOLOGY_NAME NODE_NAME NODE_ID NODE_TYPE AS_SO AS_CA STATE
-------------------- ---------- ---------- ---------- ----- ----- -----
FRA_LON_TOPOLOGY fraDB 1423735874 0 FALSE FALSE OK
FRA_LON_TOPOLOGY lonDB 4041047630 0 FALSE FALSE OK
SQL> exec DBMS_WORKLOAD_REPOSITORY.register_remote_database(node_name=>'lonDB');Verify AWR service is active on the remote node
PL/SQL procedure successfully completed.
SQL> select * from dba_umf_service;
TOPOLOGY_NAME NODE_ID SERVICE
-------------------- ---------- -------
FRA_LON_TOPOLOGY 4041047630 AWR
To generate AWR report create two snapshots on the remote database.
SQL> exec dbms_workload_repository.create_remote_snapshot('lonDB');Once a snapshot is created the standby DB is listed in the AWR with the DB ID that is equal to the node ID (highlighted above) in the UMF registration.
PL/SQL procedure successfully completed.
Instances in this Workload Repository schemaThe AWR instance report generated would list the role as physical standby. The AWR control view list the standby database as well.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
DB Id Inst Num DB Name Instance Host
------------ ---------- --------- ---------- ------
1042410484 1 FRADB lonDB lonvm
4041047630 1 FRADB lonDB lonvm
* 1042410484 1 FRADB fraDB fravm
Enter value for dbid: 4041047630
SQL> select * from dba_hist_wr_control;The remote snapshots will be automatically taken according to snapshot internal.
DBID SNAP_INTERVAL RETENTION TOPNSQL CON_ID SRC_DBID SRC_DBNAME
---------- -------------------- -------------------- ---------- ---------- ---------- ----------
1042410484 +00000 01:00:00.0 +00008 00:00:00.0 DEFAULT 0 1042410484
4041047630 +00000 01:00:00.0 +00008 00:00:00.0 DEFAULT 1042410484 lonDB
Instances in this Workload Repository schema
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
DB Id Inst Num DB Name Instance Host
------------ ---------- --------- ---------- ------
1042410484 1 FRADB lonDB lonvm
4041047630 1 FRADB lonDB lonvm
* 1042410484 1 FRADB fraDB fravm
Enter value for dbid: 4041047630
Using 4041047630 for database Id
Enter value for inst_num: 1
Using 1 for instance number
Specify the number of days of snapshots to choose from
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Entering the number of days (n) will result in the most recent
(n) days of snapshots being listed. Pressingwithout
specifying a number lists all completed snapshots.
Enter value for num_days: 1
Listing the last day's Completed Snapshots
Instance DB Name Snap Id Snap Started Snap Level
------------ ------------ ---------- ------------------ ----------
lonDB FRADB 1 29 Nov 2018 13:11 1
2 29 Nov 2018 13:59 1
3 29 Nov 2018 14:58 1
4 29 Nov 2018 15:58 1
However, after a switchover, when roles changes the automatic snapshot taking will stop, both on new primary (old standby) and new standby (old primary). In order to automatic AWR snapshot to continue do the following after a switchover. As the first step unregistered the new primary (old standby) as a remote database.
SQL> exec DBMS_WORKLOAD_REPOSITORY.UNREGISTER_REMOTE_DATABASE('lonDB','FRA_LON_TOPOLOGY',false);Drop the topology
PL/SQL procedure successfully completed.
exec DBMS_UMF.drop_topology('FRA_LON_TOPOLOGY');Run un-configure procedure on each node
PL/SQL procedure successfully completed.
SQL> exec DBMS_UMF.UNCONFIGURE_NODE;Re-create the topology again with new primary and standby. On new primary
PL/SQL procedure successfully completed.
SQL> exec dbms_umf.configure_node ('lonDB');On new standby
PL/SQL procedure successfully completed.
SQL> exec dbms_umf.configure_node ('fraDB','fra_to_lon');Same topology name is used
PL/SQL procedure successfully completed.
exec DBMS_UMF.create_topology ('FRA_LON_TOPOLOGY');Register new standby
exec DBMS_UMF.register_node ('FRA_LON_TOPOLOGY', 'fraDB', 'lon_to_fra', 'fra_to_lon', 'FALSE', 'FALSE');Register remote DB for AWR by specifying the node ID of the DB shown in dba_umf_registration earlier. If the remote DB registration was to be done using DB name as before then "ORA-13516: AWR Operation failed: ORA-13516: AWR Operation failed: Remote source not registered for AWR" would be encountered when snapshots are taken. Doing log switches as suggested by 2409808.1 did not resolve this issue.
exec DBMS_WORKLOAD_REPOSITORY.register_remote_database(1423735874);Once remote DB is registered remote snapshots could be taken
PL/SQL procedure successfully completed.
SQL> exec dbms_workload_repository.create_remote_snapshot('fraDB');After the role reversal, automatic snapshots will continue on the snapshot interval. Run AWR instance reports same as before.
PL/SQL procedure successfully completed.
Instances in this Workload Repository schemaThe new primary (old standby) will be reflected on the AWR report taken against it.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
DB Id Inst Num DB Name Instance Host
------------ ---------- --------- ---------- ------
1042410484 1 FRADB fraDB fravm
1423735874 1 FRADB fraDB fravm
* 1042410484 1 FRADB lonDB lonvm
Enter value for dbid: 1423735874
Useful Metalink Note
How to Generate AWRs in Active Data Guard Standby Databases [ID 2409808.1]
Related Posts
Enabling Automatic AWR Snapshots on PDB