drop tablespace xdb 出错了!

[复制链接]
查看11 | 回复9 | 2011-6-1 15:32:28 | 显示全部楼层 |阅读模式
SQL> drop tablespace xdb including contents;
drop tablespace xdb including contents
*
ERROR at line 1:
ORA-29857: domain indexes and/or secondary objects exist in the tablespace
怎么找到相关的domain indexes or secondary objects 并删除呢??
谢谢!
回复

使用道具 举报

千问 | 2011-6-1 15:32:28 | 显示全部楼层
selectindex_name from USER_INDEXES where TABLESPACE_NAME='XDB'
可以查到建在该表空间的索引,
alter index index_name rebuild tablespace tablespacename ;
回复

使用道具 举报

千问 | 2011-6-1 15:32:28 | 显示全部楼层
sorry !上面只查到该用户下的索引,应查all_indexes
回复

使用道具 举报

千问 | 2011-6-1 15:32:28 | 显示全部楼层
SQL> select index_name from all_indexes where tablespace_name='XDB';
INDEX_NAME
------------------------------
XDB$H_INDEX_OID_I
XDB_PK_H_LINK
SYS_C001674
SYS_C001675
SYS_C001676
SYS_C001677
SYS_C001678
SYS_C001679
SYS_C001680
SYS_C001681
SYS_C001682
INDEX_NAMESYS_C001683
SYS_C001684
SYS_C001685
SYS_C001686
SYS_C001687
SYS_C001688
XDB$ELEMENT_PROPNUMBER
XDB$ELEMENT_PROPNAME
XDB$SCHEMA_URL
SYS_C001689
SYS_C001690
INDEX_NAME
------------------------------
XDB$NLOCKS_RAWTOKEN_IDX
XDB$NLOCKS_CHILD_NAME_IDX
XDB$NLOCKS_PARENT_OID_IDX
SYS_C001691
SYS_C001692
SYS_C001693
SYS_C001694
SYS_C001695
COKEY
XDB$CHECKOUTS_VCRUID_IDX
SQL> alter index sys_c001697 rebuild tablespace xdb;
alter index sys_c001697 rebuild tablespace xdb
*
ERROR at line 1:
ORA-01418: specified index does not exist

SQL> alter index XDB$ELEMENT_PROPNUMBER rebuild tablespace xdb;
alter index XDB$ELEMENT_PROPNUMBER rebuild tablespace xdb
*
ERROR at line 1:
ORA-01418: specified index does not exist

是那儿错了呢??
回复

使用道具 举报

千问 | 2011-6-1 15:32:28 | 显示全部楼层
最初由 nmgzw 发布
[B]SQL> drop tablespace xdb including contents;
drop tablespace xdb including contents
*
ERROR at line 1:
ORA-29857: domain indexes and/or secondary objects exist in the tablespace
怎么找到相关的domain indexes or secondary objects 并删除呢??
谢谢! [/B]


这样呢?
DROP TABLESPACE xdbINCLUDING CONTENTS CASCADE CONSTRAINTS;
回复

使用道具 举报

千问 | 2011-6-1 15:32:28 | 显示全部楼层
最初由 nmgzw 发布
[B]SQL> select index_name from all_indexes where tablespace_name='XDB';
INDEX_NAME
------------------------------
XDB$H_INDEX_OID_I
XDB_PK_H_LINK
SYS_C001674
SYS_C001675
SYS_C001676
SYS_C001677
SYS_C001678
SYS_C001679
SYS_C001680
SYS_C001681
SYS_C001682
INDEX_NAMESYS_C001683
SYS_C001684
SYS_C001685
SYS_C001686
SYS_C001687
SYS_C001688
XDB$ELEMENT_PROPNUMBER
XDB$ELEMENT_PROPNAME
XDB$SCHEMA_URL
SYS_C001689
SYS_C001690
INDEX_NAME
------------------------------
XDB$NLOCKS_RAWTOKEN_IDX
XDB$NLOCKS_CHILD_NAME_IDX
XDB$NLOCKS_PARENT_OID_IDX
SYS_C001691
SYS_C001692
SYS_C001693
SYS_C001694
SYS_C001695
COKEY
XDB$CHECKOUTS_VCRUID_IDX
SQL> alter index sys_c001697 rebuild tablespace xdb;
alter index sys_c001697 rebuild tablespace xdb
*
ERROR at line 1:
ORA-01418: specified index does not exist

SQL> alter index XDB$ELEMENT_PROPNUMBER rebuild tablespace xdb;
alter index XDB$ELEMENT_PROPNUMBER rebuild tablespace xdb
*
ERROR at line 1:
ORA-01418: specified index does not exist

是那儿错了呢?? [/B]

你用什么用户执行alter index XDB$ELEMENT_PROPNUMBER rebuild tablespace xdb;
?????
最好用sys或者具sysdba的用户执行,还有你后面的表空间就换成另外的吧,你现在要删除xdb,应指向另外的表空间!
回复

使用道具 举报

千问 | 2011-6-1 15:32:28 | 显示全部楼层
我是用connect /as sysdba进去的,应该可以的啊!
回复

使用道具 举报

千问 | 2011-6-1 15:32:28 | 显示全部楼层
sorry!
刚才我试了,重创索引要到自己相应的用户下或者在索引名前加上用户,所以
select OWNER,index_name from all_indexes where tablespace_name='XDB';
这里找到相应的owner
在 as sysdba 下
alter index( 这里加上相应的owner).XDB$ELEMENT_PROPNUMBER rebuild tablespace xdb;

你可以生成一个sql文件,然后批处理.
spool c:\tt.sql;
select 'alter index 'OWNER||'.'||index_name ||'retuild tablespace ??? ;' from all_indexes where tablespace_name='XDB';
spool off;
@c:\tt.sql
回复

使用道具 举报

千问 | 2011-6-1 15:32:28 | 显示全部楼层
SQL> create table a(a number) tablespace a;-----------TABLESPACES A
表已创建。
SQL> alter table a add constraint a_e foreign key (a) references employees(employee_id);
表已更改。

SQL> create table t(a number) tablespace users;
表已创建。

SQL> alter table t add constraint t_a foreign key (a) references a (a);
alter table t add constraint t_a foreign key (a) references a (a)

*
ERROR 位于第 1 行:
ORA-02270: 此列列表的唯一或主键不匹配

SQL> alter table a add unique(a);
表已更改。
SQL> alter table t add constraint t_a foreign key (a) references a (a);
表已更改。

SQL> drop tablespace a;
drop tablespace a
*
ERROR 位于第 1 行:
ORA-01549: 表空间非空,请使用 INCLUDING CONTENTS 选项

SQL> drop tablespace including contents;
drop tablespace including contents

*
ERROR 位于第 1 行:
ORA-02173: 无效的 DROP TABLESPACE 选项

SQL> drop tablespace a including contents;
drop tablespace a including contents
*
ERROR 位于第 1 行:
ORA-02449: 表中的唯一/主键被外部关键字引用

SQL> drop tablespace a including contents cascade constraints;
表空间已丢弃。
SQL>
回复

使用道具 举报

千问 | 2011-6-1 15:32:28 | 显示全部楼层
非常非常感谢!!
试完了,给你回复!!!!
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

主题

0

回帖

4882万

积分

论坛元老

Rank: 8Rank: 8

积分
48824836
热门排行