简体   繁体   English

Oracle SQL Developer中未显示DDL更改

[英]DDL changes not showing in Oracle sql developer

I have sql Upgrade script which has many sql statements(DDL,DML). 我有sql升级脚本,其中包含许多sql语句(DDL,DML)。 When i ran this upgrade script in SQL developer, it runs successufully.I also provide in my script at the bottom commit. 当我在SQL Developer中运行此升级脚本时,它成功运行。我还在底部提交中提供了我的脚本。 I can see all the changes in the database after running this upgrade script except the unique index constraints. 运行此升级脚本后,除了唯一索引约束之外,我可以看到数据库中的所有更改。 When i insert few duplicate records it says unique constraint violated. 当我插入一些重复的记录时,它说违反了唯一约束。 It means the table has unique constraints. 这意味着表具有唯一的约束。 But i dont know why i cant view this constraints in oracle sql developer. 但是我不知道为什么我不能在oracle sql developer中查看此约束。 The other DDL changes made i can view.I dont know is there any settings to view it in oracle sql developer. 我可以查看的其他DDL更改。我不知道是否有任何设置可以在oracle sql developer中查看。

CREATE UNIQUE INDEX "RATOR_MONITORING"."CAPTURING_UK1" ON "RATOR_MONITORING"."CAPTURING" ("DB_TABLE"); 
CREATE UNIQUE INDEX "RATOR_MONITORING_CONFIGURATION"."BRAND_UK1" ON "RATOR_MONITORING_CONFIGURATION"."BRAND" ("NAME");
CREATE UNIQUE INDEX "RATOR_MONITORING_CONFIGURATION"."BRAND_BUSINESS_PROCESS_UK1" ON "RATOR_MONITORING_CONFIGURATION"."BRAND_BUSINESS_PROCESS" ("BRAND_ID", "BP_ID");
CREATE UNIQUE INDEX "RATOR_MONITORING_CONFIGURATION"."BRAND_ENGINE_UK1" ON "RATOR_MONITORING_CONFIGURATION"."BRAND_ENGINE" ("BRAND_ID", "ENGINE_ID");

As A Hocevar noted, if you create an index 正如Hocevar所说,如果您创建索引

 create unique index test_ux on test(id);

you see it in the Indexes tab of the table properties (not in the Constraints tab). 您可以在表属性的“索引”选项卡中看到它(而不是在“约束”选项卡中)。

Please note that COMMIT is not required here, it is done implicitely in each DDL statement. 请注意,此处不需要COMMIT,它是在每个DDL语句中隐式完成的。 More usual source of problems are stale metadata in SQL Developer, ie missing REFRESH (ctrl R on user or table node). 问题的更常见根源是SQL Developer中的陈旧元数据,即缺少REFRESH(用户或表节点上的ctrl R)。

If you want to define the constraint, add following statement, that will reuse the index defined previously 如果要定义约束,请添加以下语句,该语句将重用先前定义的索引

 alter table test add constraint test_unique unique(id) using index test_ux;

See further discussion about the option in Documentation 请参阅文档中有关该选项的更多讨论

I am assuming you are trying to look for index on a table in the correct tab in sql developer. 我假设您正在尝试在sql developer中正确选项卡中的表上查找索引。 If you are not able to see the index there, one reason could be that your user (the one with which you are logged in) doesn't have proper rights to see the Index. 如果您无法在此处看到索引,则可能是由于您的用户(您登录的用户)没有适当的权限来查看索引。

If you not obtain any error, the solution is very simple and tedious. 如果没有收到任何错误,则解决方案非常简单且乏味。 SQL Developer doesn't refresh his fetched structures. SQL Developer不会刷新其获取的结构。 Kindly push Refresh blue icon (or use Ctrl-R) in Connections view or disconnect and connect again (or restart SQL Developer) to see your changes in structures. 请在“连接”视图中按“刷新”蓝色图标(或使用Ctrl-R),或断开连接并再次连接(或重新启动SQL Developer)以查看结构更改。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM