标签云
asm恢复 bbed bootstrap$ dul kcbzib_kcrsds_1 kccpb_sanity_check_2 kcratr_nab_less_than_odr MySQL恢复 obet ORA-00312 ORA-00704 ORA-00742 ORA-01110 ORA-01200 ORA-01555 ORA-01578 ORA-01595 ORA-600 2662 ORA-600 2663 ORA-600 3020 ORA-600 4000 ORA-600 4137 ORA-600 4193 ORA-600 4194 ORA-600 16703 ORA-600 kcbzib_kcrsds_1 ORA-600 KCLCHKBLK_4 ORA-600 kcratr_nab_less_than_odr ORA-15042 ORA-15196 ORACLE 12C oracle dul ORACLE PATCH Oracle Recovery Tools oracle加密恢复 oracle勒索 oracle勒索恢复 oracle异常恢复 ORACLE恢复 Oracle 恢复 ORACLE数据库恢复 oracle碎片 OSD-04016 YOUR FILES ARE ENCRYPTED 比特币加密文章分类
- MongoDB (1)
- MongoDB恢复 (1)
- Others (2)
- 中间件 (2)
- WebLogic (2)
- 操作系统 (112)
- 数据库 (1,878)
- DB2 (22)
- MySQL (82)
- Oracle (1,704)
- Data Guard (53)
- EXADATA (8)
- GoldenGate (24)
- ORA-xxxxx (168)
- ORACLE 12C (72)
- ORACLE 18C (6)
- ORACLE 19C (15)
- ORACLE 21C (3)
- Oracle 23ai (8)
- Oracle ASM (72)
- Oracle Bug (8)
- Oracle RAC (56)
- Oracle 安全 (6)
- Oracle 开发 (28)
- Oracle 监听 (29)
- Oracle备份恢复 (659)
- Oracle安装升级 (107)
- Oracle性能优化 (62)
- 专题索引 (5)
- 勒索恢复 (91)
- PostgreSQL (37)
- pdu工具 (7)
- PostgreSQL恢复 (13)
- SQL Server (34)
- SQL Server恢复 (14)
- TimesTen (7)
- 达梦数据库 (5)
- 达梦恢复 (3)
- 生活娱乐 (2)
- 至理名言 (11)
- 虚拟化 (2)
- VMware (2)
- 软件开发 (51)
- Asp.Net (9)
- JavaScript (12)
- PHP (2)
- 小工具 (34)
- MongoDB (1)
-
最近发表
- 由于con$.con#值达到极限,触发数据库增加约束报ORA-600 12807错误
- MongoDB 离线提取工具—mongoext
- .bres勒索病毒加密数据库dmp文件可恢复
- ORA-600 krsm_mrp_rebuild_lf_list.lno_mismatch
- 记录一次0丢失的ORA-00354: 损坏重做日志块标头故障恢复
- 不当数据库恢复操作导致一个月数据丢失
- obet快速修复oracle 位图损坏块
- 不太常见的10.2.0.1的oracle redo损坏恢复
- obet forcecopy功能抢救硬件故障中的数据文件
- kcratr_nab_less_than_odr和system坏块故障处理
- 通过obet 恢复system坏块,打开数据库
- obet dbv功能完整说明
- 分享一例运行在aix上的sap系统数据库恢复过程
- OBET-Oracle Block Editor Tool使用说明
- 几乎动用了所有手段的Oracle故障恢复
- Oracle Block Edit Tool (obet) 功能增强–2026.07
- Oracle 19c 202607补丁(RUs+OJVM)-19.32
- Patch_SCN快速修复ORA-01555数据库open故障
- 快速处理 ORA-01210: data file header is media corrupt 故障
- ORA-00314: log 3 of thread 1, expected sequence# N doesn’t match 0
分类目录归档:Oracle
Some indexes or index [sub]partitions of table VAS.TAB_PUB_CALLLOG have been marked unusable
1、检查alert日志发现错误
Wed Nov 30 13:36:47 2011 Some indexes or index [sub]partitions of table VAS.TAB_PUB_CALLLOG have been marked unusable Wed Nov 30 13:36:48 2011 Some indexes or index [sub]partitions of table VAS.TAB_PUB_CALLLOG have been marked unusable Wed Nov 30 13:36:48 2011 Some indexes or index [sub]partitions of table VAS.TAB_PUB_CALLLOG have been marked unusable Wed Nov 30 13:36:49 2011 Some indexes or index [sub]partitions of table VAS.TAB_PUB_CALLLOG have been marked unusable Wed Nov 30 13:36:50 2011 Some indexes or index [sub]partitions of table VAS.TAB_PUB_CALLLOG have been marked unusable Wed Nov 30 13:36:51 2011 Some indexes or index [sub]partitions of table VAS.TAB_PUB_CALLLOG have been marked unusable Wed Nov 30 13:36:52 2011 Some indexes or index [sub]partitions of table VAS.TAB_PUB_CALLLOG have been marked unusable Wed Nov 30 13:36:52 2011 Some indexes or index [sub]partitions of table VAS.TAB_PUB_CALLLOG have been marked unusable Wed Nov 30 13:36:53 2011 Some indexes or index [sub]partitions of table VAS.TAB_PUB_CALLLOG have been marked unusable Wed Nov 30 13:36:54 2011 Some indexes or index [sub]partitions of table VAS.TAB_PUB_CALLLOG have been marked unusable Wed Nov 30 13:36:55 2011 Some indexes or index [sub]partitions of table VAS.TAB_PUB_CALLLOG have been marked unusable Wed Nov 30 13:36:56 2011 Some indexes or index [sub]partitions of table VAS.TAB_PUB_CALLLOG have been marked unusable Wed Nov 30 13:36:56 2011 Some indexes or index [sub]partitions of table VAS.TAB_PUB_CALLLOG have been marked unusable Wed Nov 30 13:36:57 2011 Some indexes or index [sub]partitions of table VAS.TAB_PUB_CALLLOG have been marked unusable Wed Nov 30 13:36:57 2011 Some indexes or index [sub]partitions of table VAS.TAB_PUB_CALLLOG have been marked unusable Wed Nov 30 13:36:58 2011 Some indexes or index [sub]partitions of table VAS.TAB_PUB_CALLLOG have been marked unusable Wed Nov 30 13:37:12 2011 Some indexes or index [sub]partitions of table VAS.TAB_PUB_CALLLOG have been marked unusable Wed Nov 30 22:00:09 2011 ………… Wed Nov 30 22:00:15 2011 GATHER_STATS_JOB encountered errors. Check the trace file. Wed Nov 30 22:00:15 2011 Errors in file /opt/oracle/admin/ora9i/bdump/ora9i_j001_21372.trc: ORA-20000: index "VAS"."XN_CALLLOG_ANALYSIS_PK" or partition of such index is in unusable state
2、查看trace文件
/opt/oracle/admin/ora9i/bdump/ora9i_j001_21372.trc
Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
ORACLE_HOME = /opt/oracle/product/10.2.0/db_1
System name: Linux
Node name: localhost.localdomain
Release: 2.6.18-92.el5
Version: #1 SMP Tue Apr 29 13:16:15 EDT 2008
Machine: x86_64
Instance name: ora9i
Redo thread mounted by this instance: 1
Oracle process number: 42
Unix process pid: 21372, image: oracle@localhost.localdomain (J001)
*** 2011-11-30 22:00:15.782
*** ACTION NAME:(GATHER_STATS_JOB) 2011-11-30 22:00:15.763
*** MODULE NAME:(DBMS_SCHEDULER) 2011-11-30 22:00:15.763
*** SERVICE NAME:(SYS$USERS) 2011-11-30 22:00:15.763
*** SESSION ID:(532.60095) 2011-11-30 22:00:15.763
ORA-20000: index "VAS"."XN_CALLLOG_ANALYSIS_PK" or partition of such index is in unusable state
*** 2011-11-30 22:00:15.782
GATHER_STATS_JOB: GATHER_TABLE_STATS('"VAS"','"TAB_XN_CALLLOG_ANALYSIS"','""', ...)
ORA-20000: index "VAS"."XN_CALLLOG_ANALYSIS_PK" or partition of such index is in unusable state
3、日志初步结论
通过alert日志,感觉应该是对分区表操作,导致”VAS”.”XN_CALLLOG_ANALYSIS_PK”索引变成了unusable state,然后在数据库自动收集统计信息的时候报错(最大可能是全局index导致)
4、验证猜测是否正确
SQL> SELECT owner,index_name,table_name,status FROM DBA_indexes 2 WHERE index_name='XN_CALLLOG_ANALYSIS_PK' AND owner='VAS'; OWNER INDEX_NAME TABLE_NAME STATUS ------------------------------ ------------------------------ ------------------------------ -------- VAS XN_CALLLOG_ANALYSIS_PK TAB_XN_CALLLOG_ANALYSIS UNUSABLE
5、解决相关问题问题
SELECT 'ALTER INDEX ' || INDEX_OWNER || '.' || INDEX_NAME ||
'REBUILD PARTITION ' || PARTITION_NAME || ' NOLOGGING online;'
FROM DBA_IND_PARTITIONS
WHERE INDEX_OWNER NOT IN ('SYS', 'SYSTEM', 'PUBLIC')
AND STATUS = 'UNUSABLE'
UNION ALL
SELECT 'alter index ' ||OWNER || '.' || A.INDEX_NAME || ' REBUILD online nologging;'
FROM DBA_INDEXES A
WHERE OWNER NOT IN ('SYS', 'SYSTEM', 'PUBLIC')
AND STATUS = 'UNUSABLE';
执行生成sql,解决相关index unusable问题
V$PWFILE_USERS和密码文件关系
一、V$PWFILE_USERS定义
V$PWFILE_USERS lists all users in the password file, and indicates whether the user has been granted the SYSDBA, SYSOPER, and SYSASM privileges. Column Datatype Description USERNAM VARCHAR2(30) Name of the user that is contained in the password file SYSDBA VARCHAR2(5) Indicates whether the user can connect with SYSDBA privileges (TRUE) or not (FALSE) SYSOPER VARCHAR2(5) Indicates whether the user can connect with SYSOPER privileges (TRUE) or not (FALSE) SYSASM VARCHAR2(5) Indicates whether the user can connect with SYSASM privileges (TRUE) or not (FALSE)
二、v$pwfile_users与密码文件关系
[oracle@node1 ~]$ sqlplus / as sysdba SQL*Plus: Release 11.2.0.3.0 Production on Sun Dec 4 19:08:06 2011 Copyright (c) 1982, 2011, Oracle. All rights reserved. Connected to: Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production With the Partitioning, Oracle Label Security, OLAP, Data Mining, Oracle Database Vault and Real Application Testing options --查看密码文件用户权限 SQL> select * from v$pwfile_users; USERNAME SYSDB SYSOP SYSAS ------------------------------ ----- ----- ----- SYS TRUE TRUE FALSE SQL> show parameter instance_name; NAME TYPE VALUE ------------------------------------ ----------- ------------------ instance_name string ora11g --查看系统级别查看密码文件内容 SQL> !strings $ORACLE_HOME/dbs/orapwora11g ]\[Z ORACLE Remote Password file INTERNAL A1174901D667F113 18698BFD1A045BCC --创建新sysdba用户,查看视图和密码文件变化 SQL> create user xff01 identified by xifenfei; User created. SQL> grant sysdba to xff01; Grant succeeded. SQL> select * from v$pwfile_users; USERNAME SYSDB SYSOP SYSAS ------------------------------ ----- ----- ----- SYS TRUE TRUE FALSE XFF01 TRUE FALSE FALSE SQL> !strings $ORACLE_HOME/dbs/orapwora11g ]\[Z ORACLE Remote Password file INTERNAL A1174901D667F113 18698BFD1A045BCC XFF01 D32693095588EF4F --删除密码文件 SQL> ! mv $ORACLE_HOME/dbs/orapwora11g $ORACLE_HOME/dbs/orapwora11g_bak SQL> !ls $ORACLE_HOME/dbs/orapwora11g ls: /opt/oracle/product/11.2.0/db_1/dbs/orapwora11g: 没有那个文件或目录 --查看视图 SQL> select * from v$pwfile_users; no rows selected SQL> ! mv $ORACLE_HOME/dbs/orapwora11g_bak $ORACLE_HOME/dbs/orapwora11g SQL> !ls $ORACLE_HOME/dbs/orapwora11g /opt/oracle/product/11.2.0/db_1/dbs/orapwora11g SQL> select * from v$pwfile_users; USERNAME SYSDB SYSOP SYSAS ------------------------------ ----- ----- ----- SYS TRUE TRUE FALSE XFF01 TRUE FALSE FALSE --改变sysdba用户权限,视图内容变化 SQL> grant sysoper to xff01; Grant succeeded. SQL> select * from v$pwfile_users; USERNAME SYSDB SYSOP SYSAS ------------------------------ ----- ----- ----- SYS TRUE TRUE FALSE XFF01 TRUE TRUE FALSE --密码文件内容无变化 SQL> !strings $ORACLE_HOME/dbs/orapwora11g ]\[Z ORACLE Remote Password file INTERNAL A1174901D667F113 18698BFD1A045BCC XFF01 D32693095588EF4F SQL> revoke sysdba from xff01; Revoke succeeded. SQL> select * from v$pwfile_users; USERNAME SYSDB SYSOP SYSAS ------------------------------ ----- ----- ----- SYS TRUE TRUE FALSE XFF01 FALSE TRUE FALSE SQL> revoke sysoper from xff01; Revoke succeeded. SQL> select * from v$pwfile_users; USERNAME SYSDB SYSOP SYSAS ------------------------------ ----- ----- ----- SYS TRUE TRUE FALSE XFF01 FALSE FALSE FALSE SQL> revoke sysoper from xff01; Revoke succeeded. --回收sysdba,sysoper权限后,视图记录消失 SQL> select * from v$pwfile_users; USERNAME SYSDB SYSOP SYSAS ------------------------------ ----- ----- ----- SYS TRUE TRUE FALSE --密码文件内容无变化 SQL> !strings $ORACLE_HOME/dbs/orapwora11g ]\[Z ORACLE Remote Password file INTERNAL A1174901D667F113 18698BFD1A045BCC XFF01 D32693095588EF4F --删除其中sysdba用户 SQL> drop user xff01; User dropped. --密码文件内容还是无变化 SQL> !strings $ORACLE_HOME/dbs/orapwora11g ]\[Z ORACLE Remote Password file INTERNAL A1174901D667F113 18698BFD1A045BCC XFF01 D32693095588EF4F --重启数据库密码文件依然无变化 SQL> shutdown immediate Database closed. Database dismounted. ORACLE instance shut down. SQL> !strings $ORACLE_HOME/dbs/orapwora11g ]\[Z ORACLE Remote Password file INTERNAL A1174901D667F113 18698BFD1A045BCC XFF01 D32693095588EF4F
1、如果密码文件不存在或者名称错误,查询v$pwfile_users将得到空记录
2、添加sysdba等权限用户,会记录到密码文件和v$pwfile_users中
3、到回收sysdba等权限用户,密码文件记录依然存在,但是v$pwfile_users中无对应记录
三、远程登录测试
--密码文件记录存在,视图不记录不存在,登录失败 [oracle@node1 ~]$ sqlplus xff01/xifenfei@ora11g as sysdba SQL*Plus: Release 10.2.0.5.0 - Production on Sun Dec 4 19:42:26 2011 Copyright (c) 1982, 2010, Oracle. All Rights Reserved. ERROR: ORA-01031: insufficient privileges Enter user-name --密码文件视图记录均存在,登录成功 [oracle@node1 ~]$ sqlplus sys/xifenfei@ora11g as sysdba SQL*Plus: Release 10.2.0.5.0 - Production on Sun Dec 4 19:42:10 2011 Copyright (c) 1982, 2010, Oracle. All Rights Reserved. Connected to an idle instance.
是否能远程登录,依照v$pwfile_users为准
四、创建密码文件
win: orapwd file=%ORACLE_HOME%\database\PWD%ORACLE_SID%.ora entries=3 password=manager force=y linux: orapwd file=$ORACLE_HOME/dbs/orapw$ORACLE_SID entries=3 password=manager force=y
发表在 Oracle
评论关闭
ORA-1502问题分析解决
1、出现ORA-1502
接到开发报告,我们报表程序出现SQLCODE=[-1502]错误提示,sql执行不成功,根据这个提示,我猜想是ORA-1502错误,查询ora-1502错误
[oracle@node1 ~]$ oerr ora 1502 01502, 00000, "index '%s.%s' or partition of such index is in unusable state" // MERGE: 1489 RENUMBERED TO 1502 // *Cause: An attempt has been made to access an index or index partition // that has been marked unusable by a direct load or by a DDL // operation // *Action: DROP the specified index, or REBUILD the specified index, or // REBUILD the unusable index partition
根据这个提示,错误的原因是因为有index编程unusable state
--查询分区index是否有UNUSABLE的index
SQL> col index_owner for a20
SQL> col index_name for a30
SQL> col partition_name for a20
SQL> SELECT INDEX_OWNER, INDEX_NAME, PARTITION_NAME
2 FROM DBA_IND_PARTITIONS
3 WHERE INDEX_OWNER NOT IN ('SYS', 'SYSTEM', 'PUBLIC')
4 AND STATUS = 'UNUSABLE';
INDEX_OWNER INDEX_NAME PARTITION_NAME
-------------------- ------------------------------ --------------------
STAT_YDZJ IND_STAT_DAY_COMPANY_DAY P_201111
STAT_YDZJ IND_STAT_DAY_COMPANY_MOBILE P_201111
STAT_YDZJ IND_STAT_DAY_COMPANY_AREA P_201111
--查询无效全局index和普通index
SQL> SELECT OWNER, a.index_name
2 FROM Dba_Indexes a
3 WHERE OWNER NOT IN ('SYS', 'SYSTEM', 'PUBLIC')
4 AND ROWNUM<2;
OWNER INDEX_NAME
------------------------------ ------------------------------
STAT_YDZJ PK_ND_STAT_DAY_COMPANY
2、解决问题
批量生产sql语句,重建这些unusable index
SELECT 'ALTER INDEX ' || INDEX_OWNER || '.' || INDEX_NAME ||
' REBUILD PARTITION ' || PARTITION_NAME || ' NOLOGGING online;'
FROM DBA_IND_PARTITIONS
WHERE INDEX_OWNER NOT IN ('SYS', 'SYSTEM', 'PUBLIC')
AND STATUS = 'UNUSABLE'
UNION ALL
SELECT 'alter index ' ||OWNER || '.' || A.INDEX_NAME || ' REBUILD online nologging;'
FROM DBA_INDEXES A
WHERE OWNER NOT IN ('SYS', 'SYSTEM', 'PUBLIC')
AND STATUS = 'UNUSABLE';
执行完上面sql生成语句后,让开发测试程序,反馈工作正常
3、问题分析
我昨天对STAT_DAY_COMPANY表添加了分区(SPLIT拆分MAXVALUE),本以为该表的所有index都是local index不知道为何有了一个全局index(公司规定所有分区表都只能建立local index),所以没有做相关查询,导致这次出现了index无效。但是为什么还有三个local index也变成了unusable,这个估计是大批量append插入数据导致。而开发那边正好是批量append插入数据到STAT_DAY_COMPANY表中,导致出现了ORA-1502错误
建议:处理分区表时,要对index查询清楚,不要按照规定或者惯性思维办事。

加我微信(17813235971)
加我QQ(107644445)

