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


    由于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;

    原文地址:http://blog.csdn.net/bamuta/article/details/12492783

  • 相关阅读:
    20175216 数据结构(选做)
    20175216 《Java程序设计》第1周学习总结
    20175216 MyCP(课下作业)
    WPF 4 DataGrid 控件(进阶篇一)
    InstallShield 通过VBS操作IIS
    WPF 4 DataGrid 控件(自定义样式篇)
    INNO 实现Sql数据库操作
    Wix学习整理(7)——在开始菜单中为HelloWorld添加卸载快捷方式
    Wix学习整理(5)——安装时填写注册表
    Wix学习整理(4)——关于WiX文件格式和案例HelloWorld的分析
  • 原文地址:https://www.cnblogs.com/huacw/p/4089592.html
Copyright © 2020-2023  润新知