ORA-22868: 具有 LOB 的表包含有位于不同表空间的段

69 篇文章 0 订阅
55 篇文章 1 订阅
由于lob对象引起的表空间无法删除。本来是要删除DMS表空间,但是上面有LOB对象,而且表却是在别的表空间DMS4上。解决的办法就是将这些lob移动到DMS4表空间。
下面是解决过程


删除用户时报错:



drop tablespace dms


第 1 行出现错误:
ORA-01549: 表空间非空, 请使用 INCLUDING CONTENTS 选项


SQL> drop tablespace dms including contents and datafiles;
drop tablespace dms including contents and datafiles
*
第 1 行出现错误:
ORA-22868: 具有 LOB 的表包含有位于不同表空间的段


检查过程

检查这个表空间上的Lob对象
SQL> select owner, table_name, column_name, tablespace_name
    from dba_lobs
    where tablespace_name = 'DMS';


已选择6行。


另外再检查下约束有没有问题(因为这个问题常见,所以一并检查了下)。


SQL> select 'alter table '||owner||'.'||table_name||' drop constraint '||constraint_name||' ;'
   from dba_constraints
    where constraint_type in ('U', 'P')
       and (index_owner, index_name) in
          (select owner, segment_name
             from dba_segments
             where tablespace_name = 'DMS');


未选定行


SQL>




解决过程:



下面是我写的脚本,这个脚本可以生成要用的语句。


       
select 'alter table ' || xtable || ' move tablespace DMS4 lob' || '(' ||
       column_name || ') store as ( tablespace DMS4);'
  from (select xtable, wmsys.wm_concat(column_name) column_name
          from (select owner || '.' || table_name xtable,
                       column_name,
                       tablespace_name
                  from dba_lobs
                 where tablespace_name = 'DMS')
         group by xtable)


结果如下:


alter table DMS4.xxxx move tablespace DMS4 lob(ERROR_TEXT) store as ( tablespace DMS4);

^………………


取消dms4在dms表空间上的限额,防止再出类似问题。


alter user dms4 quota 0 on dms;
  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值