๐Ÿ“ž +880 1715-151882 โœ‰๏ธ info@khannasir.com

Oracle Select AI Security: What Leaves Your Database, and How to Lock It Down

Select AI lets a business user type a question in plain English and get back SQL, or an answer, from an Oracle database. The first question a DBA should ask is not "does it work?" It is "what just left the building?"

Most of the setup guides answer the first question very well. They show the profile, the credential and the first SELECT AI that returns a row count.

Very few slow down on the second. That is the gap this article fills.

The short answer: for SQL generation, Oracle sends the LLM provider your schema metadata, meaning table and view names, owners, column names, data types and comments (the last controlled by a profile attribute). Oracle's documentation says that for SQL generation "the database does not provide table or view contents (actual row or column values)".

Row data can leave too, through the narrate action, RAG and synthetic data generation. Your prompt text and, when conversations are on, your recent questions and answers travel with every request.

Every one of those flows has a control. Most of the controls are off, open or generous by default. Below is each one, what it does according to Oracle's own reference, and the setting I would choose before a single business user is given access.

Key Takeaways

  • For SQL generation, Select AI sends metadata, not rows: "the object name, object owner, object columns and comments are sent to the AI provider using HTTPS requests".
  • Oracle's own warning: "Avoid specifying objects with sensitive object name, column names or comments in the object list." Your comments are part of the prompt.
  • enforce_object_list defaults to false, which "allows the LLM to use tables accessible to the user". The object list shapes the prompt; it is not a fence unless you turn enforcement on.
  • The generated SQL "will be run in your database". The database account's privileges are the boundary that holds when everything else fails.
  • DBMS_CLOUD_AI.DISABLE_DATA_ACCESS (administrator only) limits narrate, RAG and synthetic data generation. Sending data is the default.
  • Conversation history is stored in the database: retention defaults to 7 days, and 0 means "until you manually delete it".

1. What Is Oracle Select AI?

Oracle Select AI is a database feature, delivered through the DBMS_CLOUD_AI package, that turns a natural-language question into SQL by sending an "augmented prompt" (your question plus schema metadata) to an LLM provider you choose. It can then run that SQL, explain it, narrate the result or chat.

Oracle's own one-line description is that "Select AI enables SQL access to generative AI using Large Language Models (LLMs) and embedding models". It lives in Autonomous AI Database and Oracle AI Database, and it is called from SQL and PL/SQL or from Python and Java applications.

Everything it does hangs off an AI profile: a named bundle of attributes that says which provider, which credential, which objects and which behaviours. You create it with DBMS_CLOUD_AI.CREATE_PROFILE and choose it for a session with DBMS_CLOUD_AI.SET_PROFILE.

That matters for security, because almost every control in this article is a profile attribute. Reviewing Select AI is mostly reviewing profiles.

2. What Leaves the Database, Action by Action

Select AI is not one data flow. It is several, and they differ by action. Here is what Oracle's documentation says goes into the request for each.

Action or featureWhat is added to your promptThe control
showsql, runsql, explainsqlSchema metadata: names, owners, columns, and comments when enabled. No row values.object_list, enforce_object_list, comments, constraints, annotations
narrateOn Oracle's list of features that send data to the LLM.DISABLE_DATA_ACCESS
RAG (vector store)Content retrieved from the vector store "becomes part of the augmented prompt".DISABLE_DATA_ACCESS, and what you load into the store
Synthetic data generationOn the same data-access list.DISABLE_DATA_ACCESS
chatYour text, as a general request to the model.Who may call the package, and which host
Any action, conversations onRecent prompts and responses "sent to the LLM along with the current prompt".conversation, conversation_length, retention_days

Two things in that table surprise people.

The first is that the safe-sounding row, SQL generation, still sends something. Metadata is not nothing. Section 3 is about that.

The second is that the user's own words always go. If a user pastes a customer's name, a contract value or a patient detail into the question, that text is in the request.

No profile attribute removes it. That is a training and policy point, not a setting.

3. Metadata Is Still Information: Read Your Comments First

Oracle's profile reference is unusually direct here. Under object_list it says: "For translation natural language to SQL, the object name, object owner, object columns and comments are sent to the AI provider using HTTPS requests. Avoid specifying objects with sensitive object name, column names or comments in the object list."

