Skip to content

Commit f1c6ad5

Browse files
authored
Update doco for user creation (#303)
1 parent c1d72dd commit f1c6ad5

File tree

1 file changed

+26
-5
lines changed

1 file changed

+26
-5
lines changed

docs/content/client/configuration/db_config.md

Lines changed: 26 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -89,12 +89,34 @@ podman run -v $TNS_ADMIN$:/app/tns_admin -p 8501:8501 -it --rm ai-optimizer-aio
8989

9090
## Database User
9191

92-
A database user is required to store the embeddings, used for **RAG**, into the Oracle Database. A non-privileged user with a *non-SYSTEM tablespace* should be used for this purpose. Use the below syntax as an __example__ of creating a new user with least privileges:
92+
A database user is required to store the embeddings, used for **RAG**, into the Oracle Database. A non-privileged user with a *non-SYSTEM tablespace* should be used for this purpose. Use the below syntax as an __example__ of creating a new user with least privileges (change the value of `c_user_password`):
9393

9494
```sql
95-
CREATE USER "DEMO" IDENTIFIED BY MYCOMPLEXSECRET
96-
DEFAULT TABLESPACE "DATA"
97-
TEMPORARY TABLESPACE "TEMP";
95+
DECLARE
96+
c_user_password dba_users.password%TYPE := 'MYSUPERSECRET';
97+
v_default_perm database_properties.property_value%TYPE;
98+
v_default_temp database_properties.property_value%TYPE;
99+
v_sql VARCHAR2(500);
100+
BEGIN
101+
-- Get default permanent tablespace
102+
SELECT property_value
103+
INTO v_default_perm
104+
FROM database_properties
105+
WHERE property_name = 'DEFAULT_PERMANENT_TABLESPACE';
106+
107+
-- Get default temporary tablespace
108+
SELECT property_value
109+
INTO v_default_temp
110+
FROM database_properties
111+
WHERE property_name = 'DEFAULT_TEMP_TABLESPACE';
112+
113+
-- Build dynamic CREATE USER statement
114+
v_sql := 'CREATE USER demo IDENTIFIED BY "' || c_user_password || '" ' ||
115+
'DEFAULT TABLESPACE ' || v_default_perm || ' ' ||
116+
'TEMPORARY TABLESPACE ' || v_default_temp;
117+
EXECUTE IMMEDIATE v_sql;
118+
END;
119+
/
98120
GRANT "DB_DEVELOPER_ROLE" TO "DEMO";
99121
ALTER USER "DEMO" DEFAULT ROLE ALL;
100122
ALTER USER "DEMO" QUOTA UNLIMITED ON DATA;
@@ -103,7 +125,6 @@ ALTER USER "DEMO" QUOTA UNLIMITED ON DATA;
103125
If running on a supported database for [SelectAI](https://docs.oracle.com/en-us/iaas/autonomous-database-serverless/doc/select-ai.html) and want to use the feature, grant the following additional privileges and open appropriate ACLs:
104126

105127
```sql
106-
GRANT EXECUTE ON DBMS_CLOUD TO DEMO;
107128
GRANT EXECUTE ON DBMS_CLOUD_AI TO DEMO;
108129
GRANT EXECUTE ON DBMS_CLOUD_PIPELINE TO DEMO;
109130
```

0 commit comments

Comments
 (0)