The table partitions where there is data in the table partition but the corresponding index partition does not contain any rows.
select table_name , high_value , num_rows , last_analyzed
from dba_tab_partitions
where table_name = '&P_TABLE_NAME' ;
select index_name , high_value , num_rows , last_analyzed
from dba_ind_partitions
where index_name = '&P_INDEX_NAME' ;
If the TAB_PARTITIONS HIGH_VALUE has a NON-ZERO value but the corresponding INDEX_PARTITION has a 0 VALUE (exception is index: XLA_AE_LINES_N1), then there is the corruption in the index statistics.
In this case use the solution below to get the performance issue resolved.
a. Compile the below function(getPartitionHighValue) which is used in the query (step b).
CREATE OR REPLACE function getPartitionHighValue(
p_partition_type in varchar2,
p_owner in varchar2,
p_name in varchar2,
p_partition_name in varchar2) RETURN VARCHAR2 AS
l_cursor integer default dbms_sql.open_cursor;
l_len number;
l_long_val varchar2(4000);
l_long_len number;
l_n number ;
l_table_name varchar2(50);
BEGIN
IF upper(p_partition_type) = 'TABLE' THEN
dbms_sql.parse(l_cursor,
'select high_value_length , high_value from dba_tab_partitions ' ||
'where table_owner = :1 ' ||
'and table_name = :2 ' ||
'and partition_name = :3 ',
dbms_sql.native );
ELSE
dbms_sql.parse(l_cursor,
'select high_value_length , high_value from dba_ind_partitions ' ||
'where index_owner = :1 ' ||
'and index_name = :2 ' ||
'and partition_name = :3 ',
dbms_sql.native );
END IF;
dbms_sql.bind_variable( l_cursor, ':1', p_owner );
dbms_sql.bind_variable( l_cursor, ':2', p_name );
dbms_sql.bind_variable( l_cursor, ':3', p_partition_name );
dbms_sql.define_column(l_cursor, 1 , l_len);
dbms_sql.define_column_long(l_cursor, 2 );
l_n := dbms_sql.execute(l_cursor);
IF (dbms_sql.fetch_rows(l_cursor)>0) THEN
dbms_sql.column_value(l_cursor, 1 , l_len );
dbms_sql.column_value_long(l_cursor, 2, l_len, 0 ,
l_long_val, l_long_len );
END IF;
dbms_sql.close_cursor(l_cursor);
return l_long_val;
END getPartitionHighValue;
/
b.Run the below sql to check the table partitions where there is data in the table partition but the corresponding index partition does not contain any rows. The only exception should be the index: XLA_***
SELECT tab.table_name ,
getPartitionHighValue('TABLE',tab.table_owner, tab.table_name,
tab.partition_name) "TABLE_HIGH_VALUE" ,
ind.index_name ,
getPartitionHighValue('INDEX',ind.index_owner, ind.index_name,
ind.partition_name) "INDEX_HIGH_VALUE" ,
tab.num_rows "TABLE_NUM_ROWS",
ind.num_rows "INDEX_NUM_ROWS"
FROM dba_tab_partitions tab,
dba_indexes i,
dba_ind_partitions ind
WHERE tab.table_name = i.table_name
AND tab.table_owner = i.table_owner
AND i.index_name = ind.index_name
AND i.owner = ind.index_owner
AND tab.table_name IN
('XLA_AE_HEADERS','XLA_AE_LINES',
'XLA_DISTRIBUTION_LINKS','XLA_EVENTS',
'XLA_TRANSACTION_ENTITIES')
AND getPartitionHighValue('TABLE',tab.table_owner,
tab.table_name, tab.partition_name) =
getPartitionHighValue('INDEX',ind.index_owner,
ind.index_name, ind.partition_name)
AND tab.num_rows <> 0
AND ind.num_rows = 0;
Run the below SQL to check the table partitions where there is data in the table partition but the corresponding index partition does not contain any rows.
SELECT tab.table_name ,
getPartitionHighValue('TABLE',tab.table_owner, tab.table_name,
tab.partition_name) "TABLE_HIGH_VALUE" ,
ind.index_name ,
getPartitionHighValue('INDEX',ind.index_owner, ind.index_name,
ind.partition_name) "INDEX_HIGH_VALUE" ,
tab.num_rows "TABLE_NUM_ROWS",
ind.num_rows "INDEX_NUM_ROWS"
FROM dba_tab_partitions tab,
dba_indexes i,
dba_ind_partitions ind
WHERE tab.table_name = i.table_name
AND tab.table_owner = i.table_owner
AND i.index_name = ind.index_name
AND i.owner = ind.index_owner
AND tab.table_name IN
('XLA_AE_HEADERS','XLA_AE_LINES','XLA_DISTRIBUTION_LINKS',
'XLA_EVENTS','XLA_TRANSACTION_ENTITIES')
AND getPartitionHighValue('TABLE',tab.table_owner,
tab.table_name, tab.partition_name) =
getPartitionHighValue('INDEX',ind.index_owner,
ind.index_name, ind.partition_name)
AND tab.num_rows <> 0
AND ind.num_rows = 0;
This time after the patch application, nothing should be shown except for the index XLA_AE_LINES_N1 in the sql.
Should the issue persist, please provide a TKPROF and SQLTXPLAIN output of the program as well the output of the below SQL's:
SELECT * FROM dba_tab_partitions
WHERE table_owner = 'XLA'
AND table_name IN ('XLA_AE_HEADERS','XLA_AE_LINES',
'XLA_DISTRIBUTION_LINKS','XLA_EVENTS',
'XLA_TRANSACTION_ENTITIES')
ORDER BY table_name, partition_position;
SELECT * FROM dba_ind_partitions
WHERE index_owner = 'XLA'
AND (index_name LIKE 'XLA_AE_HEADERS%' OR
index_name LIKE 'XLA_AE_LINES%' OR
index_name LIKE 'XLA_DISTRIBUTION_LINKS%' OR
index_name LIKE 'XLA_EVENTS%' OR
index_name LIKE 'XLA_TRANSACTION_ENTITIES%')
ORDER BY index_name, partition_position;
分享到:
相关推荐
Oracle 19C是Oracle数据库的一个重要版本,OCP(Oracle Certified Professional)是Oracle公司针对其产品提供的专业认证,旨在证明个人在Oracle数据库管理、优化和运维方面的技能和知识。以下是对Oracle 19C OCP相关...
6. OracleHOME_NAMEDataGatherer:性能包数据采集服务,用于Oracle Capacity Planner和Oracle Performance Manager,收集性能数据。如果不使用这些性能监控工具,可以保持手动启动状态。 7. OracleHOME_...
### DAVE Oracle DG 学习笔记 #### DataGuard架构与背景 Oracle Data Guard(简称DG)是一种用于构建高可用性和灾难恢复解决方案的技术。它通过在主数据库(Primary Database)和辅助数据库(Standby Database)...
随着Oracle 11g的发布,性能调优的重点不再仅仅集中在提高缓存击中率上。Oracle Wait Interface(OWI)是基于等待事件的调优方法,它依赖于对一千多种等待事件的记录,帮助DBA快速识别和解决性能瓶颈。OWI方法论强调...
Oracle数据库提供了一系列动态性能视图(Dynamic Performance Views),也称为V$视图,它们提供了数据库运行时的统计信息,这些信息对于监控和诊断数据库问题至关重要。从提供的文件内容中,我们可以看到以下几个...
描述中提到的"SG"进一步解释为可能是原厂教材,也可能是Sybex出版的"OCP Oracle 9i Performance Tuning Study Guide"等四本书。这表明我们正在讨论的是关于Oracle数据库管理的高级主题,特别是性能调优。OCP(Oracle...
Oracle提供了一系列工具和视图,如V$视图、动态性能视图(Dynamic Performance Views)和企业管理器(Enterprise Manager),用于监控数据库性能,诊断和解决问题。 十、Oracle 12c及更高版本的新特性 Oracle 12c...
- DataGuard 支持三种不同的保护模式:Maximum Availability、Maximum Performance 和 Maximum Protection。 - 这些模式分别针对不同的业务需求,例如对高可用性的极端追求、性能优化或者数据完整性保护。 3. **...
Navigation Bar、Shopping Cart、Cross-Brower Support、Performance. 通过实际项目, 培养学生实战能力,包括系统分析、设计(包括功能需求分析、数据库设计、功能模块设计和详细设计)、开发、调试、测试和部署的能力...
价值一万八的中美 IT 培训笔记一万多培训费的资料,北京权威的.NET培训机构】 【认真学习后你一定能成为优秀的.net程序员】 学习对象:1.大专及大专以上理工科学历,或有相当学历的理工科教育背景 2.热爱...
Navigation Bar、Shopping Cart、Cross-Brower Support、Performance. 通过实际项目, 培养学生实战能力,包括系统分析、设计(包括功能需求分析、数据库设计、功能模块设计和详细设计)、开发、调试、测试和部署的能力...
5. **数据库资源管理**:Oracle的自动工作负载管理(Automatic Workload Repository, AWR)和动态性能视图(Dynamic Performance Views, V$视图)可以帮助监控数据库性能,并根据需要调整PGA和SGA内存、调度资源、...
在 MySQL 中,常见的关系型数据库包括 Oracle、SQL Server 和 DB2。 【数据库的创建与管理】 创建数据库可以使用 DDL(Data Definition Language)语句,例如 `CREATE DATABASE dbname;`。当数据库已存在时,尝试...
### DataGuard简明笔记 #### 一、基础知识 ##### (一) REDO 传输 **DataGuard**的核心机制之一就是**REDO**日志的传输与应用。在**Oracle DataGuard**环境中,**Primary**数据库负责生成并传输**REDO**日志至**...
1. **访问 Oracle 官方网站**:首先访问 Oracle 的 edelivery 网站 (http://edelivery.oracle.com),并选择“Oracle Enterprise Performance Management System”。 2. **下载安装包**:为本教程下载的是 32 位...