您好,欢迎来到三六零分类信息网!老站,搜索引擎当天收录,欢迎发信息
免费发信息
三六零分类信息网 > 凉山分类信息网,免费分类信息发布

细说ORA-08104错误

2024/6/29 22:03:07发布31次查看
在线重建索引 (alter index index_name rebuild online)虽然延长了索引重建的时间,却也赋予了我们在线重建索引,提高数据可用性
在线重建索引 (alter index index_name rebuild online)虽然延长了索引重建的时间,却也赋予了我们在线重建索引,提高数据可用性的能力。如果在联机重建索引的过程中出现错误,如用户终止,网络中断等,那么当我们再次重建索引时,,有可能会产生ora-08104错误。这是由于先前的操作痕迹没有清除而造成的。
在线重建索引的过程中,oracle数据库会修改数据字典表,并生成中间表(iot)来记录索引重建期间发生的dml操作。如果重建过程异常中断,smon进程会清理重建痕迹,但是如果系统非常繁忙导致smon应接不暇或者dml操作过多导致smon无法获取相关表上的锁,从而无法清理重建痕迹,当我们再次重建索引时,就会产生ora-08104错误。
下面我们构造一个ora-08104错误
--session 1
sql> alter index ind1 rebuild online;
--session 2
sql> update tab1 set rn = rn+1;
--session 1 网络故障,断线
--session 2
sql> update tab1 set rn = rn+1;
已更新499999行。
sql> commit;
--session 3
sql> alter index ind1 rebuild online;
alter index ind1 rebuild online
*
第 1 行出现错误:
ora-08104: 该索引对象 87859 正在被联机建立或重建
要解决ora-08104错误,就要清除重建痕迹,总结方法如下:
online_index_clean function
this function performs a manual cleanup of failed or interrupted online index builds or rebuilds. this action is also performed periodically by smon, regardless of user-initiated cleanup.
this function returns true if all indexes specified were cleaned up and false if one or more indexes could not be cleaned up.
syntax
dbms_repair.online_index_clean (object_idin binary_integer default all_index_id,wait_for_lock in binary_integer default lock_wait) return boolean;parameters
table 79-8 online_index_clean function parameters
parameterdescription
object_id
object id of index to be cleaned up. the default cleans up all object ids that qualify.
wait_for_lock
this parameter specifies whether to try getting dml locks on underlying table [[sub]partition] object. the default retries up to an internal retry limit, after which the lock get will give up. if lock_nowait is specified, then the lock get does not retry.
declare
isclean boolean;
begin
isclean :=false;
while isclean=false
loop
isclean := dbms_repair.online_index_clean(dbms_repair.all_index_id,dbms_repair.lock_wait);
dbms_lock.sleep(10);
end loop;
 10  end;
 11  /
pl/sql 过程已成功完成。
更多详情见请继续阅读下一页的精彩内容:
相关阅读:
ora-01172、ora-01151错误处理
ora-00600 [2662]错误解决
ora-01078 和 lrm-00109 报错解决方法
ora-00471 处理方法笔记
ora-00314,redolog 损坏,或丢失处理方法
ora-00257 归档日志过大导致无法存储的解决办法
凉山分类信息网,免费分类信息发布

VIP推荐

免费发布信息,免费发布B2B信息网站平台 - 三六零分类信息网 沪ICP备09012988号-2
企业名录