The Select AI profile page lists the same ingredients: "table names, column names, column data types, and comments".

Names and types rarely hurt. Comments are different. Comments are where people write the things they would never put in a column name.

Think about what a comment can hold in a long-lived ERP schema: the reason a column exists, the policy behind a calculation, an internal system name, a vendor name, sometimes an example value copied from a real record. None of that was written with an external AI provider in mind.

So before any object goes into a profile, read the comments that would travel with it. Both views below are standard data dictionary views and are read-only:

-- Table-level comments for the objects you plan to list
SELECT owner, table_name, comments
FROM   all_tab_comments
WHERE  owner = 'SALES_RO'
AND    table_name IN ('V_ORDERS_SUMMARY', 'V_PRODUCTS')
AND    comments IS NOT NULL;

-- Column-level comments: this is where the surprises live
SELECT table_name, column_name, comments
FROM   all_col_comments
WHERE  owner = 'SALES_RO'
AND    table_name IN ('V_ORDERS_SUMMARY', 'V_PRODUCTS')
AND    comments IS NOT NULL
ORDER  BY table_name, column_name;

Read every row. If a comment says more than a stranger should know, you have three choices: rewrite the comment, leave the object out of the list, or switch comments off for that profile.

The three metadata switches

comments "includes table and column comments in the metadata used for translating natural language prompts using AI." Comments often make the generated SQL better, because they explain what a cryptic column means. That is the trade-off: better SQL, more text sent.

constraints "manages whether to include referential integrity constraints such as primary and foreign keys in the metadata sent to the LLM." The default is FALSE.

annotations, the 26ai annotations feature, "augments the user prompt with table-level and column-level annotations in addition to other metadata". The default is FALSE. If your team has started annotating columns for other tools, check what those annotations say before turning this on.

A row of plain pale tags hanging on white strings against a black background, with nothing written on them
For SQL generation the labels travel, not the goods. Make sure the labels say nothing you would not post on a wall. Illustrative photograph. Photo: Ann Hannes / Pexels

4. The Object List, and the Default That Leaves the Gate Open

object_list is an array of owner and object names "eligible for natural language translation to SQL". It accepts tables, views, materialized views, global temporary tables, external tables and synonyms on those. Leave out "name" and every object of that owner is included.

Most people read the object list as an allow-list. It is not one by default.

The companion attribute enforce_object_list "specifies whether to restrict the LLM to generate SQL that uses only tables covered by the object list". Its two values are spelled out in the reference:

  • true: "Enforces the use of only the tables specified in the object list."
  • false: "Allows the LLM to use tables accessible to the user."

And the default value is false.

So with the default, the object list decides which metadata goes into the prompt, while the SQL that comes back may reach for anything the user can already query. For a user who can see the whole schema, that is the whole schema.

Here is a profile written the other way round: two reporting views, enforcement on, constraints and conversations off. The structure follows Oracle's own examples; the names are placeholders.

BEGIN
  DBMS_CLOUD_AI.CREATE_PROFILE(
    profile_name => 'SALES_QA',
    attributes   => '{"provider": "openai",
                      "credential_name": "OPENAI_CRED",
                      "object_list": [{"owner": "SALES_RO", "name": "V_ORDERS_SUMMARY"},
                                      {"owner": "SALES_RO", "name": "V_PRODUCTS"}],
                      "enforce_object_list": true,
                      "comments": true,
                      "constraints": false,
                      "conversation": false}',
    description  => 'Sales questions over two reporting views only');
END;
/

Two honest limits on this.

First, the reference describes enforce_object_list as restricting the LLM. It does not say how the restriction is carried out, so I do not treat it as a security boundary on its own. It narrows what is likely; privileges decide what is possible (section 6).

Second, "AI providers may have limit on the size of metadata allowed in translation requests", in Oracle's words, so a short list is also a practical choice. Oracle itself suggests "limiting the list of objects suitable for the natural language prompts by your application users."

A pale green wooden garden gate standing wide open onto a narrow dirt path under trees
A list of who is invited is not the same as a closed gate. enforce_object_list ships set to false. Illustrative photograph. Photo: Sofia Guzeva / Pexels

