GET_OBJECT Procedure

This procedure reads an object from Cloud Object Storage and copies it to Autonomous Database. The maximum file size allowed in this procedure is 5 gigabytes (GB).

Syntax

DBMS_CLOUD.GET_OBJECT (
	credential_name      IN VARCHAR2,		
	object_uri           IN VARCHAR2,		
	directory_name       IN VARCHAR2,
	file_name            IN VARCHAR2 DEFAULT  NULL,
	startoffset          IN NUMBER DEFAULT  0,
	endoffset            IN NUMBER DEFAULT  0,
	compression          IN VARCHAR2 DEFAULT  NULL);	

Parameters

Parameter Description

credential_name

The name of the credential to access the Cloud Object Storage.

object_uri

Object or file URI. The format of the URI depends on the Cloud Object Storage service you are using, for details see Cloud Object Storage URI Formats.

directory_name

The name of the directory on the database.

file_name

Specifies the name of the file to create. If file name is not specified, the file name is taken from after the last slash in the object_uri parameter. For special cases, for example when the file name contains slashes, use the file_name parameter.

startoffset

The offset, in bytes, from where the procedure starts reading.

endoffset

The offset, in bytes, until where the procedure stops reading.

compression

Specifies the compression used to store the object. When compression is set to ‘AUTO’ the file is uncompressed (the value ‘AUTO’ implies the object specified with object_uri is compressed with Gzip).

Note:

To run DBMS_CLOUD.GET_OBJECT with a user other than ADMIN you need to grant WRITE privileges on the directory to that user. For example, run the following command as ADMIN to grant write privileges to atpc_user:

GRANT WRITE ON DIRECTORY data_pump_dir TO atpc_user;

Example

BEGIN 
     DBMS_CLOUD.GET_OBJECT(
     credential_name => 'OBJ_STORE_CRED',
     object_uri => 'https://swiftobjectstorage.us-phoenix-1.oraclecloud.com/v1/idthydc0kinr/mybucket/cwallet.sso',
     directory_name => 'DATA_PUMP_DIR'); 
END;
/

In this example, object_uri is an Oracle Cloud Infrastructure Swift URI that specifies the cwallet.sso file in the mybucket bucket in the us-phoenix-1 region. (idthydc0kinr is the object storage namespace in which the bucket resides.) For information about the supported URI formats, see Cloud Object Storage URI Formats.