Thursday, August 18, 2022

Database Links using Autonomous Database with private endpoints across regions

I am using Autonomous Databases 19c shared infrastructure(ADB-S) with the source in Phoenix and the target in London.

Prereqs include:

  • Two ADB-S with private endpoints , one in each region
  • Region peering configured
  • DNS configured -- I like to create a compute VM in each region and verify region peering and DNS is working
Once the above is completed follow the next steps to create the db links.

  • Upload the target database wallet to object storage
  • Create the directory in the database to hold the wallet in the source database
  • Create the credential to access object storage in the source database
  • Copy the wallet from object storage to the source database
  • Create another credential to access target database in the source database
  • Create the database link
References:

Example:
Run the following commands  on the source database:

create directory wallet_dir_london as 'WALLETDIR_LONDON';


begin

    DBMS_CLOUD.create_credential (

    credential_name => 'OBJ_STORE_CREDA',

    username => 'YOUROCIUSERNAME',

    password => 'YOURTOKEN

  ) ;

end;

/


begin DBMS_CLOUD.GET_OBJECT(

      credential_name => 'OBJ_STORE_CREDA',

      object_uri => 'https://objectstorage.us-phoenix-1.oraclecloud.com/n/YOURTENANCY/b/gfswinglondon/o/cwallet.sso',

      directory_name => 'WALLET_DIR_LONDON'); 

      END;

 /  


SELECT * FROM DBMS_CLOUD.LIST_FILES('WALLET_DIR_LONDON');


BEGIN

   DBMS_CLOUD.CREATE_CREDENTIAL(

   credential_name => 'DB_LINK_CRED',

   username => 'ADMIN',

   password => 'YOURADBPASSWORD');

END;

/


SELECT owner, credential_name FROM dba_credentials


BEGIN

DBMS_CLOUD_ADMIN.CREATE_DATABASE_LINK(

    db_link_name => 'LONDONDBLINK', 

    hostname => '*********.adb.uk-london-1.oraclecloud.com',    (your hostname here)

    port => '1522',

   service_name => '**************_gfswinglon_high.adb.oraclecloud.com',   (your service name here)

   ssl_server_cert_dn => 'CN=adwc.eucom-central-1.oraclecloud.com, OU=Oracle BMCS FRANKFURT, O=Oracle Corporation, L=Redwood City, ST=California, C=US',

   credential_name => 'DB_LINK_CRED',

   directory_name => 'WALLET_DIR_LONDON',

   private_target => TRUE);

END;

/


select ora_database_name@londondblink from dual;

No comments:

Post a Comment