ORA-08104: CREATE/REBUILD online index的失效处理

今天在online rebuild索引时由于应用的特殊性使得索引长期无法获取TM锁,最终只能cancel掉索引,对于create或者rebuild online index异常终止或者cancel掉之后需要清除一些信息(ys_journal_xxx(xxx是object_id)以及其它的不一致的东西),否则无法rebuild或者recreate,也因为被锁无法进行drop操作,在9206,9207,10.2.0.1中smon不会很快地清除index rebuild online失败所带来的对象,在9208,10.2.0.2,11g中这个bug才被fixed.所以在9206,9207,10.2.0.1这些版本中,当我们对大的索引进行index rebuild online时, 不要随意地中断rebuild index online操作,否则smon可能需要很久才能清除临时对象。
Metalink对于如下

Note:375856.1
Note:351585.1
Bug 4364202
Bug 3805539
Bug 2702410

异常终止的情况下,可以发现ind$关于该索引的状态还是online rebuild的:

SQL> select obj#,flags from ind$ where obj#=126516;

OBJ# FLAGS
———- ———-
126516 514
Flag字段的说明可以在ind$的sql.bsq脚本中找到:

/* mutable flags: anything permanent should go into property */
/* unusable (dls) : 0×01 */
/* analyzed : 0×02 */
/* no logging : 0×04 */
/* index is currently being built : 0×08 */
/* index creation was incomplete : 0×10 */
/* key compression enabled : 0×20 */
/* user-specified stats : 0×40 */
/* secondary index on IOT : 0×80 */
/* index is being online built : 0×100 */
/* index is being online rebuilt : 0×200 */
/* index is disabled : 0×400 */
/* global stats : 0×800 */
/* fake index(internal) : 0×1000 */
/* index on UROWID column(s) : 0×2000 */
/* index with large key : 0×4000 */
/* move partitioned rows in base table : 0×8000 */
/* index usage monitoring enabled : 0×10000 */

514=0×202,表示该索引状态为index is being online rebuilt : 0×200 + analyzed : 0×02

在SMON完成清理动作后,再次查询索引状态已经恢复正常:

SQL> select obj#,flags from ind$ where obj#=67420;

OBJ#     FLAGS
———- ———-
126516 2

清除方法为使用DBMS REPAIR.ONLINE INDEX CLEAN这个包

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_id      IN BINARY_INTEGER DEFAULT ALL_INDEX_ID,
   wait_for_lock  IN BINARY_INTEGER DEFAULT LOCK_WAIT)
 RETURN BOOLEAN;
Parameter

Description

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.
 

对于rebuild和rebuild online的区别metalink Note:272762.1 
========
- Online Index rebuild takes a long time.
- ONLINE INDEX REBUILD SCANS THE BASE TABLE AND NOT THE INDEX
Symptoms:
=========
Performance issues while rebuilding very large indexes.
- The offline rebuilds of their index is relatively quick -finishes in 15 minutes.
- Issuing index rebuild ONLINE statement => finishes in about an hour.
- This behavior. of ONLINE index rebuilds makes it a non-option for large tables
as it just takes too long to scan the table to rebuild the index. The offline may not be feasible due to due to the 24/7 nature of the database.
- This may be a loss of functionality for such situations.
- If we attempt to simultaneously ONLINE rebuild the same indexes we may encounter hanging behavior. indefinitely (or more than 6 hours).
DIAGNOSTIC ANALYSIS:
--------------------
We can trace the sessions rebuilding the indexes with 10046 level 12.
Comparing the IO reads for the index-rebuild and the index-rebuild-online reveals the following:
-ONLINE index rebuilds
It scans the base table and it doesn't scan the blocks of the index.
-OFFLINE index rebuilds
It scans the index for the build operation.
- This behaviour is across all versions.
Cause
Cause/Explanation
=============
When you rebuild index online,
- it will do a full tablescan on the base table.
- At the same time it will maintain a journal table for DML data, which has
changed during this index rebuilding operation.
So it should take longer time, specially if you do lots of DML on the same table,while rebuilding index online.
On the other hand, while rebuilding the index without online option, Oracle will grab the index in X-mode and rebuild a new index segment by selecting the data from the old index. So here we are
- not allowing any DML on the table hence there is no journal table involved
- and it is doing an index scan
Hence it will be pretty fast.
Fix
Solution/Conclusion:
===========
- The ONLINE index rebuild reads the base table, and this is by design.
- Rebuilding index ONLINE is pretty slow.
- Rebuilding index offline is very fast, but it prevents any DML on the base table.

