• 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='表名'

  • 相关阅读:
    从头学pytorch(十二):模型保存和加载
    Python环境安装与配置
    PyCharm安装及使用
    Python包管理工具pip的基本使用
    LoadRunner安装破解
    正则表达式提取器使用
    TCPMon使用总结
    JMeter:全面的乱码解决方案
    Jmeter脚本两种录制方式
    监听器-【聚合报告】界面字段解析及计算方法概要说明
  • 原文地址:https://www.cnblogs.com/zxg-blog/p/13335505.html
Copyright © 2020-2023  润新知