Driver FixRecommendedSound, Wi-Fi or graphics acting up? Check drivers firstFind missing or outdated drivers fast.Check DriversOctober DealsAmazon USOctober deal check: compare before you payAmazon US: current deals, useful picks and tech finds.Check DealsClean PCRecommendedOne scan can reveal what keeps slowing WindowsLook for cleanup and repair opportunities.Run Scan×
Skip to content
World desk3 min

How to Read OCI Object Storage Files from Oracle Database with Resource Principals

Enable the database resource principal and pass OCI$RESOURCE_PRINCIPAL to DBMS_CLOUD: use COPY_DATA to load file records or LIST_OBJECTS to inspect bucket objects.

What’s actually slowing this PC down?

Pick the symptom - the matching free tool is one click away.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

To access an OCI Object Storage bucket from Oracle Database using a resource principal, enable the principal for the database or target schema, then pass the resulting OCI$RESOURCE_PRINCIPAL credential to the appropriate DBMS_CLOUD operation. Use COPY_DATA to load file records into a table; use LIST_OBJECTS to enumerate objects. The steps below are documented for Autonomous Database. Other database services and releases may require version-specific checks.

Choose the operation for what you need to do

“Read bucket files” can mean loading their contents into database rows or simply checking which objects are in a bucket. These are separate tasks:

As an Amazon Associate I earn from qualifying purchases.

Goal Operation Result
Load file data into a database table DBMS_CLOUD.COPY_DATA Reads the specified file or files and loads records into a table. See Oracle’s COPY_DATA guidance.
Inspect objects in a bucket DBMS_CLOUD.LIST_OBJECTS Returns object information for the specified location. See Oracle’s DBMS_CLOUD package documentation.

Enable the resource principal

An administrator enables the resource principal with DBMS_CLOUD_ADMIN.ENABLE_RESOURCE_PRINCIPAL. With no username, Oracle documents enabling it for ADMIN; a schema username can be supplied to enable it for that schema. The operation creates the OCI$RESOURCE_PRINCIPAL credential used in subsequent DBMS_CLOUD calls. See Oracle’s resource-principal setup instructions.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

For example, to enable the principal for a particular schema, use the documented procedure with that schema’s username:

BEGIN
  DBMS_CLOUD_ADMIN.ENABLE_RESOURCE_PRINCIPAL(
    username => 'SCHEMA_NAME'
  );
END;
/

Replace SCHEMA_NAME with the target schema. If the intended caller is ADMIN, follow Oracle’s instructions for the no-username form instead.

Confirm the OCI identity has bucket access

Enabling the credential in the database is not, by itself, proof that the identity can read every object in OCI. The database resource principal needs applicable OCI IAM permissions for the intended bucket and operation. The correct policy depends on the database service, compartment, bucket, and tenancy configuration, so do not assume that one policy statement fits every deployment.

Oracle documents resource-principal identities for database cloud services, including Autonomous Database and Base Database Service, and describes schema-specific principals as a way to scope access more narrowly. Verify the identity and policy scope for your own deployment in Oracle’s resource-principal identity documentation.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Build an HTTPS URI for the bucket object

The URI must identify the Object Storage namespace, bucket, and object, and Oracle’s Autonomous Database instructions require HTTPS. The endpoint form depends on the OCI realm. Oracle recommends the dedicated endpoint form for the commercial OC1 realm; for other realms it documents the standard Object Storage endpoint. See Oracle’s Autonomous Database URI formats.

Realm Documented URI pattern
Commercial realm OC1 https://namespace-string.objectstorage.region.oci.customer-oci.com/n/namespace-string/b/bucketname/o/filename
Other realms https://objectstorage.region.oraclecloud.com/n/namespace-string/b/bucket/o/filename

Replace the namespace, region, bucket, and filename with values from your OCI environment. Use the URI for the actual object when loading a file. For listing, provide the appropriate bucket location URI and follow the target package signature.

Load a file into a table with COPY_DATA

Oracle’s documented resource-principal pattern passes OCI$RESOURCE_PRINCIPAL as the credential to DBMS_CLOUD.COPY_DATA. This illustrative PL/SQL block uses a CSV-style delimiter format:

BEGIN
  DBMS_CLOUD.COPY_DATA(
    table_name      => 'CHANNELS',
    credential_name => 'OCI$RESOURCE_PRINCIPAL',
    file_uri_list   => 'https://objectstorage.<region>.oraclecloud.com/n/<namespace>/b/<bucket>/o/<file>',
    format          => json_object('delimiter' value ',')
  );
END;
/

Adapt the table name, URI, and format to your schema and file. The example’s delimiter setting is for a comma-separated format; it is not a universal parser configuration. Check Oracle’s COPY_DATA documentation for supported options and the requirements of the target database.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

List bucket objects with LIST_OBJECTS

If you want object metadata rather than table rows, use DBMS_CLOUD.LIST_OBJECTS with the resource-principal credential and a bucket location URI. Conceptually, the call has this form:

SELECT *
FROM DBMS_CLOUD.LIST_OBJECTS(
  'OCI$RESOURCE_PRINCIPAL',
  'https://objectstorage.<region>.oraclecloud.com/n/<namespace>/b/<bucket>/o/'
);

Confirm the exact function signature in the package documentation for your database service and release: DBMS_CLOUD subprograms.

Check service and release compatibility

The step-by-step setup and URI guidance here is based on Oracle’s Autonomous Database documentation. Oracle’s identity material also covers Base Database Service, but the available guidance does not establish that every database service or self-managed Oracle Database release uses identical setup steps, package signatures, or permissions. Before applying the examples elsewhere, check the target service’s documentation and installed DBMS_CLOUD package version.

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Leave a Reply

Your email address will not be published. Required fields are marked *

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

More from the Wire

  1. World desk4 min
    How to Spot an AI Voice Scam Before Sending MoneyDon’t rely on how a caller sounds. Pause, call back through a known number, and verify the emergency with another trusted person before sending money.
  2. Mountain View desk4 min
    Google’s SynthID Detector: How to Check AI-Generated Images, Video and AudioGoogle’s SynthID Detector looks for an embedded watermark in supported images, video and audio. Here is what its results do—and do not—show.
  3. Redmond desk20 min
    How to create a link to File or Folder in Windows 11Windows 11 gives you several ways to point to a file or folder without moving or duplicating it. You can create a desktop shortcut,…
Recommended PC Tool
Recommended PC Tool
Outdated Drivers Are Slowing You DownFree scan - exact matches
PC Slower Than It Used to Be?Free scan - under a minute

Two free Windows tools

One Free Minute Could Fix That PC

Before you go - each of these free tools takes about a minute and tackles what quietly slows a Windows PC down.

Special offer. View Outbyte info, uninstall instructions, EULA, and Privacy Policy.