Wednesday, 10 June 2026

oracle database 26ai commands

Question : How to create user and grant necessary privilege


 To create a user in Oracle AI Database 26ai, you must first switch from the Container Database (CDB) root to a Pluggable Database (PDB). Standard practice restricts direct local user creation in the CDB root to prevent ORA-65096 errors. 

Step-by-Step SQL Execution
1. Connect to the Database
Open terminal or command prompt, start SQL*Plus, and log in as an administrator: 
sql
sqlplus / as sysdba
2. Switch to Your Pluggable Database (PDB) 
Identify your available PDBs using SHOW PDBS; and point your session to your target PDB (e.g., FREEPDB1 for the free edition): 
sql
ALTER SESSION SET CONTAINER = FREEPDB1;
3. Execute the CREATE USER Command 
Run the standard syntax to create your local user: 
sql
CREATE USER application_user IDENTIFIED BY StrongPassword26ai 
DEFAULT TABLESPACE users 
QUOTA UNLIMITED ON users;
4. Grant Essential Privileges
A newly created user has an empty privilege domain and cannot log in. You must grant connection and development roles: 
sql
GRANT CREATE SESSION, DB_DEVELOPER_ROLE TO application_user;
(Note: Oracle 26ai highly optimizes database provisioning through the comprehensive DB_DEVELOPER_ROLE.) 

Alternative: Create a Read-Only User 
Oracle 26ai provides a dedicated feature allowing you to define a user as read-only right at the moment of creation. This is perfect for reporting tools or data analysts: 
sql
CREATE USER analytical_user IDENTIFIED BY ReadOnlyPassword26ai READ ONLY;
GRANT CREATE SESSION TO analytical_user;
UIf you ever need to change this user to read-write capabilities down the line, execute: 
sql
ALTER USER analytical_user READ WRITE;


=======================

CREATE USER C##rag_user IDENTIFIED BY "SecurePassword2026#"; GRANT CONNECT, RESOURCE, DB_DEVELOPER_ROLE TO C##rag_user; ALTER USER C##rag_user QUOTA UNLIMITED ON USERS; CONNECT C##rag_user/SecurePassword2026#;



Question : ORA-51962: The vector memory area is out of space for the current container.



This error occurs when your Oracle Database lacks the memory allocation required
to process or store new vector data in the current container.
To fix this, either drop unused vector memory objects or
increase the VECTOR_MEMORY_SIZE initialization parameter.
The Solution: Increase Vector Memory Size
  1. Connect to your database (e.g., as SYSDBA in CDB$ROOT).
  2. Set a new parameter size for the Vector Memory Area using the following SQL statement (adjust the 512M to your available system RAM):
    sql
    ALTER SYSTEM SET VECTOR_MEMORY_SIZE = 512M SCOPE = SPFILE;
    
    Restart the database for the changes to apply:
  3. sql
    SHUTDOWN IMMEDIATE;
    STARTUP;

Basic Command

SELECT banner_full FROM v$version; SELECT sys_context('USERENV', 'CON_NAME') AS current_container FROM dual; CREATE TABLE local_ai_test1 (id NUMBER PRIMARY KEY,embedding VECTOR(3, FLOAT32)) INSERT INTO local_ai_test1 VALUES (1, '[0.12, -0.43, 0.89]'); SELECT * FROM local_ai_test;

No comments:

Post a Comment