5. object_list_mode "automated" and the 19c Rule

object_list_mode decides how much of the list goes out with each question.

With all, which Oracle marks as the default behaviour, "Select AI sends metadata for all objects listed in object_list to the LLM."

With automated, "Select AI sends metadata only for the specific tables or objects identified as most relevant to the query." That sounds like less exposure, and per request it can be. Read the next line, though.

In automated mode the list becomes optional, and "if you do not specify object_list, Select AI evaluates all objects accessible to the AI profile owner and sends metadata only for the relevant objects." It also creates a vector index named <profile_name>_OBJECT_LIST_VECINDEX to do that matching.

So automated mode with no list means every object the profile owner can see is a candidate for the prompt. That is the opposite of what most teams intend. If you use automated mode, keep an explicit list and let automation choose within it.

One version note from the same reference: "object_list is always required in Oracle Database Release 19c for NL2SQL." On 19c you cannot skip the list even if you wanted to.

6. The SQL Runs as the User: Privileges Are the Real Fence

Oracle's Select AI overview contains two sentences every reviewer should read aloud in the design meeting.

The first: "LLMs may have incorporated patterns from invalid or malicious content, including SQL injection." The second: "The queries generated on your behalf by the user-specified LLM provider will be run in your database."

The page goes on to say that use of the feature is "solely at your own risk". That is not a reason to avoid Select AI. It is a clear statement of where the responsibility sits: with the account that runs the query.

Every control in sections 3 to 5 is about what the model is told. This one is about what the database allows. When the model gets something wrong, or a prompt manipulates it, the account's privileges are what stops the damage.

My rule is simple. A Select AI user is a separate database account that owns nothing and can read only purpose-built views, never the base tables and never an application owner schema. I wrote up that design step by step in giving an AI agent safe, read-only access to Oracle: the account, READ rather than SELECT, views, a resource profile and auditing.

Do not lend Select AI the application's own login because it is convenient. Whatever that login can update, a generated statement can attempt to update.

showsql before runsql

For people who are still learning to trust it, start with the action that does not execute anything. DBMS_CLOUD_AI.GENERATE returns SQL without running it when the action is showsql.

Always name the action. The same reference page calls showsql the default in one paragraph and lists runsql (default) in another, so do not rely on either.

SELECT DBMS_CLOUD_AI.GENERATE(
         prompt       => 'total order value by month for this year',
         profile_name => 'SALES_QA',
         action       => 'showsql')
FROM   dual;

Reading generated SQL for a week tells you more about the model, and about your metadata, than any demo. It is also how you spot the comment that confused it.

7. The Data Switch: DISABLE_DATA_ACCESS

Some Select AI features send real data to the provider by design. Oracle groups them under one switch.

DBMS_CLOUD_AI.ENABLE_DATA_ACCESS "enables sending data to LLM for applicable Select AI features, which is the default behavior." DBMS_CLOUD_AI.DISABLE_DATA_ACCESS "disables sending data to LLM for applicable Select AI features." The capabilities it limits are listed by name:

  • the narrate action
  • Retrieval Augmented Generation (RAG)
  • Synthetic Data Generation

Both procedures take no parameters, and "only an administrator can run this procedure."

BEGIN
  DBMS_CLOUD_AI.DISABLE_DATA_ACCESS();
END;
/

Be precise about what this does not cover. The SQL-generation actions are not on Oracle's list, because they were never meant to send row values.

Their metadata, and the user's own prompt text, still go. DISABLE_DATA_ACCESS is a data switch, not an off switch.

My default for a first rollout is to run it, then turn data access back on only for a named use case with an owner who has read what narrate would send. Sending data is the default, so this is a decision someone has to make on purpose.

8. Who May Call It at All: EXECUTE on DBMS_CLOUD_AI

The first gate is the package itself. Oracle's setup page says: "By default, only the system administrator has EXECUTE privilege. The administrator can grant EXECUTE privilege to other users."

GRANT EXECUTE ON DBMS_CLOUD_AI TO SALES_QA_USER;

RAG needs EXECUTE on DBMS_CLOUD_PIPELINE as well, and the same page notes that a user with the DWROLE role already has it. That second point is easy to miss: if your users carry DWROLE for other reasons, check what it brings with it.

