Can users access and manage cloud code repositories from Oracle Autonomous Database?

112 Views Asked by At

Today, users can access data and scripts like in object stores (OCI object store, AWS S3, Azure Blob Storage etc.) from Autonomous Database. Is it possible to also manage and access cloud code repositories like GitHub, Azure Repos and AWS CodeCommit from ADB?

1

There are 1 best solutions below

0
On

Yes! Recently, Autonomous Database (ADB) added the ability to access and manage cloud code repositories directly from the database, using simple and familiar PLSQL. The DBMS_CLOUD_REPO package has a set of functions & procedures that enable you to create new repositories, export objects to your repo and even install scripts in your database directly from your repo. Here's a full example of how you may install/run a script from your GitHub repo in your ADB instance.

For more examples and information about generating access tokens for your credential object, refer to my blog post and the Oracle documentation.

https://blogs.oracle.com/datawarehousing/post/cloud-code-repositories-in-autonomous-database

DECLARE

     repoHandle clob;

     repoName     clob := 'BlogRepo';

BEGIN
    
    DBMS_CLOUD.CREATE_CREDENTIAL (
  
                                 'GITHUB_CRED',

                                 '<GitHub Email Address>',

                                 '<GitHub Personal Access Token>');



    repoHandle := DBMS_CLOUD_REPO.INIT_GITHUB_REPO(

                    credential_name => 'GITHUB_CRED',

                    repo_name       => 'BlogRepo',

                    owner           => '<GitHub Repo Owner>'

            );

    

    DBMS_OUTPUT.PUT_LINE(repoHandle);



    DBMS_CLOUD_REPO.INSTALL_FILE(

        repo => repoHandle,

        file_path     => 'BlogScript.sql',

        stop_on_error => FALSE

  );

END;

/

DESC persons