英文:
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?
英文:
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?
答案1
得分: 1
你无法在不重新创建表的情况下更改模式名称或删除它前面的序列名称。正如您已经发现的那样,重命名模式只会影响顶级对象所有权。它不会调整对象内嵌在代码中的任何内容,因此包括拥有模式名称的标识列、触发器、视图、存储过程或任何其他具有嵌入式PL/SQL的对象都必须被替换。您需要使用新的标识列重新创建表,或者在表内部删除并重新创建标识列。
英文:
> 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.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论