zoukankan      html  css  js  c++  java
  • oracle 表分区后插入数据报错SQLException: ORA-01502: 索引 'aaaaaa' 或这类索引的分区处于不可用状态

    oracle 某张表使用了列hash规则进行了分区,使用过程中插入数据报错:nested exception is java.sql.SQLException: ORA-01502: 索引 'aaaaaa' 或这类索引的分区处于不可用状态。

    在解决这个问题前,了解了一下oracle数据库关于分区的几个命令:

    1、查看某张表是否有分区

    select * from user_tables where table_name='tableaaa'

    如果 tablespace_name  为空则证明存在分区。

    2、如果存在分区,则需要查看是哪个分区的索引出了问题,根据索引名称,查看分区索引状态

    select * from user_ind_partitions where index_name='aaaaaa'

    其中发现status有的是UNUSABLE、USABLE两种。第一种应该为不可用,于是找到重建索引的命令。

    alter index index_name rebuild partition partition_name (online);
    或者alter index index_name rebuild partition partition_name ;

    另外如果不是分区索引,重建索引的命令为:

    alter index index_name rebuild (online);或者alter index index_name rebuild;

    3、执行上述命令后,问题解决。

    4、说几条其他相关的命令:

    4.1、查看分区的表有哪些,这些表是以什么方式进行的分区:比如Hash、range等等

      select * from user_part_tables;

    4.2、查看某张表分区有哪些

      SELECT * FROM USER_TAB_PARTITIONS WHERE TABLE_NAME='tableaaa'

    4.3、查看索引对应的列名称

    select * from user_ind_columns where index_name='xxx';

    4.4、查看某张表有哪些索引,一般和4.3结合使用

    select * from user_indexes where table_name='表名'

  • 相关阅读:
    输入url到页面渲染发生了什么
    echarts缓存处理
    jquery 使用mock
    vue axios的封装
    css3实现盒子宽度随文字宽度自适应
    VUE中使用bus传值时,接收页面多次触发接收方法的问题
    原生js 文件 上传 下载封装
    微信小程序使用第三方包
    为什么我们要使用Async、Await关键字
    服务大众的人工智能---认知服务
  • 原文地址:https://www.cnblogs.com/zxg-blog/p/13335505.html
Copyright © 2011-2022 走看看