DataStage收到此错误“ ORA-02429:无法删除用于实施唯一/主键的索引,但之前工作正常”

问题描述 投票:0回答:1

我有很大的麻烦。我一直在执行DataStage作业,一切正常,但是没想到,我在所有具有Oracle Stage目标的作业中都遇到了错误。

错误是这样的:

 ORA-02429: Cannot drop index used for enforcement of unique/primary key    

无论是什么表或数据库,每个作业都会出现该错误。我们尝试重新启动Oracle数据库的DataStage引擎/服务层,但是没有任何反应。

任何想法?

database oracle indexing key datastage
1个回答
0
投票

事情通常不会发生只是因为。这可能是发生了什么。

首先,您直到最近的情况:您可以删除一个索引:

SQL> create table test (id number);

Table created.

SQL> create index i1 on test (id);

Index created.

SQL> drop index i1;

Index dropped.

让我们再次创建它:

SQL> create index i1 on test (id);

Index created.

与此同时,有人决定在索引列上创建主键(索引已经存在,因此主键将使用它;如果不存在,则alter table将创建它):

SQL> alter table test add constraint pk_test primary key (id);

Table altered.

这是当您尝试删除该索引时正在发生的事情:

SQL> drop index i1;
drop index i1
           *
ERROR at line 1:
ORA-02429: cannot drop index used for enforcement of unique/primary key


SQL>

这意味着:首先放下主键:

SQL> alter table test drop constraint pk_test;

Table altered.

SQL> drop index i1;

Index dropped.

SQL>

随着工作的完成,事情可能不再那么简单了。您可以创建一个procedure,该查询将查询元数据,然后动态地执行此操作,但是……首先调查一下“它正在工作”与“它不再工作”之间发生了什么。]]

© www.soinside.com 2019 - 2024. All rights reserved.