Oracle gives the query to see who holds the two packages. Run it per user you are reviewing:

SELECT table_name AS package_name, privilege
FROM   dba_tab_privs
WHERE  grantee = 'SALES_QA_USER'
AND   (table_name = 'DBMS_CLOUD_PIPELINE'
       OR table_name = 'DBMS_CLOUD_AI');

Grant to a role used only for Select AI, or to named accounts. Never to PUBLIC. A grant you can list in one query is a grant you can review every quarter.

9. Which Host It May Call: the Network ACL

For an external provider, the database account also needs permission to reach that provider's host. Oracle's example grants one user HTTP access to one host:

BEGIN
  DBMS_NETWORK_ACL_ADMIN.APPEND_HOST_ACE(
    host => 'api.openai.com',
    ace  => xs$ace_type(privilege_list => xs$name_list('http'),
                        principal_name => 'SALES_QA_USER',
                        principal_type => xs_acl.ptype_db));
END;
/

Two details from the same page matter for security.

First, the host "can be the name or the IP address of the host. You can use a wildcard to specify a domain or an IP subnet." A wildcard is convenient and it widens what the account may call. Name the exact host Oracle lists for your provider, such as api.openai.com, api.anthropic.com or api.cohere.ai.

Second, "Network ACL privileges are not required for OCI Generative AI." With OCI Generative AI, this gate does not exist, so the other gates carry more weight.

An ACL is also a quiet inventory. A list of hosts each database account may reach is the answer to the auditor's question, "where can this database send data?"

A row of old metal skeleton keys hanging from hooks on a dark wall, softly lit
Three separate keys: the package grant, the network ACL and the provider credential. Each one can be handed out on its own. Illustrative photograph. Photo: Ron Lach / Pexels

10. The API Key: Credentials, Vault and GET_DEFINITION

The provider's API key lives in a database credential, created with DBMS_CLOUD.CREATE_CREDENTIAL, and the profile refers to it by name through credential_name.

BEGIN
  DBMS_CLOUD.CREATE_CREDENTIAL(
    credential_name => 'OPENAI_CRED',
    username        => 'OPENAI',
    password        => '<your_api_token>');
END;
/

The reference adds that "credential using bearer tokens can be created by using the provider name as the user name and bearer token as the password", and that "Vault Secret credentials are also supported." If your organisation already keeps secrets in OCI Vault, use that route rather than pasting a key into a script.

That script is the real risk. A key typed into a worksheet ends up in shell history, a ticket or a version-controlled setup file. Create the credential once, interactively, and keep the key out of anything that is saved.

There is one reassuring detail for reviewers. DBMS_CLOUD_AI.GET_DEFINITION, which exports a profile so it can be recreated, "can include public credential names required for recreation, but it does not expose credential secret values, passwords, tokens, private keys, wallet contents, authentication headers, or resolved secret material." A profile definition can go into a change ticket. The key cannot.

To review the profiles themselves, the dictionary has them. USER_CLOUD_AI_PROFILE_ATTRIBUTES shows your own; the DBA_ versions show all of them, and "only the database administrator is privileged to access this view":

SELECT owner, profile_name, attribute_name, attribute_value
FROM   dba_cloud_ai_profile_attributes
WHERE  attribute_name IN ('provider', 'credential_name', 'region',
                          'object_list', 'enforce_object_list',
                          'object_list_mode', 'comments', 'conversation')
ORDER  BY owner, profile_name, attribute_name;

That one query is most of a Select AI security review. It shows, per profile, where requests go, which key they use, what may be described and whether conversations are kept.

Read the gaps as well as the rows. Oracle's sample output lists only the attributes that were set, so an attribute you never set may simply be missing. A profile with no enforce_object_list row should be read as running on the default, false, until you prove otherwise.

11. Conversation History: a New Place for Sensitive Text

Conversations let a user ask a follow-up ("and last year?") without repeating the context. The profile attribute conversation "indicates if conversation history is enabled for a profile", and its default value is false.

When it is on, two things change.

More text goes to the provider. conversation_length is the "number of recent prompts and responses from the conversation that are sent to the LLM along with the current prompt".

If nobody sets it, Oracle documents a default of 10. Every question can carry ten earlier exchanges with it.

