[20240513]ORA-38029 object statistics are locked.txt --//生产系统在建立索引时出现如上错误. ORA-38029 : object statistics are locked --//问题在于表统计上锁了,并且建立索引时加入compute statistics;,我个人建立索引喜欢在toad下生成建立脚本,在sqlplus下执行. --//如果建立时选上compute statistics并且表统计lock就会遇到这个问题.解决很简单取消建立的参数compute statistics. --//另外我还发现生产系统一些索引没有统计信息,估计一些表统计上锁的缘故. 1.环境: SCOTT@test01p> @ ver1 PORT_STRING VERSION BANNER CON_ID -------------------- ---------- ---------------------------------------------------------------------------- ------ IBMPC/WIN_NT64-9.1.0 12.2.0.1.0 Oracle Database 12c Enterprise Edition Release 12.2.0.1.0 - 64bit Production 0 2.测试: SCOTT@test01p> create table empx as select * from emp; Table created. SCOTT@test01p> create unique index pk_empx on empx(empno) ; Index created. SCOTT@test01p> @gts empx '' '' '' Gather Table Statistics for table empx... exec dbms_stats.gather_table_stats('SCOTT', 'EMPX', estimate_percent => NULL, method_opt=>'FOR TABLE FOR ALL COLUMNS SIZE REPEAT', cascade=>true, no_invalidate=>false) if lock table empx, add force=>true. press ctrl+c cancel, enter continue... PL/SQL procedure successfully completed. SCOTT@test01p> exec dbms_stats.lock_table_stats('SCOTT','EMPX'); PL/SQL procedure successfully completed. SCOTT@test01p> create index i_empx_ename on empx(ename) compute statistics; create index i_empx_ename on empx(ename) compute statistics * ERROR at line 1: ORA-38029: object statistics are locked SCOTT@test01p> create index i_empx_ename on empx(ename) ; Index created. SCOTT@test01p> @ ind2 i_empx_ename Display indexes where table or index name matches i_empx_ename... TABLE_OWNER TABLE_NAME INDEX_NAME POS# COLUMN_NAME DSC ----------- ---------- ------------ ---- ----------- ---- SCOTT EMPX I_EMPX_ENAME 1 ENAME INDEX_OWNER TABLE_NAME INDEX_NAME IDXTYPE UNIQ STATUS PART TEMP H LFBLKS NDK NUM_ROWS CLUF LAST_ANALYZED DEGREE VISIBILIT ----------- ---------- ------------ ------- ---- ------ ---- ---- -- ------ ---- -------- ---- ------------- ------ --------- SCOTT EMPX I_EMPX_ENAME NORMAL NO VALID NO N 1 VISIBLE --//没有统计信息!! --//单独分析索引,加入force=>true: SCOTT@test01p> exec dbms_stats.gather_index_stats(null, 'i_empx_ename',force=>true); PL/SQL procedure successfully completed. SCOTT@test01p> @ ind2 i_empx_ename Display indexes where table or index name matches i_empx_ename... TABLE_OWNER TABLE_NAME INDEX_NAME POS# COLUMN_NAME DSC ----------- ---------- ------------ ---- ----------- ---- SCOTT EMPX I_EMPX_ENAME 1 ENAME INDEX_OWNER TABLE_NAME INDEX_NAME IDXTYPE UNIQ STATUS PART TEMP H LFBLKS NDK NUM_ROWS CLUF LAST_ANALYZED DEGREE VISIBILIT ----------- ---------- ------------ ------- ---- ------ ---- ---- -- ------ --- -------- ---- ------------------- ------ --------- SCOTT EMPX I_EMPX_ENAME NORMAL NO VALID NO N 1 1 14 14 1 2024-05-15 21:44:48 1 VISIBLE --//有统计信息!! --//以后做运维注意这个问题. --//如果rebuild也类似: SCOTT@test01p> alter index i_empx_ename rebuild compute statistics online; alter index i_empx_ename rebuild compute statistics online * ERROR at line 1: ORA-38029: object statistics are locked SCOTT@test01p> alter index i_empx_ename rebuild online; Index altered. SCOTT@test01p> @ ind2 i_empx_ename Display indexes where table or index name matches i_empx_ename... TABLE_OWNER TABLE_NAME INDEX_NAME POS# COLUMN_NAME DSC ----------- ---------- ------------ ---- ----------- ---- SCOTT EMPX I_EMPX_ENAME 1 ENAME INDEX_OWNER TABLE_NAME INDEX_NAME IDXTYPE UNIQ STATUS PART TEMP H LFBLKS NDK NUM_ROWS CLUF LAST_ANALYZED DEGREE VISIBILIT ----------- ---------- ------------ ------- ---- ------ ---- ---- -- ------ --- -------- ---- ------------------- ------ --------- SCOTT EMPX I_EMPX_ENAME NORMAL NO VALID NO N 1 1 14 14 1 2024-05-15 21:44:48 1 VISIBLE --//注意最后LAST_ANALYZED时间没有变化.
[20240513]ORA-38029 object statistics are locked.txt
来源:这里教程网
时间:2026-03-03 20:01:01
作者:
编辑推荐:
- [20240513]ORA-38029 object statistics are locked.txt03-03
- [20240515]建立完善t2sh.sql脚本.txt03-03
- [20240514]建立完善vim bccalc_win.vim插件.txt03-03
- [20240516]建立任意进制转10进制脚本xto10.sql脚本.txt03-03
- [20240516]建立完善vim bccalc_linux.vim插件.txt03-03
- [20240516]关于v$db_object_cache视图.txt03-03
- [20240518]任意进制转换xtoy.sql脚本.txt03-03
- Oracle优化器之use_hash深度解密03-03
下一篇:
相关推荐
-
雷神推出 MIX PRO II 迷你主机:基于 Ultra 200H,玻璃上盖 + ARGB 灯效
2 月 9 日消息,雷神 (THUNDEROBOT) 现已宣布推出基于英
-
制造商 Musnap 推出彩色墨水屏电纸书 Ocean C:支持手写笔、第三方安卓应用
2 月 10 日消息,制造商 Musnap 现已在海外推出一款 Oce
热文推荐
- 数据库管理-第186期 23ai:啥?我还能干掉Neo4j?(20240509)
- rac asm新增磁盘报0RA-15333或ORA-15075
rac asm新增磁盘报0RA-15333或ORA-15075
26-03-03 - Oracle RAC的排障案例一则
Oracle RAC的排障案例一则
26-03-03 - 测试开发新技能:Oracle到高斯数据库的无缝迁移
测试开发新技能:Oracle到高斯数据库的无缝迁移
26-03-03 - 因Oracle 23ai,甲骨文中国罕见的开了个会
因Oracle 23ai,甲骨文中国罕见的开了个会
26-03-03 - 数据库管理-第190期 备份堪比生死(20240515)
数据库管理-第190期 备份堪比生死(20240515)
26-03-03 - 数据库管理-第180期 23ai: Cloud/Container Plus AI(20240503)
- Oracle 23ai新特性—DBMS_DICTIONARY_CHECK
Oracle 23ai新特性—DBMS_DICTIONARY_CHECK
26-03-03 - oracle怎么处理json格式
oracle怎么处理json格式
26-03-03 - Oracle 23ai新特性—DB_DEVELOPER_ROLE
Oracle 23ai新特性—DB_DEVELOPER_ROLE
26-03-03
