Copy Files Between Object Store and a Directory in Autonomous Database

Use the procedure DBMS_CLOUD.PUT_OBJECT to copy a file from a directory to Object Store. Use the procedure DBMS_CLOUD.GET_OBJECT to copy a file from Object Store to a directory.

For example, to copy a file from Object Store to the stage directory, run the following command:

BEGIN
   DBMS_CLOUD.GET_OBJECT(
   credential_name => 'DEF_CRED_NAME',
   object_uri => 'https://objectstorage.usphoenix-1.oraclecloud.com/n/namespace-string/b/bucketname/o/cwallet.sso',
   directory_name => 'STAGE');
END;
/

Creating a credential to access Oracle Cloud Infrastructure Object Store is not required if you enable resource principal credentials. See Use Resource Principal to Access Oracle Cloud Infrastructure Resources for more information.

In this example, namespace-string is the Oracle Cloud Infrastructure object storage namespace and bucketname is the bucket name. See Understanding Object Storage Namespaces for more information.

To run DBMS_CLOUD.GET_OBJECT with a user other than ADMIN you need to grant write privileges on the directory to that user.

To run DBMS_CLOUD.PUT_OBJECT with a user other than ADMIN you need to grant read privileges on the directory to that user.

See GET_OBJECT Procedure and Function and PUT_OBJECT Procedure for more information.