Skip to content

Commit 2e82ede

Browse files
DK09876claude
andauthored
docs(oracle): document the required schema, dimension matching, and start-oracle re-run (#2615)
Verifying the Oracle guide end-to-end surfaced three setup steps that weren't documented and that block a first-time deployment: - HINDSIGHT_API_DATABASE_SCHEMA must be set to the Oracle schema user. The default `public` is a PostgreSQL notion and makes migrations fail with ORA-01435. Added it to the configure step (with a warning), the quick start, the config reference table, and troubleshooting. - Migrations must run with the same embedding dimension as the serving model, or retain fails with ORA-51803. Added a warning to the migrate step and a troubleshooting row (including the --embedding-dimension resize path). - The dev quick-start container can report a provisioning error on a cold start's first run; noted that re-running the idempotent script succeeds. Mirrored into versioned_docs/version-0.8 and regenerated the docs skill. Claude-Session: https://claude.ai/code/session_01PginSDrapXsoDd6gN5Pszo Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
1 parent 0338ab4 commit 2e82ede

3 files changed

Lines changed: 126 additions & 18 deletions

File tree

hindsight-docs/docs/developer/oracle.md

Lines changed: 42 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -70,10 +70,20 @@ connection URL:
7070
./scripts/dev/stop-oracle.sh
7171
```
7272

73-
A cold start takes 60–120s while the database initializes. Once the script
74-
prints the connection URL, export the two variables it shows, run migrations,
75-
and start the API (see the steps below). This is the same setup Hindsight's CI
76-
uses to test the Oracle backend.
73+
A cold start takes 60–120s while the database initializes. If the first run
74+
reports a provisioning error, the database was still starting up — just re-run
75+
`./scripts/dev/start-oracle.sh` once the container is healthy (it is idempotent).
76+
77+
Once the script prints the connection URL, export the variables it shows, and
78+
**also set the schema** to the Oracle user it created:
79+
80+
```bash
81+
export HINDSIGHT_API_DATABASE_SCHEMA=HINDSIGHT_TEST
82+
```
83+
84+
Then run migrations and start the API (see the steps below). Setting the schema
85+
is required on Oracle — see [step 3](#3-configure-hindsight). This is the same
86+
setup Hindsight's CI uses to test the Oracle backend.
7787

7888
## Production setup
7989

@@ -152,11 +162,23 @@ Point Hindsight at Oracle with two environment variables:
152162
```bash
153163
export HINDSIGHT_API_DATABASE_BACKEND=oracle
154164
export HINDSIGHT_API_DATABASE_URL='oracle+oracledb://hindsight:s3cret@db.internal:1521/ORCLPDB1'
165+
export HINDSIGHT_API_DATABASE_SCHEMA=HINDSIGHT # the Oracle user from step 1
155166
```
156167

157168
`HINDSIGHT_API_DATABASE_BACKEND` defaults to `postgresql`; set it to `oracle` to
158-
select the Oracle backend. See [Configuration → Database](./configuration#database)
159-
for the full list of database variables.
169+
select the Oracle backend.
170+
171+
:::warning Set `DATABASE_SCHEMA` to your Oracle user
172+
`HINDSIGHT_API_DATABASE_SCHEMA` defaults to `public` — a PostgreSQL concept. On
173+
Oracle a schema **is a user**, there is no `public` schema, and leaving the
174+
default makes migrations fail with `ORA-01435: user does not exist`. Set it to
175+
the schema user you created in step 1, spelled exactly as Oracle stores it —
176+
**uppercase** (e.g. `HINDSIGHT`) unless you created the user with a quoted
177+
lower-case name.
178+
:::
179+
180+
See [Configuration → Database](./configuration#database) for the full list of
181+
database variables.
160182

161183
### 4. Run migrations
162184

@@ -173,6 +195,17 @@ This routes through the dialect-aware migration runner and creates the Oracle
173195
schema. (Unlike the admin CLI's data-movement commands, `run-db-migration`
174196
is fully supported on Oracle — see [Limitations](#limitations-vs-postgresql).)
175197

198+
:::warning Migrate with your runtime embedding dimension
199+
The embedding `VECTOR` columns are sized to the dimension of the configured
200+
embeddings model. Run migrations with the **same embeddings provider/model you
201+
will serve with** — otherwise the column dimension won't match the vectors the
202+
API produces and retain fails with `ORA-51803: Vector dimension count must
203+
match…` (for example, a schema built for a 384-dim local model rejects the
204+
1536-dim vectors from OpenAI `text-embedding-3-small`). If you change the
205+
embeddings model later, re-run migrations with `--embedding-dimension <N>` to
206+
resize the columns.
207+
:::
208+
176209
### 5. Start the API
177210

178211
```bash
@@ -191,6 +224,7 @@ Oracle-relevant settings, all documented in full on the
191224
|----------|---------|
192225
| `HINDSIGHT_API_DATABASE_BACKEND` | `postgresql` (default) or `oracle`. |
193226
| `HINDSIGHT_API_DATABASE_URL` | `oracle+oracledb://…` connection URL. |
227+
| `HINDSIGHT_API_DATABASE_SCHEMA` | Schema/user for the tables. On Oracle set this to your schema user (uppercase); the `public` default fails. |
194228
| `HINDSIGHT_API_RUN_MIGRATIONS_ON_STARTUP` | Auto-apply migrations when the API boots (default `true`). |
195229

196230
## Limitations vs PostgreSQL
@@ -218,6 +252,8 @@ internal details differ:
218252
| Symptom | Cause / Fix |
219253
|---------|-------------|
220254
| `python-oracledb is required for Oracle backend` | The driver isn't installed. Run `pip install oracledb` (or install the `[oracle]` extra). |
255+
| `ORA-01435: user does not exist` on migration | `HINDSIGHT_API_DATABASE_SCHEMA` is unset (defaults to `public`) or misspelled. Set it to your Oracle schema user, uppercase (e.g. `HINDSIGHT`). |
256+
| `ORA-51803: Vector dimension count must match` on retain | The schema was migrated with a different embedding dimension than the running embeddings model. Migrate with the same embeddings config, or re-run `run-db-migration --embedding-dimension <N>`. |
221257
| Migration errors when creating embedding/`VECTOR` columns | The schema user's default tablespace is not ASSM (often the `SYSTEM` tablespace). Recreate the user in an ASSM tablespace as shown above. |
222258
| Full-text search errors / missing Oracle Text index | The schema user is missing the `CTXAPP` role. Run `GRANT CTXAPP TO <user>;`. |
223259
| `ORA-12514` / service not found | The URL uses a SID or wrong service name. Use the pluggable database **service name** (e.g. `FREEPDB1`), not the SID. |

hindsight-docs/versioned_docs/version-0.8/developer/oracle.md

Lines changed: 42 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -70,10 +70,20 @@ connection URL:
7070
./scripts/dev/stop-oracle.sh
7171
```
7272

73-
A cold start takes 60–120s while the database initializes. Once the script
74-
prints the connection URL, export the two variables it shows, run migrations,
75-
and start the API (see the steps below). This is the same setup Hindsight's CI
76-
uses to test the Oracle backend.
73+
A cold start takes 60–120s while the database initializes. If the first run
74+
reports a provisioning error, the database was still starting up — just re-run
75+
`./scripts/dev/start-oracle.sh` once the container is healthy (it is idempotent).
76+
77+
Once the script prints the connection URL, export the variables it shows, and
78+
**also set the schema** to the Oracle user it created:
79+
80+
```bash
81+
export HINDSIGHT_API_DATABASE_SCHEMA=HINDSIGHT_TEST
82+
```
83+
84+
Then run migrations and start the API (see the steps below). Setting the schema
85+
is required on Oracle — see [step 3](#3-configure-hindsight). This is the same
86+
setup Hindsight's CI uses to test the Oracle backend.
7787

7888
## Production setup
7989

@@ -152,11 +162,23 @@ Point Hindsight at Oracle with two environment variables:
152162
```bash
153163
export HINDSIGHT_API_DATABASE_BACKEND=oracle
154164
export HINDSIGHT_API_DATABASE_URL='oracle+oracledb://hindsight:s3cret@db.internal:1521/ORCLPDB1'
165+
export HINDSIGHT_API_DATABASE_SCHEMA=HINDSIGHT # the Oracle user from step 1
155166
```
156167

157168
`HINDSIGHT_API_DATABASE_BACKEND` defaults to `postgresql`; set it to `oracle` to
158-
select the Oracle backend. See [Configuration → Database](./configuration#database)
159-
for the full list of database variables.
169+
select the Oracle backend.
170+
171+
:::warning Set `DATABASE_SCHEMA` to your Oracle user
172+
`HINDSIGHT_API_DATABASE_SCHEMA` defaults to `public` — a PostgreSQL concept. On
173+
Oracle a schema **is a user**, there is no `public` schema, and leaving the
174+
default makes migrations fail with `ORA-01435: user does not exist`. Set it to
175+
the schema user you created in step 1, spelled exactly as Oracle stores it —
176+
**uppercase** (e.g. `HINDSIGHT`) unless you created the user with a quoted
177+
lower-case name.
178+
:::
179+
180+
See [Configuration → Database](./configuration#database) for the full list of
181+
database variables.
160182

161183
### 4. Run migrations
162184

@@ -173,6 +195,17 @@ This routes through the dialect-aware migration runner and creates the Oracle
173195
schema. (Unlike the admin CLI's data-movement commands, `run-db-migration`
174196
is fully supported on Oracle — see [Limitations](#limitations-vs-postgresql).)
175197

198+
:::warning Migrate with your runtime embedding dimension
199+
The embedding `VECTOR` columns are sized to the dimension of the configured
200+
embeddings model. Run migrations with the **same embeddings provider/model you
201+
will serve with** — otherwise the column dimension won't match the vectors the
202+
API produces and retain fails with `ORA-51803: Vector dimension count must
203+
match…` (for example, a schema built for a 384-dim local model rejects the
204+
1536-dim vectors from OpenAI `text-embedding-3-small`). If you change the
205+
embeddings model later, re-run migrations with `--embedding-dimension <N>` to
206+
resize the columns.
207+
:::
208+
176209
### 5. Start the API
177210

178211
```bash
@@ -191,6 +224,7 @@ Oracle-relevant settings, all documented in full on the
191224
|----------|---------|
192225
| `HINDSIGHT_API_DATABASE_BACKEND` | `postgresql` (default) or `oracle`. |
193226
| `HINDSIGHT_API_DATABASE_URL` | `oracle+oracledb://…` connection URL. |
227+
| `HINDSIGHT_API_DATABASE_SCHEMA` | Schema/user for the tables. On Oracle set this to your schema user (uppercase); the `public` default fails. |
194228
| `HINDSIGHT_API_RUN_MIGRATIONS_ON_STARTUP` | Auto-apply migrations when the API boots (default `true`). |
195229

196230
## Limitations vs PostgreSQL
@@ -218,6 +252,8 @@ internal details differ:
218252
| Symptom | Cause / Fix |
219253
|---------|-------------|
220254
| `python-oracledb is required for Oracle backend` | The driver isn't installed. Run `pip install oracledb` (or install the `[oracle]` extra). |
255+
| `ORA-01435: user does not exist` on migration | `HINDSIGHT_API_DATABASE_SCHEMA` is unset (defaults to `public`) or misspelled. Set it to your Oracle schema user, uppercase (e.g. `HINDSIGHT`). |
256+
| `ORA-51803: Vector dimension count must match` on retain | The schema was migrated with a different embedding dimension than the running embeddings model. Migrate with the same embeddings config, or re-run `run-db-migration --embedding-dimension <N>`. |
221257
| Migration errors when creating embedding/`VECTOR` columns | The schema user's default tablespace is not ASSM (often the `SYSTEM` tablespace). Recreate the user in an ASSM tablespace as shown above. |
222258
| Full-text search errors / missing Oracle Text index | The schema user is missing the `CTXAPP` role. Run `GRANT CTXAPP TO <user>;`. |
223259
| `ORA-12514` / service not found | The URL uses a SID or wrong service name. Use the pluggable database **service name** (e.g. `FREEPDB1`), not the SID. |

skills/hindsight-docs/references/developer/oracle.md

Lines changed: 42 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -70,10 +70,20 @@ connection URL:
7070
./scripts/dev/stop-oracle.sh
7171
```
7272

73-
A cold start takes 60–120s while the database initializes. Once the script
74-
prints the connection URL, export the two variables it shows, run migrations,
75-
and start the API (see the steps below). This is the same setup Hindsight's CI
76-
uses to test the Oracle backend.
73+
A cold start takes 60–120s while the database initializes. If the first run
74+
reports a provisioning error, the database was still starting up — just re-run
75+
`./scripts/dev/start-oracle.sh` once the container is healthy (it is idempotent).
76+
77+
Once the script prints the connection URL, export the variables it shows, and
78+
**also set the schema** to the Oracle user it created:
79+
80+
```bash
81+
export HINDSIGHT_API_DATABASE_SCHEMA=HINDSIGHT_TEST
82+
```
83+
84+
Then run migrations and start the API (see the steps below). Setting the schema
85+
is required on Oracle — see [step 3](#3-configure-hindsight). This is the same
86+
setup Hindsight's CI uses to test the Oracle backend.
7787

7888
## Production setup
7989

@@ -152,11 +162,23 @@ Point Hindsight at Oracle with two environment variables:
152162
```bash
153163
export HINDSIGHT_API_DATABASE_BACKEND=oracle
154164
export HINDSIGHT_API_DATABASE_URL='oracle+oracledb://hindsight:s3cret@db.internal:1521/ORCLPDB1'
165+
export HINDSIGHT_API_DATABASE_SCHEMA=HINDSIGHT # the Oracle user from step 1
155166
```
156167

157168
`HINDSIGHT_API_DATABASE_BACKEND` defaults to `postgresql`; set it to `oracle` to
158-
select the Oracle backend. See [Configuration → Database](./configuration#database)
159-
for the full list of database variables.
169+
select the Oracle backend.
170+
171+
:::warning Set `DATABASE_SCHEMA` to your Oracle user
172+
`HINDSIGHT_API_DATABASE_SCHEMA` defaults to `public` — a PostgreSQL concept. On
173+
Oracle a schema **is a user**, there is no `public` schema, and leaving the
174+
default makes migrations fail with `ORA-01435: user does not exist`. Set it to
175+
the schema user you created in step 1, spelled exactly as Oracle stores it —
176+
**uppercase** (e.g. `HINDSIGHT`) unless you created the user with a quoted
177+
lower-case name.
178+
:::
179+
180+
See [Configuration → Database](./configuration#database) for the full list of
181+
database variables.
160182

161183
### 4. Run migrations
162184

@@ -173,6 +195,17 @@ This routes through the dialect-aware migration runner and creates the Oracle
173195
schema. (Unlike the admin CLI's data-movement commands, `run-db-migration`
174196
is fully supported on Oracle — see [Limitations](#limitations-vs-postgresql).)
175197

198+
:::warning Migrate with your runtime embedding dimension
199+
The embedding `VECTOR` columns are sized to the dimension of the configured
200+
embeddings model. Run migrations with the **same embeddings provider/model you
201+
will serve with** — otherwise the column dimension won't match the vectors the
202+
API produces and retain fails with `ORA-51803: Vector dimension count must
203+
match…` (for example, a schema built for a 384-dim local model rejects the
204+
1536-dim vectors from OpenAI `text-embedding-3-small`). If you change the
205+
embeddings model later, re-run migrations with `--embedding-dimension <N>` to
206+
resize the columns.
207+
:::
208+
176209
### 5. Start the API
177210

178211
```bash
@@ -191,6 +224,7 @@ Oracle-relevant settings, all documented in full on the
191224
|----------|---------|
192225
| `HINDSIGHT_API_DATABASE_BACKEND` | `postgresql` (default) or `oracle`. |
193226
| `HINDSIGHT_API_DATABASE_URL` | `oracle+oracledb://…` connection URL. |
227+
| `HINDSIGHT_API_DATABASE_SCHEMA` | Schema/user for the tables. On Oracle set this to your schema user (uppercase); the `public` default fails. |
194228
| `HINDSIGHT_API_RUN_MIGRATIONS_ON_STARTUP` | Auto-apply migrations when the API boots (default `true`). |
195229

196230
## Limitations vs PostgreSQL
@@ -218,6 +252,8 @@ internal details differ:
218252
| Symptom | Cause / Fix |
219253
|---------|-------------|
220254
| `python-oracledb is required for Oracle backend` | The driver isn't installed. Run `pip install oracledb` (or install the `[oracle]` extra). |
255+
| `ORA-01435: user does not exist` on migration | `HINDSIGHT_API_DATABASE_SCHEMA` is unset (defaults to `public`) or misspelled. Set it to your Oracle schema user, uppercase (e.g. `HINDSIGHT`). |
256+
| `ORA-51803: Vector dimension count must match` on retain | The schema was migrated with a different embedding dimension than the running embeddings model. Migrate with the same embeddings config, or re-run `run-db-migration --embedding-dimension <N>`. |
221257
| Migration errors when creating embedding/`VECTOR` columns | The schema user's default tablespace is not ASSM (often the `SYSTEM` tablespace). Recreate the user in an ASSM tablespace as shown above. |
222258
| Full-text search errors / missing Oracle Text index | The schema user is missing the `CTXAPP` role. Run `GRANT CTXAPP TO <user>;`. |
223259
| `ORA-12514` / service not found | The URL uses a SID or wrong service name. Use the pluggable database **service name** (e.g. `FREEPDB1`), not the SID. |

0 commit comments

Comments
 (0)