Autonomous AI Database Serverless
Use this guide to create an Autonomous AI Database Serverless instance and prepare it for vector search with the Oracle VecDB Python SDK. The guide includes the vector user and ORDS setup required by the SDK.
When you finish
You will have an available Autonomous AI Database Serverless instance, a <VECTOR_USER> database user with ORDS enabled, and an embedding model such as all_MiniLM_L12_v2 loaded in the database. Save these four values for the quickstart:
- the
<VECTOR_USER>name and password - the Console URL for the browser-based Vector Database Console
- the SDK REST endpoint for Python requests
The Console URL and SDK REST endpoint use the same host and REST URL mapping but different paths. The quickstart uses the SDK REST endpoint.
Prerequisites
You need an Oracle Cloud account and permission to create an Autonomous AI Database instance. If you do not have that permission, ask an OCI administrator to provision the database and provide the four values listed in When you finish. See Welcome to Oracle Cloud Infrastructure for more information.
1. Create an Autonomous AI Database instance
Follow these steps to provision an Autonomous AI Database instance in the Oracle Cloud Infrastructure Console.
- Open the Oracle Cloud Infrastructure Console by clicking the
next to Cloud. - Choose your region. See Switching Regions for information about working in multiple regions.
- In the navigation menu, click Oracle AI Database, and then click Autonomous AI Database.
- Click Create Autonomous AI Database.
- Provide the basic information for the database:
- Display name: Enter a name that helps you identify the database. The display name does not have to be unique.
- Database name: Enter a name consisting of letters and numbers only. The maximum length is 30 characters. The name must be unique in the tenancy and region.
- Compartment: Select the compartment where you want to create the database.
- Choose a workload type. The available choices include Lakehouse, Transaction Processing, JSON, and APEX.
- Configure the database:
- Select Always Free to show Always Free options. You can create a free instance only in the tenancy’s home region.
- Select Developer for a fixed-shape database intended for development and testing. This option uses 4 ECPUs and 20 GB of storage.
- For Database version, select Oracle AI Database 26ai.
- Create the administrator credentials. The user name is read-only; enter and confirm a password for the administrator user. The password must meet the Oracle Cloud password requirements.
- Choose the network access option:
- Secure access from everywhere
- Secure access from allowed IPs and VCNs only
- Private endpoint access only
- Click Create.
The database is ready when its lifecycle state changes from Provisioning to Available.
2. Create a vector user with SQL
Use the administrator account to create a separate <VECTOR_USER> user for the Python application. This database user owns the vector tables and authenticates requests from the application. Using a separate user limits the privileges used by the application and gives the user a schema in which to create vector tables.
- Open Database Actions for the Autonomous AI Database instance.
- From the Database Actions menu, select SQL to open a SQL Worksheet.
- Run the following statements. Replace
<VECTOR_USER>and<VECTOR_USER_PASSWORD>with values that follow your organization’s naming and password policies.
CREATE USER <VECTOR_USER> IDENTIFIED BY "<VECTOR_USER_PASSWORD>";
GRANT DB_DEVELOPER_ROLE, OML_DEVELOPER TO <VECTOR_USER>;
BEGIN
ORDS_ADMIN.ENABLE_SCHEMA(p_schema => '<VECTOR_USER>');
END;
/
ALTER USER <VECTOR_USER> QUOTA UNLIMITED ON DATA;
BEGIN
DBMS_CLOUD_ADMIN.ENABLE_RESOURCE_PRINCIPAL(
username => '<VECTOR_USER>'
);
END;
/
The DB_DEVELOPER_ROLE and OML_DEVELOPER roles provide the database capabilities used by the SDK. Enabling the schema exposes it through ORDS, and enabling the resource principal allows database operations that use OCI resources, such as Object Storage. Apply the minimum privileges required by your application and security policy.
Record the password you set for <VECTOR_USER>. You will use it to sign in to the Vector Database Console and to configure basic authentication in the Python client.
3. Load an embedding model and get the REST URL
When you opened Database Actions in the previous step, its URL included the ORDS host. It has this form:
https://<host>/ords/admin/_sdw/?nav=worksheet
Copy <host> from that URL. You are still signed in to Database Actions as admin, so sign out before opening the Vector Database Console as <VECTOR_USER>.
Console URL — open in a browser
Request the following URL. Before opening it, update both values:
- Replace
<host>with the ORDS host from the Database Actions URL. - Replace
<vector_user>with the REST URL mapping for the vector user you created. This is thevector_userpart of the URL; it is not necessarily the same as the user name.
Warning: Use the lowercase REST URL mapping in the /ords/<vector_user>/ segment. Do not use the uppercase <VECTOR_USER> database user placeholder in this part of the URL. For example, a database user named VECTOR_USER uses /ords/vector_user/.
https://<host>/ords/<vector_user>/_sdw/?nav=vector-db
Update the vector_user segment to your own REST URL mapping before opening the link. Sign in as <VECTOR_USER> with the password you set in the SQL statement.
The quickstart uses integrated embeddings. Load the all_MiniLM_L12_v2 model for the quickstart. If you load a different model, use its name in the model value in the quickstart.
- In the Vector Database Console, select the Models tab.
- Select the context menu for the model you want to use, and then select Load.
- Confirm the operation and wait for the model status to change to Available.
For more information, see Load a Model Using the Vector Database Console.
SDK REST endpoint — use in Configuration
The Python SDK uses the SDK REST endpoint, not the Console URL. Use the same <host> and REST URL mapping pattern for <VECTOR_USER>:
https://<host>/ords/<vector_user>/_/db-api/stable/vecdb/
Use this REST URL with username="<VECTOR_USER>" and the password you set when you create the user in the Quickstart: Build Vector Search with Python.
Next steps
Continue with Install the SDK in the quickstart. Use the SDK REST endpoint shown in the previous section, <VECTOR_USER>, and the password you created when you configure the client.