重庆思庄Oracle、KingBase、PostgreSQL、Redhat认证学习论坛

标题: 19c新特性产生的自动索引如何删除 [打印本页]

作者: 刘泽宇    时间: 2026-4-5 19:17
标题: 19c新特性产生的自动索引如何删除
直接删除自动索引时,会报错:
SQL> drop index "SYS_AI_600vgjmtqsgv3";

drop index "SYS_AI_600vgjmtqsgv3"
*
ERROR at line 1:
ORA-65532: cannot alter or drop automatically created indexes


其他的方法也不行:
SQL> alter index "SYS_AI_600vgjmtqsgv3" invisible;

alter index "SYS_AI_600vgjmtqsgv3" invisible
*
ERROR at line 1:
ORA-65532: cannot alter or drop automatically created indexes


SQL> alter index "SYS_AI_600vgjmtqsgv3" unusable;

alter index "SYS_AI_600vgjmtqsgv3" unusable
*
ERROR at line 1:
ORA-65532: cannot alter or drop automatically created indexes


要删除自动索引,只能使用DBMS_AUTO_INDEX.DROP_AUTO_INDEXES
exec DBMS_AUTO_INDEX.DROP_AUTO_INDEXES(owner=>'用户名',index_name=>'"SYS_AI_xxx"',allow_recreate=>true/false);

注意:此种删除方式只能在19.5版本之后使用






欢迎光临 重庆思庄Oracle、KingBase、PostgreSQL、Redhat认证学习论坛 (http://bbs.cqsztech.com/) Powered by Discuz! X3.2