当前位置:网站首页>Oracle索引状态查询与索引重建
Oracle索引状态查询与索引重建
2022-04-23 06:05:00 【旺财2】
1,查询索引状态
select status,T.* from user_indexes T where table_name='表名'
状态列STATUS说明:
valid:当前索引有效
N/A :分区索引 有效
unusable:索引失效
1.2 查询分区索引-user_ind_partitions表
select index_name, partition_name, status
from user_ind_partitions
where index_name = '索引名称';
索引状态说明:
USABLE:索引有效
UNUSABLE:索引失效
1.3 检查损坏索引
SELECT status, COUNT(*)
FROM dba_indexes
GROUP BY status
UNION
SELECT status, COUNT(*)
FROM dba_ind_partitions
GROUP BY status
UNION
SELECT status, COUNT(*)
FROM dba_ind_subpartitions
GROUP BY status
2,索引重建
alter index pk_kc03 rebuild nologging;
or
alter index pk_kc03 rebuild
2.2 local索引重建
select b.table_name,
a.INDEX_NAME,
a.PARTITION_NAME,
a.STATUS,
'alter index ' || a.index_name || ' rebuild partition ' ||partition_name || ';' --重建列
from USER_IND_PARTITIONS a, user_part_indexes b
where a.index_name = b.index_name
and b.TABLE_NAME IN ('PART_TAB_SPLIT')
and STATUS = 'UNUSABLE'
ORDER BY b.table_name, a.INDEX_NAME, a.PARTITION_NAME;
在针对truncate等 操作时直接更新 index 也可以搞定。
alter table part_tab_trunc truncate partition p2 Update GLOBAL indexes;
版权声明
本文为[旺财2]所创,转载请带上原文链接,感谢
https://blog.csdn.net/wdyliuxingfeiyang/article/details/121607378
边栏推荐
- Construire un blog Cloud basé sur ECS (bénédiction sur le Code Cloud Xiaobao, explication détaillée de la tâche iphone13 gratuite)
- Kubernetes CoreDNS常见问题资料参考
- oracle 修改默认临时表空间
- ORACLE环境遇到的ORA-600 [qkacon:FJswrwo]
- [MySQL basics] startup options and configuration files
- Dolphinscheduler源码包src.tar.gz解压问题
- 阿里矢量库的图标使用教程(在线,下载)
- How does VirtualBox modify the IP network segment assigned to the virtual machine in the "network address translation (NAT)" network mode
- Exception record-7
- pg库对姓名进行校验
猜你喜欢

Implementation of multi tenant read and write in Prometheus cortex

Winter combat camp hands-on combat - cloud essential environment preparation, hands-on practical operation, quickly build lamp environment, lead mouse cloud Xiaobao backpack without shadow

Chaos vous emmène au projet chaos.

Prometheus Thanos快速指南

你应该知道的 JVM 基础知识

PG SQL截取字符串到指定字符位置

Dolphinscheduler集成Flink任务踩坑记录

基于ECS搭建云上博客(云小宝码上送祝福,免费抽iphone13任务详解)

Memcached source code analysis

OVS and OVS + dpdk architecture analysis
随机推荐
基于ECS搭建云上博客(体验有礼)
关于我
[MySQL basics] startup options, system variables and status variables
Build an OSS based image sharing website - polite feedback
How to use tiup to deploy a tidb V5 0 cluster
Problems related to Prometheus cortex using block storage
EMR Based offline data analysis - polite feedback
[step by step, even thousands of miles] MySQL reports a large number of unauthenticated user connection errors
几款电纸书阅读器参数对比
基于EMR离线数据分析-反馈有礼
使用prom-label-proxy实现Prometheus Thanos的基于标签的多租户读
Abnormal record-20
RAC环境中openssh版本对SSH互信创建的影响
基于ECS搭建云上博客(云小宝码上送祝福,免费抽iphone13任务详解)
你应该知道的 JVM 基础知识
异常记录-15
19C中ASM network未自动启动的处理
js 函数包裹forEach中使用return跳不出外层函数
异常记录-20
RAC环境集群组件gpnp未启动成功问题分析