来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/22503721/viewspace-714107/,如需转载,请注明出处,否则将追究法律责任。

转载于:http://blog.itpub.net/22503721/viewspace-714107/

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
### 回答1: Oracle 12c是一种强大的数据库管理系统,它可以让用户轻松地管理和维护数据库。然而,有时候会出现ORA-01017错误,提示“用户名/口令无效; 登录被拒绝”。 这个错误通常是由于登录信息(用户名和口令)无效导致的。这可能是因为输入的用户名或口令不正确,或者由于数据库管理员更改了登录凭据而导致登录失败。解决这个问题的方法是正确输入用户名和口令,或者联系数据库管理员以获取正确的凭据。 此外,还有一些其他可能导致ORA-01017错误的原因。例如,数据库可以配置为只允许连接来自某些IP地址或主机名的客户端。如果您没有在连接字符串中正确指定这些参数,则可能无法连接到数据库并出现此错误。解决办法是检查连接字符串并指定正确的参数。 总之,ORA-01017错误可能是由多种原因导致的,但通常可以通过检查登录凭据和连接字符串来解决问题。如果您无法解决问题,请联系数据库管理员以获取帮助。 ### 回答2: ORA-01017是Oracle数据库发生登录错误时的错误代码,错误信息为用户名/口令无效,登录被拒绝。通常,这种错误是由以下情况引起的。 首先,可能是由于输入的用户名和密码不正确,导致登录失败。在此情况下,应该仔细检查输入的用户名和密码是否正确,对大小写敏感,确保输入正确。 其次,可能是Oracle数据库中没有该用户的登录权限,或者没有分配合适的角色和权限。在这种情况下,应该检查该用户是否被授权访问数据库,并确保正确的角色和权限分配。 最后,这种错误可能是因为数据库配置问题,比如说数据库实例或服务没有启动。在这种情况下,应该检查数据库是否正常运行,确保数据库实例或服务已经正确启动。 综上所述,ORA-01017错误通常是由于输入错误的用户名和密码、没有登录权限或数据库未正常运行等问题引起的。对于这种错误,我们需要检查输入的用户名和密码是否正确、该用户是否被授权访问数据库数据库是否正常运行等,以确定解决方法。 ### 回答3: “oracle 12c ora-01017: 用户名/口令无效; 登录被拒绝。”这个错误提示意味着用户输入的账号或者密码不正确,导致登录被拒绝。当出现这种错误时,需要首先检查输入的用户名和口令是否匹配,并且注意大小写是否正确。 在检查账号和密码之后,还需要确保数据库实例已经启动,并且监听器也已经启动。如果数据库实例或者监听程序未启动,会出现无法连接到数据库的情况。因此,需要确保相应的服务都已经启动。 此外,如果用户尝试连接到一个不存在的数据库或者使用错误的连接字符串,也有可能导致登录被拒绝。需要检查连接字符串是否正确,并且确保数据库实例名称和监听器名称也正确。 如果以上步骤都已经检查过,并且仍然无法登录,那么可能是由于权限问题或者安全策略导致的。需要检查用户是否具有正确的权限,并且确保数据库的安全策略不会阻止该用户的登录。 总之,当出现“oracle 12c ora-01017: 用户名/口令无效; 登录被拒绝”错误提示时,需要逐步排查以上问题,以确定错误原因并解决问题。

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值