Configure Database Sources (Legacy Method)

This is a legacy method for configuring and adding databases sources to AWR Hub. It is a reference topic to be used by AWR Hub users prior to October 30th 2023.

The prerequisites for the registration process differ depending on whether the database you are registering for more information on specific database prerequisites see: Supported Database Versions.

Once the prerequisites listed below have been met, you register the database(s) by running the PL/SQL scripts provided in the Register Database Information pop-up.

ADB-S Prerequisites

The source Autonomous Databases on which AWR Hub is being enabled need to have manage permissions on the Object Storage bucket into which AWR snapshots will be uploaded. To grant these permissions, do the following:

Note

The following two policies need to be created for each of the compartments in which your source databases reside.

  1. Create a user-defined dynamic group for the Autonomous Databases in the compartment from the OCI console.
    ALL {resource.type = 'autonomousdatabase', resource.compartment.id = '<compartmentId>'}

    Replace the compartmentId placeholder with the appropriate value in the above policy

    This policy may require multiple lines if more than one compartment is involved (one line for each compartment).

  2. Give permission to the dynamic group defined in step 1 to manage the Object Storage bucket.
    allow dynamic-group '<UserDefinedDynamicGroupName>' to manage object-family in compartment <Compartment name of the bucket> where ANY{target.bucket.name='<Bucket Name>'} 

    Replace the dynamic group name, compartment name and object storage bucket name placeholders with the appropriate values in the above policy.

ADB-D Prerequisites

Prior to registering an ADB-D database, you need to perform the following steps:

  1. Create an Identity and Access Management (IAM) user and write policies to provide access to the AWR Hub Object Storage Bucket by the IAM user.
  2. Add the IAM user to an IAM group and give permission to the group to manage the Object Storage bucket by writing the following policy:
    allow group '<UserDefinedGroupName>' to manage object-family in compartment <Compartment name of the bucket> where ANY{target.bucket.name='<Bucket Name>'}
  3. Create the AWR Hub cloud credentials, follow the steps outlined in: Create Cloud Credentials.

Configure the Source Database

  • External Databases:

    For information on registering external databases with AWR Hub see: Supported Database Versions.

  • ADB-S and ADB-D
    1. From the Ops Insights menu, select Administration and then Warehouse.
    2. From the AWR Hub tab, click Register Database Information. The Register Database Information pop-up displays.
      Graphic shows the Register Database Information dialog.

      Here, you'll find PL/SQL scripts used to register the source database with the AWR Hub.

    3. Click Copy to copy the PL/SQL code blocks.

      For ADB-S, the following PL/SQL block is used to register the source database with AWR Hub:

      DECLARE
        -- Ask for database source name (max 10 characters).
        -- The value entered must be unique for each database registered to the same AWR Hub.
        db_src_name VARCHAR2(10) := '&SourceName';
      BEGIN
        -- Enable the resource principal in the database.
        -- This allows uploading AWR snapshots to OCI Object Storage using resource principal credentials.
        DBMS_CLOUD_ADMIN.ENABLE_RESOURCE_PRINCIPAL();
        -- Register the database as an AWR source.
        dbms_awrhub.register_source(
          hub_name => 'HUB_CLOUD',
          source_name => db_src_name,
          hub_mailbox => 'http://the.awr.hub.mailbox.Url.returned.by.the.restUrl',
          mailbox_type => 'OBJECT_STORE',
          mailbox_cred => 'OCI$RESOURCE_PRINCIPAL');
        -- Setup a cache at the source side to upload AWR snapshots via data pump directory.
        dbms_awrhub.setup_source_cache_mailbox(
          hub_name => 'HUB_CLOUD',
          source_name => db_src_name,
          cache_mailbox => 'DATA_PUMP_DIR');
      END;
      /

      For ADB-D, the following PL/SQL block is used to register the source database with AWR Hub:

      DECLARE
        -- Ask for database source name (max 10 characters).
        -- The value entered must be unique for each database registered to the same AWR Hub.
        db_src_name VARCHAR2(10) := '&SourceName';
      BEGIN
        
        -- Register the database as an AWR source.
        dbms_awrhub.register_source(
          hub_name => 'HUB_CLOUD',
          source_name => db_src_name,
          hub_mailbox => 'http://the.awr.hub.mailbox.Url.returned.by.the.restUrl',
          mailbox_type => 'OBJECT_STORE',
          mailbox_cred => 'AWRHUB_KEY_NEW');
        -- Setup a cache at the source side to upload AWR snapshots via data pump directory.
        dbms_awrhub.setup_source_cache_mailbox(
          hub_name => 'HUB_CLOUD',
          source_name => db_src_name,
          cache_mailbox => 'DATA_PUMP_DIR');
      END;
      /
    4. Execute the PL/SQL on each target database using any SQL editor, such as SQL Plus or SQL Developer.

      The source database name is user-provided and can be anything up to 10 characters in length. When you run the script, you will be prompted for the source database name. Running the script uploads the AWR snapshot from the source DB to the AWR Hub.

      It may take some time to run the blocks. Data transfer may take up to 24 hours.

Viewing Source Databases

To view the source databases that are uploading AWR snapshots, click AWR Hub in the Ops Insights menu

The process above registers a database. Similarly, you can unregister a database by clicking Unregister Database Information.

Was this article helpful?