


回收站也清空了,查询u,p都没有,但是就是不叫删除
1) Disable the Constrains:
SQL> select 'ALTER TABLE '||owner||'.'||table_name||' DISABLE CONSTRAINT '|| constraint_name||';'
from dba_constraints
where (index_owner,index_name) in (select owner,index_name from dba_indexes
where tablespace_name='MY_TBS');
2) In case of PKs, you may need to disable it with CASCADE clause:
SQL> select 'ALTER TABLE '||owner||'.'||table_name||' DISABLE CONSTRAINT '|| constraint_name||' cascade;'
from dba_constraints
where (index_owner,index_name) in (select owner,index_name from dba_indexes
where tablespace_name='MY_TBS');
3) Drop the tablespace:
SQL> DROP TABLESPACE MY_TBS INCLUDING CONTENTS AND DATAFILES;
评论
有用 5补充一下,既然是分别处理U和P,那么第一二句可合并成以下:
select 'ALTER TABLE '||owner||'.'||table_name||' DISABLE CONSTRAINT '|| constraint_name||decode(constraint_type ,'P',' CASCADE','')||';'
from dba_constraints where constraint_type in ('U','P') and (index_owner,index_name) in
(select owner,index_name from dba_indexes where tablespace_name='INDX');
评论
有用 0还有一个问题,执行了这个sql后,DROP TABLESPACE MY_TBS INCLUDING CONTENTS AND DATAFILES;发现磁盘空间大小还是没变,我新建了一个表空间在data1上面,发现表空间使用率还是和原来一样


评论
有用 0
墨值悬赏




谢谢老师解答