Text is stored in the database. USER_CLOUD_AI_CONVERSATION_PROMPTS holds, per prompt, the PROMPT ("a user-provided natural language input"), the PROMPT_RESPONSE ("the LLM's response generated for the user prompt"), the action, timestamps and the client identifier of the session.

How long it stays is retention_days. "If you omit the value, the systems sets it to default value of 7. If you set it to 0, the system retains the conversation until you manually delete it."

SELECT conversation_id, conversation_title, created,
       retention_days, conversation_length
FROM   user_cloud_ai_conversations
ORDER  BY created DESC;

One more point decides who can review this. These views show each user only "the conversations they own. You cannot grant access to other users. The Database Administrator can access these views but sees only the objects they own."

So users' question history is private to each user, which is good for privacy and awkward for an investigation. Decide the retention period with whoever owns your data-retention policy, set it deliberately, and never leave 0 in place by accident. A forgotten 0 means keep forever.

A long, empty archive aisle lined on both sides with rows of pale wooden card drawers
Conversation history is an archive nobody planned. Give it a retention period on purpose. Illustrative photograph. Photo: Tima Miroshnichenko / Pexels

12. Choosing Where the Prompt Goes

Oracle's own advice on the provider is one line: "Choose an AI provider and LLM that meets your security standards and aligns with your specific needs." The profile's provider attribute is that choice, and it is the biggest single decision in this article.

The options in the reference include OCI Generative AI, OpenAI, Azure OpenAI Service, Cohere, Google, Anthropic, Hugging Face and AWS. For OCI Generative AI the region attribute names where the service runs, and Oracle documents us-chicago-1 as the default region.

That default is worth a look if your organisation has rules about where data is processed. Set the region you mean, rather than inheriting one.

There is also provider_endpoint. If you set it without provider, "Select AI treats the endpoint as OpenAI-compatible".

That is how a profile can point at an OpenAI-compatible service your own team operates, so the augmented prompt goes to infrastructure you control. I covered why some organisations choose that path in running a private LLM on-premise.

What Oracle's documentation cannot tell you is what the provider does with the request after it arrives: how long it is logged, who can read it, whether it is used for training. That lives in your contract and the provider's own terms. Read them before go-live, not after.

13. What None of These Settings Protect You From

A checklist can make a system look safer than it is. These are the gaps that remain after every setting above is right.

  • Wrong answers. Correct-looking SQL can still answer a different question from the one the user asked. Oracle warns the LLM "can generate incorrect and false information including SQL queries that produce inaccurate results". Numbers that go into decisions need a human check.
  • Prompt injection through your own data. With RAG, retrieved content becomes part of the prompt. A document that contains instructions can steer the model. My guide to prompt injection explains why filters alone do not solve this.
  • Over-broad retrieval. A vector store holds whatever was loaded into it. If it was loaded without permission tags, every user retrieves from all of it. See permission-aware RAG for the deny test that proves otherwise.
  • The user's own words. Nothing here stops a person from typing something confidential into a question. That is policy and training.
  • The provider side. Once a request leaves over HTTPS, its handling is governed by the provider's terms, not by the database.

14. The Checklist

Run this before a profile goes live, and again whenever someone edits one.

  1. Read every table and column comment of every object in the list (ALL_TAB_COMMENTS, ALL_COL_COMMENTS). Fix or exclude anything sensitive.
  2. Keep an explicit object_list of purpose-built views, not whole schemas.
  3. Set enforce_object_list to true deliberately. The default is false.
  4. If you use object_list_mode automated, still give it a list.
  5. Decide comments, constraints and annotations per profile, knowing each one adds text to the prompt.
  6. Run Select AI as a separate, read-only account with access only to those views.
  7. Start users on showsql; move to runsql once the SQL has been read for a while.
  8. Run DBMS_CLOUD_AI.DISABLE_DATA_ACCESS unless a named use case needs narrate, RAG or synthetic data.
  9. Grant EXECUTE on DBMS_CLOUD_AI to a dedicated role or named users, never PUBLIC. Check what DWROLE brings.
  10. Grant the network ACL for the exact provider host, per account, without wildcards.
  11. Keep the API key in a credential or Vault secret, created interactively and never saved in a script.
  12. Leave conversation off unless it is needed; when on, set retention_days and conversation_length on purpose, and never leave 0 by accident.
  13. Set the provider and region you intend, and read the provider's data-handling terms.
  14. Review DBA_CLOUD_AI_PROFILE_ATTRIBUTES on a schedule, the same way you review grants.

