Friday, September 6, 2024

Data share - Part IV

In this blogpost we will see about how to create and Authorize data share recipient. A recipient can access the data in the share and can have access to multiple shares. If you remove a recipient, that recipient loses access to all shares it could previously access. The data share provider will create and authorize a new recipient that will access data share and the TABLE / Data source in the share. Then we will provide a new recipient with activation link or the JSON config that is needed to create credential to access the data share.
 
as a SHARE_PROVIDER user, we need to create a new data share recipient named "Training_user"
 
share-provider@ATP19C> begin
  2     dbms_share.create_share_recipient(
  3             recipient_name => 'training_user',
  4             email => '*************' );
  5  end;
  6  /
 
PL/SQL procedure successfully completed.
 
share-provider@ATP19C> select recipient_name,updated
  2  from user_share_recipients;
 
RECIPIENT_NAME       UPDATED
-------------------- -------------------------------------
TRAINING_USER        08-APR-24 11.26.11.841719 AM +05:30
 
 
as a SHARE_PROVIDER user, grant the recipient access privilege to data share.
 
share-provider@ATP19C> begin
  2     dbms_share.grant_to_recipient(
  3             share_name => 'DEMO_SHARE',
  4             recipient_name => 'training_user',
  5             auto_commit => true );
  6  end;
  7  /
 
PL/SQL procedure successfully completed.
 
share-provider@ATP19C> select recipient_name, updated
  2  from user_share_recipient_grants
  3  where share_name ='DEMO_SHARE';
 
RECIPIENT_NAME       UPDATED
-------------------- -------------------------------------
TRAINING_USER        08-APR-24 11.26.38.477501 AM +05:30
 
So the training_user recipient has the access privilege to only one data share.
 
as a SHARE_PROVIDER user, generate the activation link and enable the Authorized recipient to download the delta sharing profile json configuration file
 
share-provider@ATP19C> exec dbms_output.put_line( dbms_share.get_activation_link('training_user') );
https://g26be7c92912cdb-atpdemo19c.adb.us-ashburn-1.oraclecloudapps.com/ords/_adpshr/delta-sharing/download?key=7456B7CE7BDCC383C66A522EBC7DDD7D9D291EA0891FD26DE2F76F895A6917B15FAA4537E52CF8DD5363DADBE48FE1676436c2hhcmVfcHJvdmlkZXI=
 
PL/SQL procedure successfully completed.
 
Copy the activation link URL (highlighted above) that was provided to you by your share provider and paste it in your web browser's address bar, and then press [Enter]. The Autonomous Database Data Sharing page is displayed. To download the config file, click Get Profile Information.
 
 


 
Once if you click GET PROFILE INFORMATION, the output of the script is downloaded as text file, the sample content of text file for the profile information will be like this.
 
{
  "shareCredentialsVersion": 1,
  "endpoint": "https://g26be7c92912cdb-atpdemo19c.adb.us-ashburn-1.oraclecloudapps.com/ords/share_provider/_delta_sharing",
  "tokenEndpoint": "https://g26be7c92912cdb-atpdemo19c.adb.us-ashburn-1.oraclecloudapps.com/ords/share_provider/oauth/token",
  "bearerToken": "VfvFNjOWkt19MN4xfRgLMw",
  "expirationTime": "2024-04-10T05:54:00.102Z",
  "clientID": "Dbpdim8hNYgzYUKbxceUpw..",
  "clientSecret": "PUiThll6LC5vkuLbKmDhew.."
}
 
we need this profile information to consume the data share, which we will see in the next blogpost.

No comments:

Post a Comment