【问题标题】:Changing an huge table column type Long to Clob将一个巨大的表列类型 Long 更改为 Clob
【发布时间】:2014-03-07 23:02:22
【问题描述】:

背景: 我想将表列从 Long 更改为 Clob。

  • 我不允许创建/更改表空间
  • 该表有 10M + 行

我尝试过的:

  1. 只需将表从 long 更改为 clob:

    • 返回完整表空间错误 - ORA-01652: "unable to extend temp segment by %s in tablespace %s"

  2. 从表中导出数据并插入到新表中:

    • 导出时间太长,以现在的速度,导出需要数周时间。
  3. 运行"insert /*+ APPEND */ into new_table select * from old_table;"

    • 返回错误 - ORA-00997: "illegal use of LONG datatype"

【问题讨论】:

  • 你有没有尝试过这样的事情:stackoverflow.com/a/10754753/2083907
  • 要求您的 DBA 临时增加 TEMP 表空间的大小。从我的角度来看应该没问题。
  • @Wernfried 他拒绝了
  • @mbroshi,谢谢你的链接,去试试

标签: sql oracle plsql


【解决方案1】:

只是一种选择。 (之前总是在试生产中测试)

  • 创建一个将 long 转换为 clob 的 function

  • 然后尝试使用函数的第三个选项:

    insert /*+ APPEND */ into new_table select id, long_to_clob(myLob) as myclob from old_table;

  • 删除长字段。

  • 添加一个新的 clob 字段。

  • 更新新字段。

    更新 old_table o SET new_field =( SELECT myclob FROM newTable n WHERE n.id = o.id) 其中 1=1;

【讨论】:

    猜你喜欢
    • 2018-02-12
    • 1970-01-01
    • 1970-01-01
    • 2012-11-04
    • 2020-06-06
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多