None of this needs a new product. It needs someone to read the defaults before the first business user does.

Frequently Asked Questions

Does Oracle Select AI send my table data to the LLM?

For SQL generation (showsql, runsql, explainsql), Oracle's documentation says the database augments the prompt with schema metadata only and "does not provide table or view contents (actual row or column values)". The narrate action, RAG and synthetic data generation can send data, and Oracle groups those three under DBMS_CLOUD_AI.DISABLE_DATA_ACCESS.

What exactly is in the metadata Select AI sends?

Oracle lists "the object name, object owner, object columns and comments", and its profile page adds column data types. Referential constraints and 26ai annotations are added only if you switch on the constraints or annotations attribute, both FALSE by default. Oracle itself advises you to avoid objects with sensitive names, column names or comments.

Does the object list stop Select AI from querying other tables?

Not by default. enforce_object_list defaults to false, which "allows the LLM to use tables accessible to the user". Set it to true to restrict generated SQL to the listed objects, and still rely on the database account's privileges as the hard limit.

Who can turn off data sending for narrate and RAG?

Only an administrator. DBMS_CLOUD_AI.DISABLE_DATA_ACCESS takes no parameters and limits the narrate action, RAG and synthetic data generation. ENABLE_DATA_ACCESS reverses it, and sending data is the default behaviour.

Where is Select AI conversation history stored, and for how long?

In the database, in views such as USER_CLOUD_AI_CONVERSATIONS and USER_CLOUD_AI_CONVERSATION_PROMPTS, which hold the prompt and the LLM's response. retention_days defaults to 7 when omitted, and 0 keeps a conversation until it is deleted manually. Each user sees only their own conversations, and access cannot be granted to others.

Do I need a network ACL for Select AI?

For external providers, yes: the administrator grants the account HTTP access to the provider's host with DBMS_NETWORK_ACL_ADMIN.APPEND_HOST_ACE. Oracle notes that network ACL privileges are not required for OCI Generative AI.

Is the API key visible if I export a Select AI profile?

No. Oracle documents that GET_DEFINITION output can include the credential's name but "does not expose credential secret values, passwords, tokens, private keys, wallet contents, authentication headers, or resolved secret material." The key stays in the credential object.

Does Select AI work on Oracle 19c?

Oracle documents Select AI for Autonomous AI Database and Oracle AI Database, and publishes a capability matrix of what is available on each release; check it for your exact version. One 19c difference is explicit in the profile reference: on Oracle Database Release 19c, object_list is always required for natural-language-to-SQL.

๐Ÿ” Is Select AI already switched on somewhere in your estate?

I review every AI profile, grant and network ACL against the defaults in this article, read the comments your profiles would send, and hand your team a short list of what to change and a query to keep checking it.

๐Ÿ“ฉ Book a Select AI Security Review
Nasir Uddin Khan โ€” Oracle DBA Consultant

Nasir Uddin Khan

Nasir is an Oracle Certified Professional and CSV-certified IT consultant based in Dhaka, Bangladesh. He has 18+ years of hands-on experience in Oracle database administration (RAC, Data Guard, RMAN), WebLogic middleware, ERP system design, and AI integration for manufacturing, pharmaceutical, banking, and healthcare organisations worldwide.

References & Further Reading

The Oracle pages above were saved live on 2 December 2026 and describe Select AI in Autonomous AI Database and Oracle AI Database. Attributes, defaults and views differ between releases: check the documentation for your exact version before making a production change.

Profile, user and object names in the examples (SALES_QA, SALES_QA_USER, SALES_RO) are placeholders. The two comment queries and the two profile-attribute queries are read-only.

Related Articles

Turn On Select AI Without Sending More Than You Meant To

AI profile review ยท object list and comment audit ยท grants and network ACLs ยท conversation retention. 18+ years of Oracle experience. Bangladesh and worldwide.

๐Ÿ’ฌ