Manage and Store Files in a Cloud Code Repository with Autonomous Database
Autonomous Database provides routines to manage and store files in Cloud Code (Git) Repositories. The supported Cloud Code Repositories are: GitHub, AWS CodeCommit, and Azure Repos.
- About Cloud Code Repositories with Autonomous Database
TheDBMS_CLOUD_REPO
package provides a single interface for accessing a Cloud Code Repository from Autonomous Database. - Initialize a Cloud Code Repository
TheDBMS_CLOUD_REPO
initialization routines initialize a Cloud Code Repository. After you obtain a Cloud Code Repository handle, you use the handle to access the Cloud Code Repository. - Create and Manage a Cloud Code Repository
TheDBMS_CLOUD_REPO
management routines allow you to manage a Cloud Code Repository by creating, listing, updating, or deleting a repository. - Create and Manage Branches in a Cloud Code Repository
TheDBMS_CLOUD_REPO
management routines allow you to manage Cloud Code Repository branches by creating, listing, merging, or deleting branches in a repository. - Export Schema Objects to the Cloud Code Repository Branch
TheDBMS_CLOUD_REPO
management routine allows you to export metadata of the objects in a schema to the Cloud Code Repository branch. You can filter your list based on the object names or object types. - Use File Operations with a Cloud Code Repository
TheDBMS_CLOUD_REPO
file operations allow you to create, get, list, update, or delete files in a Cloud Code Repository. - Use SQL Install Operations with a Cloud Code Repository
TheDBMS_CLOUD_REPO
SQL Install operations allow you to store and download SQL scripts from a Cloud Code Repository.
Parent topic: Develop
About Cloud Code Repositories with Autonomous Database
The DBMS_CLOUD_REPO
package provides a single interface for accessing a Cloud Code Repository from Autonomous Database.
The supported Cloud Code Repositories provide the following features:
-
Git Version Control System: Git is software for tracking changes in any set of files, usually used for coordinating work among programmers collaboratively developing source code during software development. Its goals include speed, data integrity, and support for distributed, non-linear workflows.
-
Git Repository: A Git repository is a virtual storage of your project. It allows you to save versions of your code, which you can access when needed.
The DBMS_CLOUD_REPO
APIs
use a repository handle (REPO
object). The repository handle is an
opaque JSON object that represents a Cloud Code Repository of
a specific cloud provider. A REPO
object can be passed to different
DBMS_CLOUD_REPO
APIs. This opaque
object ensures that DBMS_CLOUD_REPO
procedures and functions are multicloud compatible; you do not have to change your
code when you migrate from one Cloud Code Repository provider to another Cloud Code Repository.
-
Repository initialization operations to allow you to initialize a repository.
See Initialize a Cloud Code Repository for more information.
-
Repository management operations that let you create, list, update or delete a repository.
See Create and Manage a Cloud Code Repository for more information.
-
Repository branch management operations that let you create, list, merge or delete branches in a repository.
See Create and Manage Branches in a Cloud Code Repository for more information.
-
Export the metadata DDL of all objects in a schema to a repository.
See Export Schema Objects to the Cloud Code Repository Branch for more information.
-
Repository file management operations to upload, download, update, and delete files.
See Use File Operations with a Cloud Code Repository for more information.
-
SQL install operations that let you export database object metadata DDL to a repository and install SQL statements into the database from a Cloud Code Repository.
See Use SQL Install Operations with a Cloud Code Repository for more information.
Initialize a Cloud Code Repository
The DBMS_CLOUD_REPO
initialization routines initialize a Cloud Code Repository. After you
obtain a Cloud Code Repository handle, you use the handle to access
the Cloud Code Repository.
To initialize a Cloud Code Repository:
See DBMS_CLOUD_REPO Initialization Operations for details on the initialization functions.
Create and Manage a Cloud Code Repository
The DBMS_CLOUD_REPO
management routines allow you to manage a Cloud Code Repository by
creating, listing, updating, or deleting a repository.
First, obtain a Cloud Code Repository handle to provide access a repository. See Initialize a Cloud Code Repository for details.
See DBMS_CLOUD_REPO Repository Management Operations for more information.
Create and Manage Branches in a Cloud Code Repository
The DBMS_CLOUD_REPO
management routines allow you to manage Cloud Code Repository branches by creating, listing, merging, or deleting branches in a repository.
To perform Cloud Code Repository branch management operations you must first:
-
Create a credential.
See CREATE_CREDENTIAL Procedure for details.
-
Obtain a handle.
See Initialize a Cloud Code Repository for details.
-
Create a repository.
See Create and Manage a Cloud Code Repository for details.
-
Log in as the ADMIN user or have
EXECUTE
privilege onDBMS_CLOUD_REPO
.
See DBMS_CLOUD_REPO Repository Branch Management Operations for more information.
Export Schema Objects to the Cloud Code Repository Branch
The DBMS_CLOUD_REPO
management routine allows you to export metadata of the objects in a schema to the Cloud Code Repository branch. You can filter your list based on the object names or object types.
To export schema metadata you must first:
-
Create a credential.
See CREATE_CREDENTIAL Procedure for details.
-
Obtain a handle.
See Initialize a Cloud Code Repository for details.
-
Create a repository.
See Create and Manage a Cloud Code Repository for details.
-
Log in as the ADMIN user or have
EXECUTE
privilege onDBMS_CLOUD_REPO
.
Use the EXPORT_SCHEMA
procedure to export metadata of the objects in your schema to a Cloud Code Repository branch:
BEGIN
DBMS_CLOUD_REPO.EXPORT_SCHEMA
(
repo => l_repo,
schema_name => 'USER1',
file_path => 'myschema_ddl.sql'
filter_list =>
to_clob('[
{ "match_type":"equal",
"type":"table"
},
{ "match_type":"not_equal",
"type":"view"
},
{ "match_type":"in",
"type":"table",
"name": " ''EMPLOYEE_SALARY'',''EMPLOYEE_ADDRESS'' "
},
{ "match_type":"equal",
"type":"sequence",
"name": "EMPLOYEE_RECORD_SEQ"
},
{ "match_type":"like",
"type":"table",
"name": "%OFFICE%"
}
]'
);
);
END;
/
This example exports the metadata of the USER1
schema into the l_repo
repository. The export includes the metadata of the tables EMPLOYEE_SALARY
and EMPLOYEE_ADDRESS
, and any table name that contains OFFICE
. It also exports the EMPLOYEE_RECORD_SEQ
sequence and excludes the views in the schema.
Use File Operations with a Cloud Code Repository
The DBMS_CLOUD_REPO
file operations allow you to create, get, list, update, or delete files in a Cloud Code Repository.
Obtain a Cloud Code Repository handle before using the file operations. See Initialize a Cloud Code Repository for details.
You also need to create a repository before you work with files. See Create and Manage a Cloud Code Repository for details.
See DBMS_CLOUD_REPO File Operations for more information.
Use SQL Install Operations with a Cloud Code Repository
The DBMS_CLOUD_REPO
SQL Install operations allow
you to store and download SQL scripts from a Cloud Code Repository.
Obtain a Cloud Code Repository handle before using the SQL Install operations. See Initialize a Cloud Code Repository for details.
You also need to create a repository before you work with SQL Install operations. See Create and Manage a Cloud Code Repository for details.
The scripts are intended as schema install scripts and not as generic SQL scripts:
- Scripts cannot contain SQL*Plus client specific commands.
- Scripts cannot contain bind variables or parameterized scripts.
- SQL statements must be terminated with a slash on a new line (/).
- Scripts can contain DDL, DML PLSQL statements, but direct
SELECT
statements are not supported. Using SELECT within a PL/SQL block is supported.
Any SQL statement that can be run using EXECUTE IMMEDIATE
will work
if it does not contain bind variables or defines.
See DBMS_CLOUD_REPO SQL Install Operations for more information.