Search code examples
oracle-databasespring-bootjpa

Oracle schema created with name "ACTIVATION_MS" then it is renamed to ACTIVATION_MS_DEV but schema name for identity column didn't change


I am working on Spring Boot application, as a db I use Oracle. Schema created with name "ACTIVATION_MS" then it is renamed to ACTIVATION_MS_DEV but schema name for identity column didn't change.

Example: ID NUMBER(38) default "ACTIVATION_MS"."ISEQ$$_108264".nextval generated as identity

And when I want to insert row into table, it says "sequence not found" since schema name didn't change.

How can I alter schema name, remove it before sequence name without recreating table?


Solution

  • How can I alter schema name, remove it before sequence name without recreating table?

    You can't. As you've discovered, renaming a schema only affects top-level object ownership. It does not adjust anything embedded in code within an object, so identity columns, triggers, views, stored procedures or any other object with embedded PL/SQL that includes the owning schema name must be replaced. You would need to recreate the table with a new identity column, or drop and recreate the identity column within the table.