今天在删除一个表空间时,使用删除语句drop tablespace flyy including contents and datafiles cascade contraints;
报出错误:ORA-25183: 索引表的顶级索引段在不同的表空间中。
查找文档得得结果如下:
[quote]ORA-25183: index-organized table top index segment is in a different tablespace
Cause: An attempt was made to drop a tablespace which contains an index only table"s overflow segment but not the top index segment"
Action: find index-organized tables which span the tablespace being dropped and some other tablespace(s). Drop these tables.[/quote]
提示要先找到索引表,先删除索引表再删除表空间。但是因为先执行了语句drop user flyy cascade;
已经无法找到用户下的表了,怎么办?
[b]问题补充:[/b]
不能了,用户被删了,没开flashback。
只是想知道有什么办法可以删掉独立的IOT
[b]问题补充:[/b]
王者之剑 可能没碰到过这个问题。
这个是因为在原有的表是索引表,并设置了溢出段。那么溢出段会在SYS表空间生成一个对应的SYS_IOT_OVER_1234这样子的表。
默认维护SYS_IOT_OVER_1234的方式必须通过alter table 原表 (purge)等操作。而通过直接操作SYS_IOT_OVER_1234表都是非法的操作。
当使用drop user flyy cascade;后,原索引表和表主键都会被删除掉,但是这个存在于SYS表空间的表是不被删除掉的。
但是关键的是,原用户里的内容全部删除了,也没有原索引表可以来操作SYS_IOT_OVER_1234表了。
[b]问题补充:[/b]
嗯,我描述不够清,主要是概念也很模糊。
从ALL_INDEXES,ALL_TABLES,ALL_SEGMENT中去找好看,把相关的tablespace删除掉就好了
其实还可以另外一种暴力的办法,从v$datafile中找到相关的数据文件,把数据文件删除掉,重起数据库,用命令offline drop 数据文件,然后就可以删除表空间了
可以rollback不?
1.把你要drop的表空间中的表名都找出来
2.把这些表对应的索引都找出来
3.把这些索引对应的表空间都找出来
4.把不在你要drop的表空间中的索引先drop掉
5.drop表空间flyy
觉得有道理可以试试
不过英文的意思和你的描述是反的。
ORA-25183: index-organized table top index segment is in a different tablespace
索引组织表的顶级索引段在不同的表空间中
Cause: An attempt was made to drop a tablespace which contains an index only table"s overflow segment but not the top index segment"
试图drop只包含索引表溢出段但不包括顶级索引段的表空间
Action: find index-organized tables which span the tablespace being dropped and some other tablespace(s). Drop these tables.
找到索引组织表所在的表空间,先drop这些表
即你建了一个索引表,索引表的主要数据不在这个flyy中但溢出段在flyy中,或者主要数据不只在flyy中还存在于其他表空间,就会报这个错。
N年不用Oracle了,查了一下索引组织表的定义,也可能是我理解错了。